crossnote icon indicating copy to clipboard operation
crossnote copied to clipboard

Request: Do some sanitization before slug generation

Open dgreensp opened this issue 3 years ago • 0 comments

I am authoring some Markdown that will be read via GitHub. MPE's TOC generation is super useful, but it doesn't strip out images... or seemingly anything, when it comes to the slug. I wouldn't want the same sanitization on the slug as MPE applies to the text displayed in the TOC (which, for example, preserves images). I would want something closer to what GitHub does; not necessarily identical behavior, but if the behavior is close enough, I can use MUME-generated TOCs for GitHub READMEs and the like.

For example, this heading:

# `class Foo` <img src="http://example.com/badge.svg">

...has the slug class-foo- on GitHub.

It's even possible to get rid of the trailing hyphen (so that if I decided to remove the badge in the future, the id would stay the same). This heading:

# `class Foo`&nbsp;<img src="http://example.com/badge.svg">

...has the GitHub slug class-foo, which is even better!

Meanwhile, MPE generates the slug class-foonbspimg-srchttpexamplecombadgesvg. I would love for it to be class-foo instead.

Alternatively (or additionally), if this turned into class-foo I'd be happy:

# `class Foo`&nbsp;![](http://example.com/badge.svg)

dgreensp avatar Jun 16 '21 16:06 dgreensp