2023-07-18 00:53:23 +08:00
|
|
|
<script>
|
2023-08-04 06:01:18 +08:00
|
|
|
import { Meta, Template, Story } from "@storybook/addon-svelte-csf";
|
|
|
|
import Markdown from "./static";
|
2023-07-18 00:53:23 +08:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<Meta
|
|
|
|
title="Components/Markdown"
|
|
|
|
component={Markdown}
|
|
|
|
argTypes={{
|
|
|
|
rtl: {
|
|
|
|
options: [true, false],
|
|
|
|
description: "Whether to render right-to-left",
|
|
|
|
control: { type: "boolean" },
|
|
|
|
defaultValue: false
|
2023-08-04 06:01:18 +08:00
|
|
|
}
|
2023-07-18 00:53:23 +08:00
|
|
|
}}
|
|
|
|
/>
|
|
|
|
|
|
|
|
<Template let:args>
|
|
|
|
<Markdown
|
2023-08-30 02:20:41 +08:00
|
|
|
value="Here's some **bold** text. And some *italics* and some `code`"
|
|
|
|
latex_delimiters={[]}
|
2023-08-21 21:54:20 +08:00
|
|
|
{...args}
|
2023-07-18 00:53:23 +08:00
|
|
|
/>
|
|
|
|
</Template>
|
|
|
|
|
2023-08-30 02:20:41 +08:00
|
|
|
<Story name="Simple inline Markdown" />
|
2023-08-21 21:54:20 +08:00
|
|
|
|
2023-08-30 02:20:41 +08:00
|
|
|
<Story
|
|
|
|
name="Multiline Markdown"
|
|
|
|
args={{
|
|
|
|
value: `
|
|
|
|
This should
|
|
|
|
all be in one line.
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
This should be
|
|
|
|
|
|
|
|
in two separate lines.`
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
|
2023-09-01 07:39:49 +08:00
|
|
|
<Story
|
|
|
|
name="Markdown with Wide Content (Horizontal Scrolling)"
|
|
|
|
args={{
|
|
|
|
value: `| ids | ids | ids |
|
|
|
|
| ---------------------------------- | ---------------------------------- | ---------------------------------- |
|
|
|
|
| abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz | abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz | abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz |
|
|
|
|
| abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz | abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz | abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz |
|
|
|
|
| abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz | abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz | abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz |
|
|
|
|
`
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
|
2023-08-30 02:20:41 +08:00
|
|
|
<Story name="Right aligned Markdown" args={{ rtl: true }} />
|
2023-08-21 21:54:20 +08:00
|
|
|
|
|
|
|
<Story
|
2023-08-30 02:20:41 +08:00
|
|
|
name="Markdown with LaTeX"
|
2023-08-21 21:54:20 +08:00
|
|
|
args={{
|
|
|
|
value: "What is the solution of $y=x^2$?",
|
|
|
|
latex_delimiters: [{ left: "$", right: "$", display: false }]
|
|
|
|
}}
|
|
|
|
/>
|