Enhancement: Support comma separated arrays in front matter #78

Closed
opened 2026-10-05 02:24:33 +02:00 by adam · 11 comments
Owner

Is your feature request related to a problem? Please describe.

When using Pelican markdown files with frontmatter I get several issues:

  • Tags are added a quote all together, I guess because it expects array type with quoted items, which is not the case with Pelican
  • date and modified are quoted... again, not what Pelican expects, causing failures on rendering

Describe the solution you'd like

Allow configurable 'frontmatter' styling for 'hugo', 'pelican' or others

Describe alternatives you've considered
So far, disabling and uninstalling the extension as it was breaking the articles I've. I've tried setting date format in settings and not add quotes, but still it adds them.

**Is your feature request related to a problem? Please describe.** When using Pelican markdown files with frontmatter I get several issues: - Tags are added a quote all together, I guess because it expects array type with quoted items, which is not the case with Pelican - date and modified are quoted... again, not what Pelican expects, causing failures on rendering **Describe the solution you'd like** Allow configurable 'frontmatter' styling for 'hugo', 'pelican' or others **Describe alternatives you've considered** So far, disabling and uninstalling the extension as it was breaking the articles I've. I've tried setting date format in settings and not add quotes, but still it adds them. <!-- github-sync-id:996970682 -->
adam closed this issue 2026-10-05 02:24:33 +02:00
Author
Owner

BTW I've found the "frontMatter.taxonomy.noPropertyValueQuotes": ["modified", "date", "tags"], but I think that a dropdown to select compatibility will make it easier ;-)

BTW I've found the "frontMatter.taxonomy.noPropertyValueQuotes": ["modified", "date", "tags"], but I think that a dropdown to select compatibility will make it easier ;-) <!-- github-comment-id:919936860 -->
Author
Owner

Thank @iranzo for reporting this. The frontMatter.taxonomy.noPropertyValueQuotes setting is exactly meant for this. As some need quotes, and others don't.

Having an optimized settings experience is on backlog #80. The dropdown would be a nice addition to it.

I did some tests, and in the projects, I use for testing it is working as expected, but it might be because of all use YAML.

What is Pelican using? Would you be able to share a sample page with the front matter and content?

Thank @iranzo for reporting this. The `frontMatter.taxonomy.noPropertyValueQuotes` setting is exactly meant for this. As some need quotes, and others don't. Having an optimized settings experience is on backlog #80. The dropdown would be a nice addition to it. I did some tests, and in the projects, I use for testing it is working as expected, but it might be because of all use `YAML`. What is Pelican using? Would you be able to share a sample page with the front matter and content? <!-- github-comment-id:919943352 -->
Author
Owner
Pelican is also using YAML, for example: https://github.com/iranzo/iranzo.github.io/blob/master/content/2021-09-11-rhel8-administration.en.md <!-- github-comment-id:919947368 -->
Author
Owner

I think that there are other things involved in the way Frontmatter processes the files:

image

Even if the quotes are not enabled to be used, seems that it tries to read those as 'hugo'-style keys/values

I think that there are other things involved in the way Frontmatter processes the files: ![image](https://user-images.githubusercontent.com/312463/133429398-681f615f-ee97-4d97-a76a-d0bd51a050e7.png) Even if the quotes are not enabled to be used, seems that it tries to read those as 'hugo'-style keys/values <!-- github-comment-id:919955467 -->
Author
Owner

Hugo doesn't use a style, they use YAML format, like other site generators. It is gray-matter which does the parsing.

I'll validate it against your blog content, thanks for the reference.

Hugo doesn't use a style, they use YAML format, like other site generators. It is `gray-matter` which does the parsing. I'll validate it against your blog content, thanks for the reference. <!-- github-comment-id:919986261 -->
Author
Owner

Sorry, for 'style' I meant for arrays, pelican uses comma separated words, but seems that it expects a [ and ] for specifying more than one tag

Sorry, for 'style' I meant for arrays, pelican uses comma separated words, but seems that it expects a `[` and `]` for specifying more than one tag <!-- github-comment-id:919987145 -->
Author
Owner

There are two issues:

  1. The title contains [] - so the YAML parser thinks you're adding an array
  2. Arrays in YAML can be [] or like:
tags:
  - tag 1
  - tag 2
There are two issues: 1. The title contains `[]` - so the YAML parser thinks you're adding an array 2. Arrays in YAML can be `[]` or like: ``` tags: - tag 1 - tag 2 ``` <!-- github-comment-id:919990881 -->
Author
Owner

Yes, and 'neither' example 1, or example 2 are taken by pelican (I guess it should), but only parses keywords as comma-separated words

Yes, and 'neither' example 1, or example 2 are taken by pelican (I guess it should), but only parses keywords as comma-separated words <!-- github-comment-id:919993517 -->
Author
Owner

The title will need to be manually escaped. I will add a title input on the panel as well soon so that it will automatically escape it for you.

Screenshot 2021-09-15 at 14 56 46

Screenshot 2021-09-15 at 14 57 10

The title will need to be manually escaped. I will add a title input on the panel as well soon so that it will automatically escape it for you. ![Screenshot 2021-09-15 at 14 56 46](https://user-images.githubusercontent.com/2900833/133437845-fd9d75c9-6d6e-41d6-b98e-774e145ac61d.png) ![Screenshot 2021-09-15 at 14 57 10](https://user-images.githubusercontent.com/2900833/133437875-bc8b07c4-790c-476d-9330-12b5cd361250.png) <!-- github-comment-id:919996588 -->
Author
Owner

I got good news, I changed some internal logic and the new version will be able to work with comma-separated array values.

In order to support this, you'll have to do the following in your settings.json:

{
  "frontMatter.taxonomy.commaSeparatedFields": [
    "tags"
  ],
  "frontMatter.taxonomy.noPropertyValueQuotes": [
    "tags"
  ],
  "frontMatter.taxonomy.tags": [
    "Packt Publishing",
    "RHCSA",
    "RHEL",
    "book",
    "system administration",
    "foss"
  ]
}

As the comma-separated arrays are not valid YAML, you will have to let Front Matter know how to parse it. That is why the new frontMatter.taxonomy.commaSeparatedFields is introduced.

If you want to test it out, you can install the beta version of Front Matter: https://beta.frontmatter.codes - https://marketplace.visualstudio.com/items?itemName=eliostruyf.vscode-front-matter-beta

Be sure to uninstall the main version, as the two cannot run or be installed at the same time.

I got good news, I changed some internal logic and the new version will be able to work with comma-separated array values. In order to support this, you'll have to do the following in your `settings.json`: ``` { "frontMatter.taxonomy.commaSeparatedFields": [ "tags" ], "frontMatter.taxonomy.noPropertyValueQuotes": [ "tags" ], "frontMatter.taxonomy.tags": [ "Packt Publishing", "RHCSA", "RHEL", "book", "system administration", "foss" ] } ``` As the comma-separated arrays are not valid YAML, you will have to let Front Matter know how to parse it. That is why the new `frontMatter.taxonomy.commaSeparatedFields` is introduced. If you want to test it out, you can install the beta version of Front Matter: https://beta.frontmatter.codes - https://marketplace.visualstudio.com/items?itemName=eliostruyf.vscode-front-matter-beta Be sure to uninstall the main version, as the two cannot run or be installed at the same time. <!-- github-comment-id:920092617 -->
Author
Owner

Great, it seems to work fine with the tags, looking forward for the autoescape too!

Thanks a lot!

Great, it seems to work fine with the tags, looking forward for the autoescape too! Thanks a lot! <!-- github-comment-id:920098021 -->
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: adam/vscode-front-matter#78