gatsby-remark-lang-slug
v0.2.0
Published
Uses speakingurl to add localized anchors to headings
Downloads
2
Maintainers
Readme
gatsby-remark-lang-slug
It's almost the same as gatsby-remark-slug yet it uses speakingurl instead of github-slugger for proper slugs on pages in languages other than English.
Installation
yarn add -D gatsby-remark-lang-slug
# or
npm i -D gatsby-remark-lang-slug
// gatsby-config.js
{
resolve: `gatsby-plugin-mdx`,
options: {
gatsbyRemarkPlugins: [
`gatsby-remark-lang-slug`,
]
}
}
Usage
It expects the language to be set as node field lang
using createNodeField
in onCreateNode
hook.
// gatsby-node.js
exports.onCreateNode = ({ node, actions: { createNodeField } }) => {
createNodeField({
node,
name: `lang`,
value: `de`,
})
}
It'll default to en
(English) if no lang has been set.
Supported languages
Please check out speakingurl's list of supported languages
Ideas
Maybe add support for custom id's like ### My Great Heading {#custom-id}
as remark-heading-id does