diplodoc-platform / transform

Simple transformer YFM (Yandex Flavored Markdown) to HTML.
MIT License
56 stars 36 forks source link

runtime error when transform yfm-cut with curly brackets in title #375

Open d3m1d0v opened 7 months ago

d3m1d0v commented 7 months ago

Markup:

{% cut "{title}" %}

content

{% endcut %}

transform() crash with error

Uncaught TypeError: Cannot read properties of undefined (reading 'type')
    at exports.getMatchingOpeningToken (utils.js:236:1)
    at Object.transform (patterns.js:328:1)
    at Array.curlyAttrs (index.js:30:1)
    at Core.process (parser_core.js:54:1)
    at MarkdownIt.parseInline (index.js:561:1)
    at Array.plugin (cut.js:32:1)
    at Core.process (parser_core.js:54:1)
    at MarkdownIt.parse (index.js:524:1)
    at md.js:69:1
    at transform (index.js:28:1)

Example in playground