Markdown
Markdown is a lightweight markup language for creating formatted text.
Properties | Descriptions | Required | Default |
---|---|---|---|
copyable | MarkdownWhisperCopyMode.Body - Copy the text from the body of the component (including markdown). | | |
body | The content that you want displayed. Supports markdown. | | |
onCopy | Executes the provided function when the Markdown is copied. | | |
tooltip | Text that appears when hovering over the component. | | |
onLinkClick | Whisper event handler that can be used to hook into click events on from links in the markdown component.
Receives the label provided for the link when it is clicked. | |
Markdown is a shorthand way of adding styling to text. Here's a quick breakdown of some of the ways that you can achieve certain effects using it.
- Headings: We only support 3 different headings on Olive Helps
- MarkdownRendered Output
This text is ***really important***.
This text is really important.This text is ___really important___.
This text is really important.This text is __*really important*__.
This text is really important.This text is **_really important_**.
This text is really important.This is really***very***important text.
This is reallyveryimportant text. - BlockQuotes:> Dorothy followed her through many of the beautiful rooms in her castle.The rendered output looks like this:Dorothy followed her through many of the beautiful rooms in her castle.
- To create an unordered list, add dashes (
-
), asterisks (*
), or plus signs (+
) in front of line items. Indent one or more items to create a nested list.MarkdownRendered Output- First item
- Second item
- Third item
- Fourth item
- First item
- Second item
- Third item
- Fourth item
* First item
* Second item
* Third item
* Fourth item
- First item
- Second item
- Third item
- Fourth item
+ First item
+ Second item
+ Third item
+ Fourth item
- First item
- Second item
- Third item
- Fourth item
- First item
- Second item
- Third item
- Indented item
- Indented item
- Fourth item
- First item
- Second item
- Third item
- Indented item
- Indented item
- Fourth item
- Tables:
- A table:| Table Header 1 | Table header 2 || - | - || Row 1 Col 1 | Row 1 Col 2 || Row 2 Col 1 | Row 2 Col 2 |`;
- image


Now let's take a closer look of Markdown component! We use different markdown syntaxes to complete this example.

If you hover your cursor to the first component that contains the penguin, you are able to see a tooltip pop up. And if you click that area, you can copy the first component. This is the copied markdown text:
<h1>Guess which link is the correct link of Olive Helps dev hub.</h1>
<h2>You only have a single chance!</h2>
<p><img src="https://d33wubrfki0l68.cloudfront.net/e7ed9fe4bafe46e275c807d63591f85f9ab246ba/e2d28/assets/images/tux.png" alt="Tux"/></p>
<p><strong>We have a brief description table for you:</strong></p>
<table><thead><tr><th style="text-align:left">People</th><th style="text-align:left">What they say</th></tr></thead><tbody><tr><td style="text-align:left">Josef:</td><td style="text-align:left">Link 3 is the correct one.</td></tr><tr><td style="text-align:left">Michael:</td><td style="text-align:left">Link 1 is not the correct one.</td></tr><tr><td style="text-align:left">Brett:</td><td style="text-align:left">They are all lying.</td></tr></tbody></table>
<p>Knowing that only one person is not lying and we only have 1 link that can direct you to Olive Helps, which one is the correct link?</p>
Type Script Example
React Example
import { whisper } from '@oliveai/ldk';
import { MarkdownWhisperCopyMode, WhisperComponentType } from '@oliveai/ldk/dist/whisper/types';
const markdownSampleText = `
# Guess which link is the correct link of Olive Helps dev hub.
## You only have a single chance!

**We have a brief description table for you:**
| People | What they say |
| :----------| :----------- |
| Josef: | Link 3 is the correct one. |
| Michael:| Link 1 is not the correct one. |
| Brett: | They are all lying. |
Knowing that only one person is not lying and we only have 1 link that can direct you to Olive Helps, which one is the correct link?
`;
const markdown = `
# Links:
[Link 1](# "A Link")
[Link 2](#)
[Link 3](https://www.oliveai.dev/)
`;
export const markdownWhisper = async () => {
await whisper.create({
label: 'Markdown whisper',
onClose: () => {
console.debug('closed');
},
components: [
{
body: markdownSampleText,
type: WhisperComponentType.Markdown,
copyable: MarkdownWhisperCopyMode.Body,
},
{
body: markdown,
type: WhisperComponentType.Markdown,
onLinkClick: (error, linkName) => {
console.info(`Received click on the link: ${JSON.stringify(linkName)}`);
if (linkName === 'Link 1') {
console.log('This is not the correct link.');
} else if (linkName === 'Link 2') {
console.log('This is not the correct link.');
} else if (linkName === 'Link 3') {
console.log(
'Yes! This is the correct link! You are going to Olive Helps Dev Hub... ',
);
} else {
if (error) {
console.log(error.message);
}
}
},
tooltip: 'Link 3 is the right answer!',
},
],
});
}
import { React, ReactWhisper } from '@oliveai/ldk';
import { MarkdownWhisperCopyMode } from '@oliveai/ldk/dist/whisper/types';
const markdownSampleText = `
# Guess which link is the correct link of Olive Helps dev hub.
## You only have a single chance!

**We have a brief description table for you:**
| People | What they say |
| :----------| :----------- |
| Josef: | Link 3 is the correct one. |
| Michael:| Link 1 is not the correct one. |
| Brett: | They are all lying. |
Knowing that only one person is not lying and we only have 1 link that can direct you to Olive Helps, which one is the correct link?
`;
const markdown = `
# Links:
[Link 1](# "A Link")
[Link 2](#)
[Link 3](https://www.oliveai.dev/)
`;
const ReactMarkdownExample: React.FunctionComponent<Object> = () => {
return (
<oh-whisper
label="Markdown whisper"
onClose={() => {
console.debug('closed');
}}
>
<oh-markdown
body={markdownSampleText}
copyable={MarkdownWhisperCopyMode.Body}
/>
<oh-markdown
body={markdown}
tooltip="Link 3 is the right answer!"
onLinkClick={(error, linkName) => {
console.info(`Received click on the link: ${JSON.stringify(linkName)}`);
if (linkName === 'Link 1') {
console.log('This is not the correct link.');
} else if (linkName === 'Link 2') {
console.log('This is not the correct link.');
} else if (linkName === 'Link 3') {
console.log('Yes! This is the correct link! You are going to Olive Helps Dev Hub... ');
} else {
if (error) {
console.log(error.message);
}
}
}}
/>
</oh-whisper>
);
};
ReactWhisper.renderNewWhisper(<ReactMarkdownExample/>);
Last modified 1yr ago