I try to use Commonmark.js on a local HTML page. And there is a problem with bare hyperlinks enclosed in angle brackets:<p><pre><code> <div id="input">
**bold** and <em>italic</em>
- <https://example.com>
- <https://example.net>
</div>
<script src="https://unpkg.com/commonmark@0.29.3/dist/commonmark.js"></script>
<script>
window.onload = function() {
var markdown = document.querySelector('#input').innerHTML;
var reader = new commonmark.Parser();
var writer = new commonmark.HtmlRenderer();
var parsed = reader.parse(markdown);
var result = writer.render(parsed);
document.querySelector('body').innerHTML = result;
}
</script>
Why is that? How to prevent bare hyperlinks enclosed in angle brackets to be treated as tags, and at the same time to keep ability to parse HTML (that is `<em>italic</em>` should be rendered as *italic*)?
I tried the Commonmark demo and it doesn’t have this problem.</code></pre>