-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Description
Is your feature request related to a problem? Please describe.
I’m a developer at Filecoin Foundation and review content PRs coming from Decap CMS.
I’ve noticed that some Markdown entries have leading and trailing spaces in the frontmatter. I don't think our content team does this intentionally, but either way, there should be a way to automatically clean the frontmatter strings before submission to GitHub. The result would be the equivalent of calling .trim() on the strings.
---
title: " Fresh From FF: February, 2025 " # Should not happen
created-on: 2025-02-03T15:32:00.000Z
updated-on: 2025-02-03T15:32:00.000Z
published-on: 2025-02-03T15:32:00.000Z
category: reports
description: Check out the latest updates about what Filecoin Foundation has been up to.
Describe the solution you'd like
I believe this should be handled automatically. I can’t think of a scenario where leading or trailing spaces in a string are intentional or useful for content authors.
If doing it automatically isn’t an option, there should at least be a option in config.yml
, such as:
local_backend: true
site_url: https://fil.org
display_url: https://fil.org
# ...
trim_whitespace: true
Describe alternatives you've considered
We tried registering a pre-save hook to do this, but handling all edge cases—especially with deeply nested content—proved to be too tricky.
We also tried using Prettier to clean the content, but it doesn’t remove whitespace from strings enclosed in quotation marks.
Additional context
Let me know if I can help!
Thank you 🙂