Skip to content
This repository has been archived by the owner on Feb 28, 2022. It is now read-only.

Commit

Permalink
fix(html): ignore HTML tags when generating IDs for headlines
Browse files Browse the repository at this point in the history
  • Loading branch information
trieloff committed Apr 24, 2019
1 parent 84f38a2 commit bdad96c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
7 changes: 6 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
"request-promise-native": "^1.0.5",
"retext": "^6.0.0",
"retext-smartypants": "^3.0.1",
"strip-markdown": "^3.0.3",
"unified": "^7.0.0",
"unist-util-find-all-between": "^1.0.2",
"unist-util-map": "^1.0.4",
Expand Down
3 changes: 2 additions & 1 deletion src/utils/heading-handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
*/
const fallback = require('mdast-util-to-hast/lib/handlers/heading');
const toString = require('mdast-util-to-string');
const strip = require('strip-markdown');
const GithubSlugger = require('github-slugger');

/**
Expand Down Expand Up @@ -39,7 +40,7 @@ class HeadingHandler {
handler() {
return (h, node) => {
// Prepare the heading id
const headingIdentifier = this.slugger.slug(toString(node));
const headingIdentifier = this.slugger.slug(toString(strip()(node)));

// Inject the id after transformation
const n = Object.assign({}, node);
Expand Down

0 comments on commit bdad96c

Please sign in to comment.