✨ NEW: Support configurable front matter markers - #155
Open
Gonghan-Princess wants to merge 1 commit into
Open
Gonghan-Princess wants to merge 1 commit into
Gonghan-Princess wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Front matter delimiters are currently fixed to
---, preventing applications from using+++for TOML-style metadata or;;;for JSON-style metadata. Add a keyword-onlymarkeroption tofront_matter_plugin, configured separately for each MarkdownIt parser.For example,
MarkdownIt().use(front_matter_plugin, marker="+")extracts content between+++fences. The plugin continues to return raw metadata text; it does not decode TOML or JSON or add dependencies. The default-marker and existing YAML fixtures retain their behavior. Custom markers use the existing minimum-three and matching-closing-length rules; YAML's...terminator is recognized only with the default marker.Reject empty, multi-character, whitespace, and NUL markers when configuring the plugin. Update the API documentation with an example and add an Unreleased changelog entry.
Fixes #134.
Validation on Windows / Python 3.12.10:
tox -e py312: 535 passed (24 added cases).tox -e mypy,tox -e pre-commit, andtox -e docs-update: passed, including strict Sphinx-nW --keep-going.AI assistance: OpenAI Codex prepared the implementation, tests, documentation, and PR text. A separate Codex agent reviewed the patch; its NUL-marker finding was addressed and tested. No human review is claimed.