Reputation: 2851
Showdown is markdown to HTML converter written in Javascript.
The problem is that all my headers are written in Russian language and Showdown do not add id
attribue because it can work with Latin symbols only.
For example:
(new showdown.Converter()).makeHtml(' # Some header ')
<h1 id="someheader">Some header</h1>
Example with Russian symbols:
(new showdown.Converter()).makeHtml(' # Заголовок ')
<h1 id="">Заголовок</h1>
Is there a way to customize showdown output so I can cast handle Russian symbols in markdown headers?
Upvotes: 1
Views: 634
Reputation: 42109
You can try using the GitHub compatible IDs:
var converter = new showdown.Converter();
converter.setOption('ghCompatibleHeaderId', true);
console.log( converter.makeHtml('# Заголовок ') );
<script src="https://cdnjs.cloudflare.com/ajax/libs/showdown/1.6.4/showdown.min.js"></script>
Upvotes: 3