Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
@elderjs/plugin-markdown
Advanced tools
Easily create routes from your markdown files on your Elder.js site using the remark ecosystem.
An extensible markdown parser for Elder.js powered by remark.
Use it to create a blog, or site, just configure and it'll parse your markdown and make it available in your Svelte templates.
npm install --save @elderjs/plugin-markdown
Once installed, open your elder.config.js
and configure the plugin by adding @elderjs/plugin-markdown
to your plugin object.
plugins: {
'@elderjs/plugin-markdown': {
routes: [], // if all of your markdown lives in ./src/routes/blog/, you'd add 'blog' to this array.
}
}
Below are the default settings of the plugin. You can adjust them to your needs.
plugins: {
'@elderjs/plugin-markdown': {
routes: [], // a list of routes, the plugin should look for markdown in.
remarkPlugins: [
frontmatter, // 'remark-frontmatter' package
[extractFrontmatter, { name: 'frontmatter', yaml: yaml }], // 'remark-extract-frontmatter' and 'yaml' packages.
remarkHtml, // 'remark-html' package
],
useElderJsPluginImages: true, // if you are using the @elderjs/plugin-images the plugin replace all markdown images with the {{picture src="" alt="" /}} shortcode.
},
}
An object representing all of the markdown the plugin parsed from the defined routes
is available at data.markdown
.
If you are looking to get an array of the markdown for a specific route such as blog
you can access it data.markdown.blog
.
helpers.markdownParser
:In addition to parsing the markdown in the given routes, this plugin makes available the configured remark parser at helpers.markdownParser
during the bootstrap
hook.
This means you can use the same markdown parser to parse markdown from other sources if needed.
For full documentation please review remark's docs. That said, the default plugin config can be used to parse markdown like so: helpers.markdownParser.processSync(mdText)
If you need to customize the remark plugins that are used here are some notes:
remarkPlugins
array are added to remark
in the order they are given.elder.config.js
, you must specify a full remark
pipeline.remark-extract-frontmatter
needs an array of options, you can pass in an array like so: remarkPlugins: [[extractFrontmatter, { name: 'frontmatter', yaml: yaml }]]
date
field in your frontmatter it will sort all of the markdown for that route by it.slug
field in your frontmatter it will use that for the slug, if not it falls back to the filename.FAQs
Easily create routes from your markdown files on your Elder.js site using the remark ecosystem.
The npm package @elderjs/plugin-markdown receives a total of 45 weekly downloads. As such, @elderjs/plugin-markdown popularity was classified as not popular.
We found that @elderjs/plugin-markdown demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.