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

feat(#177): enable understanding of front matter #190

Merged
merged 2 commits into from
Nov 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"markdown-it-deflist": "^3.0.0",
"markdown-it-emoji": "^3.0.0",
"markdown-it-footnote": "^4.0.0",
"markdown-it-front-matter": "^0.2.4",
"markdown-it-github-alerts": "^0.3.0",
"markdown-it-inject-linenumbers": "^0.3.0",
"markdown-it-mark": "^4.0.0",
Expand Down
4 changes: 4 additions & 0 deletions src/parser/markdown.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import MarkdownIt from 'markdown-it';
import anchor from 'markdown-it-anchor';
import frontMatter from 'markdown-it-front-matter';
import highlight from './highlight.js';
import graphviz from './dot.js';
import mermaid from './mermaid.js';
Expand Down Expand Up @@ -59,6 +60,9 @@ mdit.use(toc, config.tocOptions);

// MARK: untyped plugins done

// markdown-it-front-matter requires a callback function but we aren’t doing
// anything with it, so we just pass in a noop.
mdit.use(frontMatter, () => {});
// anchor has to be added after attribute plugin for ids to work
mdit.use(anchor, {
permalink: anchor.permalink.ariaHidden({
Expand Down
4 changes: 4 additions & 0 deletions tests/rendering/markdown-additional.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
---
front-matter: This should not be shown in the renderer
---

# Additional Markdown test file

Test various other Markdown syntax here, starting with the table of contents
Expand Down
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2190,6 +2190,11 @@ markdown-it-footnote@^4.0.0:
resolved "https://registry.yarnpkg.com/markdown-it-footnote/-/markdown-it-footnote-4.0.0.tgz#02ede0cb68a42d7e7774c3abdc72d77aaa24c531"
integrity sha512-WYJ7urf+khJYl3DqofQpYfEYkZKbmXmwxQV8c8mO/hGIhgZ1wOe7R4HLFNwqx7TjILbnC98fuyeSsin19JdFcQ==

markdown-it-front-matter@^0.2.4:
version "0.2.4"
resolved "https://registry.yarnpkg.com/markdown-it-front-matter/-/markdown-it-front-matter-0.2.4.tgz#cf29bc8222149b53575699357b1ece697bf39507"
integrity sha512-25GUs0yjS2hLl8zAemVndeEzThB1p42yxuDEKbd4JlL3jiz+jsm6e56Ya8B0VREOkNxLYB4TTwaoPJ3ElMmW+w==

markdown-it-github-alerts@^0.3.0:
version "0.3.0"
resolved "https://registry.yarnpkg.com/markdown-it-github-alerts/-/markdown-it-github-alerts-0.3.0.tgz#acab7db57f4e204c8d1c987403c367738d7026b0"
Expand Down