ventojs / vento

🌬 A template engine for Deno & Node
https://vento.js.org/
MIT License
212 stars 12 forks source link

Backticks in content #12

Closed dz4k closed 1 year ago

dz4k commented 1 year ago

Using backticks in the page content causes syntax errors:

missing.css is the CSS library we wished already existed.
Add it to your website: `<link rel="stylesheet" href="https://unpkg.com/missing.css@{{version}}/dist/missing.min.css">`{.lang-html}
SyntaxError: Unexpected token '{'
oscarotero commented 1 year ago

@dz4k Yes, It was fixed in v0.7.2.

The last version of Lume uses v0.7.1 so quick workaround is to configure the import map to replace it with the last version.

dz4k commented 1 year ago

In 0.7.2, there is a slightly different bug where including the string \` causes the same issue.

oscarotero commented 1 year ago

Mmm, I just added this test and it works fine. Can I have an example of content causing the same issue?

dz4k commented 1 year ago
{{ set version = '1.0.13' }}

missing.css is the CSS library we wished already existed.
Add it to your website: \`<link rel="stylesheet" href="https://unpkg.com/missing.css@{{version}}/dist/missing.min.css">\`{.lang-html}

In the test case, the backslash gets eaten by JavaScript and the test is the same as the one above:

"\`" === "`"
true 
oscarotero commented 1 year ago

Okay, I think it's fixed now. Can you check it before releasing a new version?

dz4k commented 1 year ago

Works on my end.

(p.s. I think this can be made simpler using JSON.stringify -- lmk if you want a PR).

oscarotero commented 1 year ago

@dz4k Oh, I had not thought of it. Please, feel free to do a PR.

oscarotero commented 1 year ago

v0.7.3 released. Thanks for your help!

Brixy commented 1 year ago

Before this merge there were some issues with KaTeX and MathJax. Now everything is working. Thanks, guys.