Skip to content

cannot generate ID for CJK characters in headings #838

Closed

Description

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

Activity

  1. ginuim commented on Jan 3, 2017

    @ginuim

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

  2. Jiang-Xuan commented on Jan 17, 2017

    @Jiang-Xuan
        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.

  3. xzysun commented on Jan 13, 2018

    @xzysun

    #919 (comment) this solution looks fine

  4. added
    L1 - broken
    on Jan 13, 2018
  5. joshbruce commented on Apr 13, 2018

    @joshbruce
    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    L1 - brokencategory: headings

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions