Skip to content

Commit

Permalink
Use nbsp hack to keep former admonition title doc retrocompatible
Browse files Browse the repository at this point in the history
  • Loading branch information
slorber committed Apr 21, 2023
1 parent a983945 commit a8754c5
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 17 deletions.
4 changes: 2 additions & 2 deletions packages/docusaurus-utils/src/markdownUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ export function admonitionTitleToDirectiveLabel(
content: string,
admonitionContainerDirectives: string[],
): string {
// TODO this will also process ":::note Title" inside docs code blocks
// Probably not very important and we should now use directive labels?
// this will also process ":::note Title" inside docs code blocks
// good enough: we fixed older versions docs to not be affected

const directiveNameGroup = `(${admonitionContainerDirectives.join('|')})`;
const regexp = new RegExp(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ Hello world
You may also specify an optional title.

```md
:::note Your Title
:::note Your Title

Some **content** with _Markdown_ `syntax`.

Expand Down Expand Up @@ -138,7 +138,9 @@ import Tabs from '@theme/Tabs';

import TabItem from '@theme/TabItem';

:::tip Use tabs in admonitions
:::tip

Use tabs in admonitions

<Tabs>
<TabItem value="apple" label="Apple">This is an apple 🍎</TabItem>
Expand All @@ -152,7 +154,9 @@ import TabItem from '@theme/TabItem';
```mdx-code-block
<BrowserWindow>
:::tip Use tabs in admonitions
:::tip
Use tabs in admonitions
<Tabs>
<TabItem value="apple" label="Apple">This is an apple 🍎</TabItem>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ Hello world
You may also specify an optional title.

```md
:::note Your Title
:::note Your Title

Some **content** with _Markdown_ `syntax`.

Expand Down Expand Up @@ -138,7 +138,9 @@ import Tabs from '@theme/Tabs';

import TabItem from '@theme/TabItem';

:::tip Use tabs in admonitions
:::tip

Use tabs in admonitions

<Tabs>
<TabItem value="apple" label="Apple">This is an apple 🍎</TabItem>
Expand All @@ -152,7 +154,9 @@ import TabItem from '@theme/TabItem';
```mdx-code-block
<BrowserWindow>
:::tip Use tabs in admonitions
:::tip
Use tabs in admonitions
<Tabs>
<TabItem value="apple" label="Apple">This is an apple 🍎</TabItem>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ Hello world
You may also specify an optional title.

```md
:::note Your Title
:::note Your Title

Some **content** with _Markdown_ `syntax`.

Expand Down Expand Up @@ -138,7 +138,9 @@ import Tabs from '@theme/Tabs';

import TabItem from '@theme/TabItem';

:::tip Use tabs in admonitions
:::tip

Use tabs in admonitions

<Tabs>
<TabItem value="apple" label="Apple">This is an apple 🍎</TabItem>
Expand All @@ -152,7 +154,9 @@ import TabItem from '@theme/TabItem';
```mdx-code-block
<BrowserWindow>
:::tip Use tabs in admonitions
:::tip
Use tabs in admonitions
<Tabs>
<TabItem value="apple" label="Apple">This is an apple 🍎</TabItem>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ Hello world
You may also specify an optional title.

```md
:::note Your Title
:::note Your Title

Some **content** with _Markdown_ `syntax`.

Expand Down Expand Up @@ -138,7 +138,9 @@ import Tabs from '@theme/Tabs';

import TabItem from '@theme/TabItem';

:::tip Use tabs in admonitions
:::tip

Use tabs in admonitions

<Tabs>
<TabItem value="apple" label="Apple">This is an apple 🍎</TabItem>
Expand All @@ -152,7 +154,9 @@ import TabItem from '@theme/TabItem';
```mdx-code-block
<BrowserWindow>
:::tip Use tabs in admonitions
:::tip
Use tabs in admonitions
<Tabs>
<TabItem value="apple" label="Apple">This is an apple 🍎</TabItem>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ Hello world
You may also specify an optional title.

```md
:::note Your Title
:::note Your Title

Some **content** with _Markdown_ `syntax`.

Expand Down Expand Up @@ -138,7 +138,9 @@ import Tabs from '@theme/Tabs';

import TabItem from '@theme/TabItem';

:::tip Use tabs in admonitions
:::tip

Use tabs in admonitions

<Tabs>
<TabItem value="apple" label="Apple">This is an apple 🍎</TabItem>
Expand All @@ -152,7 +154,9 @@ import TabItem from '@theme/TabItem';
```mdx-code-block
<BrowserWindow>
:::tip Use tabs in admonitions
:::tip
Use tabs in admonitions
<Tabs>
<TabItem value="apple" label="Apple">This is an apple 🍎</TabItem>
Expand Down

0 comments on commit a8754c5

Please sign in to comment.