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

cannot generate ID for CJK characters in headings #838

Closed
mantou132 opened this issue Jan 3, 2017 · 4 comments
Closed

cannot generate ID for CJK characters in headings #838

mantou132 opened this issue Jan 3, 2017 · 4 comments
Labels
category: headings L1 - broken Valid usage causes incorrect output OR a crash AND there is no known workaround for the issue

Comments

@mantou132
Copy link

mantou132 commented Jan 3, 2017

code: # 标题一
render result: <h1 id="-">标题一</h1>
@ginuim
Copy link

ginuim commented Jan 3, 2017

I have the same problem,a lot of id="-"

@Jiang-Xuan
Copy link

    Renderer.prototype.heading = function(text, level, raw) {
	  return '<h'
	    + level
	    + ' id="'
	    + this.options.headerPrefix
	    + raw.toLowerCase().replace(/[^\w]+/g, '-')
	    + '">'
	    + text
	    + '</h'
	    + level
	    + '>\n';
	};

raw.toLowerCase().replace(/[^\w]+/g, '-').
this line cause problem.

@xzysun
Copy link

xzysun commented Jan 13, 2018

#919 (comment) this solution looks fine

@joshbruce joshbruce added L1 - broken Valid usage causes incorrect output OR a crash AND there is no known workaround for the issue category: headings labels Jan 13, 2018
@joshbruce
Copy link
Member

Closing as we are starting to really look at removing header ids from marked and improve ways for extenders to do this themselves.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: headings L1 - broken Valid usage causes incorrect output OR a crash AND there is no known workaround for the issue
Projects
None yet
Development

No branches or pull requests

5 participants