Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request: Do some sanitization before slug generation #230

Open
dgreensp opened this issue Jun 16, 2021 · 0 comments
Open

Request: Do some sanitization before slug generation #230

dgreensp opened this issue Jun 16, 2021 · 0 comments

Comments

@dgreensp
Copy link

dgreensp commented Jun 16, 2021

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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant