Skip to content

Support inline expressions for attributes (and in other places) #32

Open
@mbostock

Description

@mbostock

Currently inline expression ${…} are only supported for node content. So you can’t do this:

```js
const link = "https://example.com";
```
This is a <a href=${link}>link</a>.

You can workaround it using Hypertext Literal like so:

```js
const link = "https://example.com";
```
This is a ${htl.html`<a href=${link}>link</a>`}.

I’m not immediately sure how we would support this. It might involve writing our own Markdown parser? Or at least pre-processing the content to remove the live code expressions before passing it to markdown-it? Presumably we could repurpose parts of Hypertext Literal to parse the HTML.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestquestionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions