Markbind: Unexpected behavior when using variables and icons

Created on 11 Mar 2019  路  3Comments  路  Source: MarkBind/markbind

v1.20.0

These variables don't seem to behave as expected:
in variables.md:

<variable name="year">2019</variable>
<variable name="AY">18/19</variable>
<variable name="cs3281_time">MON 1200 - 1400</variable>
<variable name="icon_dislike">:fas-thumbs-down:</variable>

in another file:

{{ year }}<br>
{{ AY }}<br>
{{ cs3281_time }}<br>
{{ icon_dislike }}<br>

output:
image

a-Syntax c.Bug 馃悰 p.Low

All 3 comments

@jamos-tay can take a look?

Bisected to dc53e764725d5, which introduced the :prefix-name: syntax.

Compatible variables.md for that version:

<span id="year">2019</span>
<span id="AY">18/19</span>
<span id="cs3281_time">MON 1200 - 1400</span>
<span id="icon_dislike">:fas-thumbs-down:</span>

For some reason, the <br>s in the {{ year }}<br>{{ AY }}<br>... is causing some problem. Adding space in front of the variable content also somehow makes the bug disappear:

<variable name="icon_dislike"> :fas-thumbs-down:</variable>

Not extremely familiar with markdown-it extensible plugins, maybe there's a bug in replacing the syntax? @Xenonym any ideas?

Thanks for tracking it down @yamgent! This is a bug in the regex:

https://github.com/MarkBind/markbind/blob/6119a91a9ea472c07e318a8c79ccd1b65884422b/src/lib/markbind/src/lib/markdown-it/markdown-it-icons.js#L2

Removing the m flag (making it /:(fa[brs]|glyphicon)-([a-z-]+):/ seems to fix it.

Was this page helpful?
0 / 5 - 0 ratings