Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend front matter support #128

Open
alexmozaidze opened this issue Dec 8, 2023 · 0 comments
Open

Extend front matter support #128

alexmozaidze opened this issue Dec 8, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@alexmozaidze
Copy link

alexmozaidze commented Dec 8, 2023

Feature

Allow specifying language to use in front matter like so:

---toml
answer = 42
---

Reason

11ty uses gray-matter for parsing front matter, which supports using any language as front matter, but doesn't support +++ notation for TOML.

+++ support workaround for gray-matter

In order to hack in support for +++, you have to make +++ a delimiter, and make TOML the default engine. Here's an example with 11ty config:

const toml = require("@iarna/toml");
module.exports = function(cfg) {
  cfg.setFrontMatterParsingOptions({
    engines: { toml: toml.parse.bind(toml) },
    language: "toml",
    delimiters: "+++",
  });
};
@alexmozaidze alexmozaidze added the enhancement New feature or request label Dec 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant