Bug Report
#50 only fixes a corner case of #49 and has a few problems:
- It uses a greedy regex.
- It stops when it finds a digit in a tag (why?).
What is current behaviour
## Bla bla bla <svgaria-label="broken"class="broken"viewPort="0 0 1 1"><circlecx="0.5"cy="0.5"/></svg>## Another <spanstyle="font-size: 1.2em"class="foo bar baz">broken <spanclass="aaa">example</span></span>
…produces the slugs:
bla-bla-bla-svg-aria-labelbroken-classbroken-viewport0-0-1-1circle-cx05-cy05.another-span-stylefont-size-12em-classfoo-bar-bazbroken-example
What is the expected behaviour
The slugs should ignore the html tags, and be:
bla-bla-blaanother-broken-example
Proposed fix
In src/core/render/slugify.js:
let slug = str
.trim()
.replace(/[A-Z]+/g, lower)
- .replace(/<[^>\d]+>/g, '')+ .replace(/<[^>]+?>/g, '')
.replace(re, '')
.replace(/\s/g, '-')
.replace(/-+/g, '-')
.replace(/^(\d)/, '_$1');
Other relevant information
- Your OS: macOS Catalina
- Node.js version: 14
- Browser version: Chrome 83
- Docsify version: master
- Docsify plugins: none
Bug Report
#50 only fixes a corner case of #49 and has a few problems:
What is current behaviour
…produces the slugs:
bla-bla-bla-svg-aria-labelbroken-classbroken-viewport0-0-1-1circle-cx05-cy05.another-span-stylefont-size-12em-classfoo-bar-bazbroken-exampleWhat is the expected behaviour
The slugs should ignore the html tags, and be:
bla-bla-blaanother-broken-exampleProposed fix
In
src/core/render/slugify.js:Other relevant information