-
Notifications
You must be signed in to change notification settings - Fork 210
docs: add markdown documentation #4314
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
Open
tomivirkki
wants to merge
1
commit into
latest
Choose a base branch
from
docs/markdown
base: latest
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
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
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,47 @@ | ||
--- | ||
title: Markdown | ||
page-title: Markdown component | Vaadin components | ||
description: Markdown allows you to render Markdown content in your application with support for basic formatting, lists, links, and more. | ||
meta-description: Use the Vaadin Markdown component to display Markdown formatted content in Vaadin applications. | ||
page-links: | ||
- 'API: https://cdn.vaadin.com/vaadin-web-components/{moduleNpmVersion:@vaadin/markdown}/#/elements/vaadin-markdown[TypeScript] / https://vaadin.com/api/platform/{moduleMavenVersion:com.vaadin:vaadin}/com/vaadin/flow/component/markdown/Markdown.html[Java]' | ||
- 'Source: https://github.com/vaadin/web-components/tree/v{moduleNpmVersion:@vaadin/markdown}/packages/markdown[TypeScript] / https://github.com/vaadin/flow-components/tree/{moduleMavenVersion:com.vaadin:vaadin}/vaadin-markdown-flow-parent[Java]' | ||
version: since:com.vaadin:[email protected] | ||
Check failure on line 9 in articles/components/markdown/index.adoc
|
||
--- | ||
= [since:com.vaadin:[email protected]]#Markdown# | ||
|
||
// tag::description[] | ||
Markdown component allows the user to display formatted text content using the Markdown syntax. | ||
// end::description[] | ||
It supports basic text formatting, lists, links, and more. All content provided to the component is internally sanitized to prevent potentially dangerous HTML from being rendered. | ||
|
||
For more information about common Markdown syntax features, see the https://www.markdownguide.org/basic-syntax/[Markdown Guide]. | ||
|
||
|
||
[.example] | ||
-- | ||
|
||
ifdef::lit[] | ||
[source,html] | ||
---- | ||
include::{root}/frontend/demo/component/markdown/markdown-basic.ts[render,tags=snippet,indent=0,group=Lit] | ||
---- | ||
endif::[] | ||
|
||
ifdef::flow[] | ||
[source,java] | ||
---- | ||
include::{root}/src/main/java/com/vaadin/demo/component/markdown/MarkdownBasic.java[render,tags=snippet,indent=0,group=Flow] | ||
---- | ||
endif::[] | ||
|
||
ifdef::react[] | ||
[source,tsx] | ||
---- | ||
include::{root}/frontend/demo/component/markdown/react/markdown-basic.tsx[render,tags=snippet,indent=0,group=React] | ||
---- | ||
endif::[] | ||
|
||
-- | ||
|
||
[discussion-id]`77B51D28-FE42-4829-A315-D0F3C8A55BED` |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The gray background in the thumbnail could be changed to the bg color used in other thumbnails: #F0F5F7. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,49 @@ | ||
import '@vaadin/markdown'; | ||
import { html, LitElement } from 'lit'; | ||
import { customElement } from 'lit/decorators.js'; | ||
import { applyTheme } from 'Frontend/generated/theme'; | ||
|
||
@customElement('markdown-basic') | ||
export class MarkdownBasic extends LitElement { | ||
protected override createRenderRoot() { | ||
const root = super.createRenderRoot(); | ||
// Apply custom theme (only supported if your app uses one) | ||
applyTheme(root); | ||
return root; | ||
} | ||
|
||
protected override render() { | ||
// tag::snippet[] | ||
const markdownText = ` | ||
## Rich Text Formatting | ||
|
||
You can create **bold text**, *italicized text*, and \`inline code\` with simple Markdown syntax. | ||
You can also ~~strike through~~ text when needed. | ||
|
||
## Lists | ||
|
||
### Ordered List: | ||
1. First item | ||
2. Second item | ||
3. Third item with **bold text** | ||
|
||
### Unordered List: | ||
- Fruits | ||
- Apples 🍎 | ||
- Bananas 🍌 | ||
- Oranges 🍊 | ||
- Vegetables | ||
- Carrots | ||
- Broccoli | ||
|
||
## Links & Quotes | ||
|
||
> Markdown is a lightweight markup language that you can use to add formatting elements to plaintext text documents. | ||
|
||
[Visit Vaadin website](https://vaadin.com) | [Learn more about Markdown](https://www.markdownguide.org/) | ||
`; | ||
|
||
return html`<vaadin-markdown .content=${markdownText}></vaadin-markdown>`; | ||
// end::snippet[] | ||
} | ||
} |
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,40 @@ | ||
import { reactExample } from 'Frontend/demo/react-example'; // hidden-source-line | ||
import React from 'react'; | ||
import { Markdown } from '@vaadin/react-components/Markdown.js'; | ||
|
||
function Example() { | ||
// tag::snippet[] | ||
const markdownText = ` | ||
## Rich Text Formatting | ||
|
||
You can create **bold text**, *italicized text*, and \`inline code\` with simple Markdown syntax. | ||
You can also ~~strike through~~ text when needed. | ||
|
||
## Lists | ||
|
||
### Ordered List: | ||
1. First item | ||
2. Second item | ||
3. Third item with **bold text** | ||
|
||
### Unordered List: | ||
- Fruits | ||
- Apples 🍎 | ||
- Bananas 🍌 | ||
- Oranges 🍊 | ||
- Vegetables | ||
- Carrots | ||
- Broccoli | ||
|
||
## Links & Quotes | ||
|
||
> Markdown is a lightweight markup language that you can use to add formatting elements to plaintext text documents. | ||
|
||
[Visit Vaadin website](https://vaadin.com) | [Learn more about Markdown](https://www.markdownguide.org/) | ||
`; | ||
|
||
return <Markdown>{markdownText}</Markdown>; | ||
// end::snippet[] | ||
} | ||
|
||
export default reactExample(Example); // hidden-source-line |
49 changes: 49 additions & 0 deletions
49
src/main/java/com/vaadin/demo/component/markdown/MarkdownBasic.java
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,49 @@ | ||
package com.vaadin.demo.component.markdown; | ||
|
||
import com.vaadin.demo.DemoExporter; | ||
import com.vaadin.flow.component.html.Div; | ||
import com.vaadin.flow.component.markdown.Markdown; | ||
import com.vaadin.flow.router.Route; | ||
|
||
@Route("markdown-basic") | ||
public class MarkdownBasic extends Div { | ||
|
||
public MarkdownBasic() { | ||
// tag::snippet[] | ||
String markdownText = """ | ||
## Rich Text Formatting | ||
|
||
You can create **bold text**, *italicized text*, and `inline code` with simple Markdown syntax. | ||
You can also ~~strike through~~ text when needed. | ||
|
||
## Lists | ||
|
||
### Ordered List: | ||
1. First item | ||
2. Second item | ||
3. Third item with **bold text** | ||
|
||
### Unordered List: | ||
- Fruits | ||
- Apples 🍎 | ||
- Bananas 🍌 | ||
- Oranges 🍊 | ||
- Vegetables | ||
- Carrots | ||
- Broccoli | ||
|
||
## Links & Quotes | ||
|
||
> Markdown is a lightweight markup language that you can use to add formatting elements to plaintext text documents. | ||
|
||
[Visit Vaadin website](https://vaadin.com) | [Learn more about Markdown](https://www.markdownguide.org/) | ||
"""; | ||
|
||
Markdown markdown = new Markdown(markdownText); | ||
add(markdown); | ||
// end::snippet[] | ||
} | ||
|
||
public static class Exporter extends DemoExporter<MarkdownBasic> { // hidden-source-line | ||
} // hidden-source-line | ||
} |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.