-
Notifications
You must be signed in to change notification settings - Fork 224
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
Use getHeadingList
from marked-gfm-heading-id
plugin
#3793
Conversation
✅ You can preview this change here:
To edit notification comments on pull requests, go to your Netlify site configuration. |
b08c46a
to
8ee1d04
Compare
8ee1d04
to
6d155d2
Compare
983f3f1
to
d480314
Compare
getHeadingList
from marked-gfm-heading-id
plugin
d480314
to
9e93556
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cheers for picking this one up. The new plugin looks neat. 🙌🏻
Given it does a little more than simple markdown rendering now and is responsible for extracting headings info as well, I'd be keen to keep the tests we had for extract-page-headings
to validate that it does that part of the work correctly.
The tests of the metalsmith-lunr-index
will validate some of that, but having specific examples for each feature of the heading extraction (aliases, excluding from navigation, excluding from search) will make it easier to understand what exactly the heading extraction is about.
Would you mind adding them back (that'll probably require the plugin file to move in a folder in a similar way that the previous plugin was set up), please?
lib/render-markdown.js
Outdated
* Renders markdown and extracts headings from markdown | ||
* and assigns to 'headings' variable of each file. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cheers for adding a little description to the JSDoc on top of the title 😊
b2c454a
to
b34ccbd
Compare
Makes sense. Was able to just add them all back with minimal changes :) |
b34ccbd
to
13cacdf
Compare
The `getHeadingList` function was introduced in a recent update to the `marked-gfm-heading-id` marked plugin. This commit removes `extractPageHeadings` and adds a new Metalsmith markdown plugin which adds headings to the `files` as the markdown is processed.
13cacdf
to
68926d7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense. Was able to just add them all back with minimal changes :)
🌟 Ace, hoped that we could reuse most of what was there. Thanks for updating.
What
Delete
extractHeadingPageHeadings()
. Write new Metalsmith plugin that adds headings to eachfile
object after each markdown file has been processed.Addresses issue #3171.
Why
Remove extra implementation to make use of already implemented feature of
marked-gfm-heading-id
. This method of implementation means we don't have parse the markdown multiple times and removes a loop of all the processed files.