GitbookIO / kramed

A markdown (kramdown compatible) parser and compiler. Built for speed. (Fork of marked)
MIT License
223 stars 47 forks source link

Add option to disable generating ids #20

Open fchasen opened 9 years ago

fchasen commented 9 years ago

Added an autoIds option in Renderer. Defaults to true.

Setting it to false in the Renderer or kramed.defaults will disable creating ids.

kramed.setOptions({
    autoIds: false,
    renderer: false // must be recreated by Parser to get options
});

Also adjusts the regex to require a space between content and the id declaration per http://kramdown.gettalong.org/syntax.html#specifying-a-header-id

That space will be removed in the output: # Header {#myid} -> <h1 id="myid">Header</h1>

Includes a few changes to pass renderer options to Parser and merge them in Renderer.