Skip to content

Add Markdown support to basic Text widget (Lit).#998

Open
ditman wants to merge 6 commits intogoogle:mainfrom
ditman:lit-09-markdown
Open

Add Markdown support to basic Text widget (Lit).#998
ditman wants to merge 6 commits intogoogle:mainfrom
ditman:lit-09-markdown

Conversation

@ditman
Copy link
Copy Markdown
Collaborator

@ditman ditman commented Mar 26, 2026

Description

Adds Markdown support to the basic Text widget of the v0_9 Lit renderer.

(This is a very similar, but separate, implementation to what exists in v0.8 today. Adds a couple of tests to the directive.)

Also modifies the demo:gallery09 to inject a Markdown renderer for testing.


Pre-launch Checklist

If you need help, consider asking for advice on the discussion board.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the Lit renderer to version 0.8.5, introducing markdown support for the Text widget and a new Context.markdown API for dependency injection. It adds a MarkdownDirective that utilizes unsafeHTML and until for asynchronous rendering, along with corresponding tests and sample updates. Feedback suggests improving the logic for prepending markdown heading symbols to prevent redundant formatting when the input text already contains them.

switch (props.variant) {
case "h1":
return html`<h1>${props.text}</h1>`;
markdownText = `# ${markdownText}`;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this the best we can do here? I figured the <h1> etc approach would be more correct, and handle multi-line strings correctly? I don't feel strongly if this is what we've done previously and it's fine.

I filed #999 to suggest removing the variant in v0.10 :-D

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gemini suggested to try to detect if the agent is already passing markdown and handle that. I really want the bug from actual users to roll in. This is what we're currently doing in v0.8 :)

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

Labels

None yet

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

[Lit] Support Markdown in text Component

3 participants