C
C
CMTV2017-04-09 20:25:54
JavaScript
CMTV, 2017-04-09 20:25:54

Showdown automatically adds links to headers. How?

Hello! I am using the showdown
library to convert markdown to html. I would very much like that when converting headings, a link to their anchor was automatically added to them. To this code:

(new showdown.Converter()).makeHtml(' # Some header ');

Converted to this HTML code:
<h1 id="someheader">Some header <a href="#someheader">link</a></h1>

Or:
<h1 id="someheader"><a href="#someheader">Some header link</a></h1>

How can this be implemented?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nikolay, 2017-04-09
@zzzmaikzzz

vardata = $('h1').html();

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question