observablehq / framework

A static site generator for data apps, dashboards, reports, and more. Observable Framework combines JavaScript on the front-end for interactive graphics with any language on the back-end for data analysis.
https://observablehq.com/framework/
ISC License
2.41k stars 110 forks source link

ignore inline expressions in HTML rawtext and comment blocks #1440

Closed mbostock closed 3 months ago

mbostock commented 3 months ago

Fixes #375. We were ignoring script elements already, but we need to ignore all rawtext elements and we also need to ignore comments. Technically we might also want to ignore cdata and other weird things, but those are extremely rare so I didn’t bother.

Ref. https://spec.commonmark.org/0.31.2/#html-blocks Ref. https://github.com/observablehq/htl/blob/e3e9777d09f7b5aea3ebc52e73b86a1246dcab7e/src/index.js#L631-L637

mbostock commented 3 months ago

This doesn’t correctly handle this case:

<textarea>${1 + 2}</textarea> ${2}

Maybe we want to bring back the tokenizing parser from #1425, even if we’re only going to parse inline expressions within Markdown tokens.

mbostock commented 3 months ago

Superseded by #1441.