Skip to content

feat(binding): add ::include component for rendering markdown from a string #449

Description

@miguelrk

Problem

{{ data.content }} interpolates a string as escaped text. It does not call parseMarkdown.

CMS / DB templates often store a markdown string and need it parsed and rendered at render time:

::include{:value="data.content"}
::

Today each host must register its own component. That repeats the same pattern in HTML, Vue, React, Svelte, Angular, ANSI, etc.

Alternatively, we could have a three-bracket syntax: {{{ data.content }}} to render as markdown? That would be more ergonomic.

Proposal

Add an ::include (or ::embed/::render/::content/::md/::markdown/::fragment? But include seems to be more aligned to industry standards) binding component next to If and For:

  • Resolve value from Binding scope (data. / props. / …)
  • Call parseMarkdown on the string (same plugins as the parent parse, or a documented subset)
  • Map the resulting nodes with the current renderer and scope
  • Empty / non-string → render nothing

Same registration model as If / For: opt-in via Binding components, not a new parse-time syntax.

Happy to open a PR once the name and plugin-inheritance rules are agreed.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions