-
Notifications
You must be signed in to change notification settings - Fork 122
feat(x-markdown): add markdown rendering support and tests #2412
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Sherry-hue
merged 1 commit into
lynx-family:main
from
Sherry-hue:p/hw/support-x-markdown
Apr 20, 2026
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| --- | ||
| "@lynx-js/web-elements": patch | ||
| "@lynx-js/web-core": patch | ||
| --- | ||
|
|
||
| feat: add x-markdown support | ||
|
|
||
| Add opt-in support for the `x-markdown` element on Lynx Web, including | ||
| Markdown rendering together with its related styling, interaction, animation, | ||
| truncation, range rendering, and effect capabilities exposed through the | ||
| component API. | ||
|
|
||
| Update the `web-core`, `web-core-wasm`, and `web-mainthread-apis` runtime | ||
| paths to use the shared property-or-attribute setter from `web-constants`, so | ||
| custom elements such as `x-markdown` can receive structured property values | ||
| correctly instead of being forced through string-only attribute updates. | ||
|
|
||
| ```javascript | ||
| import '@lynx-js/web-elements/XMarkdown'; | ||
| ``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
packages/web-platform/web-core/ts/client/mainthread/utils/setElementPropertyOrAttribute.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| // Copyright 2023 The Lynx Authors. All rights reserved. | ||
| // Licensed under the Apache License Version 2.0 that can be found in the | ||
| // LICENSE file in the root directory of this source tree. | ||
|
|
||
| export const setElementPropertyOrAttribute = ( | ||
| element: Element, | ||
| key: string, | ||
| value: unknown, | ||
| ) => { | ||
| if (value == null) { | ||
| element.removeAttribute(key); | ||
| return; | ||
| } | ||
|
|
||
| if ( | ||
| key in element | ||
| && typeof value !== 'string' | ||
| && typeof value !== 'number' | ||
| && typeof value !== 'boolean' | ||
| ) { | ||
| (element as unknown as Record<string, unknown>)[key] = value; | ||
| } else { | ||
| element.setAttribute(key, String(value)); | ||
| } | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.