Skip to content

Commit

Permalink
docs: update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Mister-Hope committed Apr 17, 2024
1 parent b23d02a commit 177a14e
Show file tree
Hide file tree
Showing 35 changed files with 121 additions and 486 deletions.
4 changes: 2 additions & 2 deletions docs/src/.vuepress/config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { alert } from "@mdit/plugin-alert";
import { container } from "@mdit/plugin-container";
import { demo } from "@mdit/plugin-demo";
// import { demo } from "@mdit/plugin-demo";
import { snippet } from "@mdit/plugin-snippet";
import { cut } from "nodejs-jieba";
import { type UserConfig, defineUserConfig } from "vuepress";
Expand Down Expand Up @@ -38,7 +38,7 @@ export default <UserConfig>defineUserConfig({

extendsMarkdown: (md) => {
md.use(alert, { deep: true });
md.use(demo);
// md.use(demo);

md.use(container, {
name: "hint",
Expand Down
1 change: 1 addition & 0 deletions docs/src/.vuepress/theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export default hopeTheme(
align: true,
attrs: true,
codetabs: true,
demo: true,
figure: true,
footnote: true,
imgLazyload: true,
Expand Down
4 changes: 4 additions & 0 deletions docs/src/alert.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,8 @@ interface MarkdownItAlertOptions {

## Demo

::: md-demo Demo

> [!note]
> This is note text
Expand All @@ -166,6 +168,8 @@ interface MarkdownItAlertOptions {
> [!caution]
> This is caution text
:::

<!-- markdownlint-enable MD028 -->

::: details Styles
Expand Down
56 changes: 1 addition & 55 deletions docs/src/align.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,61 +111,8 @@ Contents to align justify

## Demo

:::: center

### Twinkle, Twinkle, Little Star

::: right

——Jane Taylor

:::

Twinkle, twinkle, little star,

How I wonder what you are!

Up above the world so high,

Like a diamond in the sky.

When the blazing sun is gone,

When he nothing shines upon,

Then you show your little light,

Twinkle, twinkle, all the night.

Then the traveller in the dark,
::::: md-demo Demo

Thanks you for your tiny spark,

He could not see which way to go,

If you did not twinkle so.

In the dark blue sky you keep,

And often thro' my curtains peep,

For you never shut your eye,

Till the sun is in the sky.

'Tis your bright and tiny spark,

Lights the trav’ller in the dark,

Tho' I know not what you are,

Twinkle, twinkle, little star.

::::

::::: details Code

```md
:::: center

### Twinkle, Twinkle, Little Star
Expand Down Expand Up @@ -217,6 +164,5 @@ Tho' I know not what you are,
Twinkle, twinkle, little star.

::::
```

:::::
54 changes: 14 additions & 40 deletions docs/src/attrs.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,51 +134,37 @@ interface MarkdownItAttrsOptions {

> ALl class are styled with `margin: 4px;padding: 4px;border: 1px solid red;` to show the effect.
### Inline (inline)
::: md-demo Inline

Text with `inline code`{.inline-code} and ![favicon](/favicon.ico){.image}, also supporting _emphasis_{.inline-emphasis} and **bold**{.inline-bold}.

```md
Text with `inline code`{.inline-code} and ![favicon](/favicon.ico){.image}, also supporting _emphasis_{.inline-emphasis} and **bold**{.inline-bold}.
```
:::

### Block (block)
::: md-demo Block

block content {.block}

```md
block content {.block}
```
:::

### Fence (fence)
::: md-demo Fence

```js {.fence}
const a = 1;
```

````md
```js {.fence}
const a = 1;
```
````
:::

### Table (table)
::: md-demo Table

| Table |
| ------- |
| content |

{.table}

```md
| Table |
| ------- |
| content |

{.table}
```
:::

### List (list)
::: md-demo List

- list item{.list-item}

Expand All @@ -187,32 +173,20 @@ const a = 1;

{.list-wrapper}

```md
- list item{.list-item}

- nested list item
{.nested}

{.list-wrapper}
```
:::

### Horizontal (hr)
::: md-demo Horizontal Rule

--- {.horizontal}

```md
--- {.horizontal}
```
:::

### Softbreak (softbreak)
::: md-demo Softbreak

A line with break
{.break}

```md
A line with break
{.break}
```
:::

<style scope>
.block,
Expand Down
21 changes: 3 additions & 18 deletions docs/src/container.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ interface MarkdownItContainerOptions {

### Hint container

With some styles and:
With the following code and some styles:

```js
md.use(container, {
Expand All @@ -169,9 +169,8 @@ md.use(container, {
});
```

You can write a hint like this:
:::: md-demo You can write a hint like this:

```md
::: hint Here is a Hint
:::

Expand All @@ -185,19 +184,5 @@ Here is a **hint** for you!
- Hint 2

:::
```

::: hint Here is a hint

:::

::: hint

Here is a **hint** for you!

- Hint 1
- Hint 1.1
- Hint 1.2
- Hint 2

:::
::::
4 changes: 2 additions & 2 deletions docs/src/demo.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ interface MarkdownItDemoOptions {

## Demo

::: demo
::: md-demo

## Heading 1

Expand All @@ -107,7 +107,7 @@ Text
:::

```md
::: demo
::: md-demo

## Heading 1

Expand Down
12 changes: 3 additions & 9 deletions docs/src/figure.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,20 +60,14 @@ interface MarkdownItFigureOptions {

## Demo

![Logo](/favicon.ico)

[![Logo](/favicon.ico)](https://commonmark.org/)

![Logo](/favicon.ico "Markdown")
::: md-demo Demo

[![Logo](/favicon.ico "Markdown")](https://commonmark.org/)

```md
![Logo](/favicon.ico)

[![Logo](/favicon.ico)](https://commonmark.org/)

![Logo](/favicon.ico "Markdown")

[![Logo](/favicon.ico "Markdown")](https://commonmark.org/)
```

:::
18 changes: 3 additions & 15 deletions docs/src/footnote.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ mdIt.render("Inline footnote^[Text of inline footnote] definition.");

## Demo

::: md-demo Demo

Footnote 1 link[^first].

Footnote 2 link[^second].
Expand All @@ -82,18 +84,4 @@ Duplicated footnote reference.

[^second]: Footnote text.

```md
Footnote 1 link[^first].

Footnote 2 link[^second].

Inline footnote^[Text of inline footnote] definition.

Duplicated footnote reference[^second].

[^first]: Footnote **can have markup**

and multiple paragraphs.

[^second]: Footnote text.
```
:::
12 changes: 4 additions & 8 deletions docs/src/img-mark.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,21 +105,17 @@ interface MarkdownItImgMarkOptions {

## Demo

::: md-demo Demo

![GitHub Light](/github-light.png#gh-dark-mode-only)
![GitHub Dark](/github-dark.png#gh-light-mode-only)

![GitHub Light](/github-light.png#dark)
![GitHub Dark](/github-dark.png#light)

<AppearanceSwitch /> (Try to toggle theme mode)

```md
![GitHub Light](/github-light.png#gh-dark-mode-only)
![GitHub Dark](/github-dark.png#gh-light-mode-only)
:::

![GitHub Light](/github-light.png#dark)
![GitHub Dark](/github-dark.png#light)
```
<AppearanceSwitch /> (Try to toggle theme mode)

<script setup lang="ts">
import AppearanceSwitch from "@theme-hope/modules/outlook/components/AppearanceSwitch"
Expand Down
8 changes: 3 additions & 5 deletions docs/src/img-size.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,10 @@ will be parsed as:

## Demo

![Logo](/logo.svg "Markdown" =200x200)
![Logo](/logo.svg "Markdown" =150x)
![Logo](/logo.svg "Markdown" =x100)
::: md-demo Demo

```md
![Logo](/logo.svg "Markdown" =200x200)
![Logo](/logo.svg "Markdown" =150x)
![Logo](/logo.svg "Markdown" =x100)
```

:::
11 changes: 2 additions & 9 deletions docs/src/katex.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,23 +67,16 @@ You should import `katex/dist/katex.min.css` from `katex` package or CDN yoursel

## Demo

Euler’s identity $e^{i\pi}+1=0$ is a beautiful formula in $\mathbb{R}^2$.
::: md-demo

```md
Euler’s identity $e^{i\pi}+1=0$ is a beautiful formula in $\mathbb{R}^2$.
```

$$
\frac {\partial^r} {\partial \omega^r} \left(\frac {y^{\omega}} {\omega}\right)
= \left(\frac {y^{\omega}} {\omega}\right) \left\{(\log y)^r + \sum_{i=1}^r \frac {(-1)^ Ir \cdots (r-i+1) (\log y)^{ri}} {\omega^i} \right\}
$$

```md
$$
\frac {\partial^r} {\partial \omega^r} \left(\frac {y^{\omega}} {\omega}\right)
= \left(\frac {y^{\omega}} {\omega}\right) \left\{(\log y)^r + \sum_{i=1}^r \frac {(-1)^ Ir \cdots (r-i+1) (\log y)^{ri}} {\omega^i} \right\}
$$
```
:::

## Options

Expand Down

0 comments on commit 177a14e

Please sign in to comment.