Skip to content

Problems in heading id generation #360

@orelby

Description

@orelby

The custom heading rendering in the renderer adds id attributes to headings. That's what it adds (after it adds the prefix):

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

The problems:

  1. \w matches only ASCII characters in JS. What about other languages?
  2. Not only hyphens might be in headings, but also dashes (en dashes).

My suggestion is to change the first replace from [^\w -] to something like [,;].

Any comments?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions