Skip to content

Support HTML5 element id - #801

Closed
Dafrok wants to merge 1 commit into
markedjs:masterfrom
Dafrok:master
Closed

Dafrok wants to merge 1 commit into
markedjs:masterfrom
Dafrok:master

Conversation

@Dafrok

@Dafrok Dafrok commented Aug 31, 2016 •

Copy link
Copy Markdown

In HTML5, you can take any unicode and use them as values for id
attributes. It’s important for non-english languages. For example:

# 蛤蛤

will be complied by this lib into:

<h1 id="-">蛤蛤</h1>

however, the majority of us want it to be:

<h1 id="蛤蛤">蛤蛤</h1>

In HTML5, you can take any unicode and use them as values for id
attributes.
@BOT-Man-JL

Copy link
Copy Markdown

I suppose overriding renderer.heading method and using Unicode filter will help (walk around)

raw.toLowerCase().replace(/[^\w\u4E00-\u9FFF]+/g, '-');

Ref: https://en.wikipedia.org/wiki/CJK_Unified_Ideographs

@joshbruce

Copy link
Copy Markdown
Member

Closing due to merge conflicts and not necessarily the focus at this time - flagging with #981 for future reference.

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

Successfully merging this pull request may close these issues.

3 participants