[GH-ISSUE #65] support for frontmatter in the middle of the text #1900

Closed
opened 2026-03-07 20:02:35 +03:00 by kerem · 6 comments
Owner

Originally created by @igalic on GitHub (Jul 21, 2017).
Original GitHub issue: https://github.com/DavidAnson/markdownlint/issues/65

Some of our markdown documents have frontmatter, but also… "middle-matter"

that frontmatter uses the exact same style, and usually declares (sub) sections:

---
section: faq
---

is there any way we can rig the frontmatter config to — optionally — support that, too?

Originally created by @igalic on GitHub (Jul 21, 2017). Original GitHub issue: https://github.com/DavidAnson/markdownlint/issues/65 Some of our markdown documents have frontmatter, but also… "middle-matter" that frontmatter uses the exact same style, and usually declares (sub) sections: ``` --- section: faq --- ``` is there any way we can rig the frontmatter config to — optionally — support that, too?
kerem 2026-03-07 20:02:35 +03:00
Author
Owner

@igalic commented on GitHub (Jul 21, 2017):

i've committed a fix to one of our blogs, referencing this so you can see what it looks like!

<!-- gh-comment-id:317019587 --> @igalic commented on GitHub (Jul 21, 2017): i've committed a fix to one of our blogs, referencing this so you can see what it looks like!
Author
Owner

@DavidAnson commented on GitHub (Jul 21, 2017):

Is middle-matter a real thing, or something custom with your process? I have an idea and may implement this regardless, but would feel better about the investment if I knew it was a widespread need. :)

<!-- gh-comment-id:317041182 --> @DavidAnson commented on GitHub (Jul 21, 2017): Is middle-matter a real thing, or something custom with your process? I have an idea and may implement this regardless, but would feel better about the investment if I knew it was a widespread need. :)
Author
Owner

@igalic commented on GitHub (Jul 22, 2017):

the "engine" we use is metalsmith

and now i'm trying to remember where else i've seen this

<!-- gh-comment-id:317166437 --> @igalic commented on GitHub (Jul 22, 2017): the "engine" we use is metalsmith and now i'm trying to remember where else i've seen this
Author
Owner

@DavidAnson commented on GitHub (Oct 26, 2017):

I've done research on two occasions and can't find any documentation/specification that describes the use of front matter in the middle of a file as shown above.

While I could guess at how "middle matter" is expected to behave, it seems like it's rare in the wild AND you have a confirmed workaround in the form of markdownlint-disable. Therefore, I'm closing this issue for now.

If you find a specification and can point to significant use in practice, I'm happy to revisit this.

Thanks!

<!-- gh-comment-id:339554981 --> @DavidAnson commented on GitHub (Oct 26, 2017): I've done research on two occasions and can't find any documentation/specification that describes the use of front matter in the *middle* of a file as shown above. * Metalsmith (the tool you use) says "at the top", http://www.metalsmith.io/ * Middleman (referenced by Metalsmith) also says "top", https://middlemanapp.com/basics/frontmatter/ * jekyll (seemingly the origin of front matter) says "front matter must be the first thing in the file", https://jekyllrb.com/docs/frontmatter/ While I could guess at how "middle matter" is expected to behave, it seems like it's rare in the wild AND you have a confirmed workaround in the form of `markdownlint-disable`. Therefore, I'm closing this issue for now. If you find a specification and can point to significant use in practice, I'm happy to revisit this. Thanks!
Author
Owner

@edobry commented on GitHub (May 4, 2023):

I know this was closed years ago but I have a related usecase, namely ignoring a generated section at the end of the file. My document is a README for a Terraform module, which has some handwritten Markdown, and then a section which gets filled in by a tool called terraform-docs in between these markers:

<!-- BEGIN_TF_DOCS -->
<!-- END_TF_DOCS -->

The generated Markdown is not compliant with my rules and it would be difficult to make it be so, and not really important. Right now i'm able to make this work with the following format:

<!-- markdownlint-disable -->
<!-- BEGIN_TF_DOCS -->
<!-- END_TF_DOCS -->
<!-- markdownlint-restore -->

but it would be quite nice to be able to configure markdownlint to instead match on those existing markers.

<!-- gh-comment-id:1534954691 --> @edobry commented on GitHub (May 4, 2023): I know this was closed years ago but I have a related usecase, namely ignoring a generated section at the end of the file. My document is a README for a Terraform module, which has some handwritten Markdown, and then a section which gets filled in by a tool called [`terraform-docs`](https://terraform-docs.io/) in between these markers: ```markdown <!-- BEGIN_TF_DOCS --> <!-- END_TF_DOCS --> ``` The generated Markdown is not compliant with my rules and it would be difficult to make it be so, and not really important. Right now i'm able to make this work with the following format: ```markdown <!-- markdownlint-disable --> <!-- BEGIN_TF_DOCS --> <!-- END_TF_DOCS --> <!-- markdownlint-restore --> ``` but it would be quite nice to be able to configure markdownlint to instead match on those existing markers.
Author
Owner

@DavidAnson commented on GitHub (May 4, 2023):

See #249

<!-- gh-comment-id:1535205381 --> @DavidAnson commented on GitHub (May 4, 2023): See #249
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/markdownlint#1900
No description provided.