Skip to content

Commit 4c2450c

Browse files
Add node content to sidebar with alt syntax (#46)
* Add node content to sidebar with alt syntax * Add similar missing `node.content` * Bump commit
1 parent 382bba4 commit 4c2450c

File tree

4 files changed

+12
-0
lines changed

4 files changed

+12
-0
lines changed

src/asciidoc/templates/Example.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ const Example = ({ node }: { node: Block }) => {
2020
>
2121
<summary className="title">{parse(title)}</summary>
2222
<div className="content">
23+
{node.content && parse(node.content)}
2324
<Content blocks={node.blocks} />
2425
</div>
2526
</details>
@@ -34,6 +35,7 @@ const Example = ({ node }: { node: Block }) => {
3435
>
3536
<Title text={node.title} />
3637
<div className="content">
38+
{node.content && parse(node.content)}
3739
<Content blocks={node.blocks} />
3840
</div>
3941
</div>

src/asciidoc/templates/Open.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import cn from 'classnames'
2+
import parse from 'html-react-parser'
23

34
import { Content } from '../'
45
import { type BaseBlock } from '../utils/prepareDocument'
@@ -15,6 +16,7 @@ const Open = ({ node }: { node: BaseBlock }) => {
1516
>
1617
<Title text={node.title} />
1718
<blockquote className="content">
19+
{node.content && parse(node.content)}
1820
<Content blocks={node.blocks} />
1921
</blockquote>
2022
</div>
@@ -28,6 +30,7 @@ const Open = ({ node }: { node: BaseBlock }) => {
2830
>
2931
<Title text={node.title} />
3032
<div className="content">
33+
{node.content && parse(node.content)}
3134
<Content blocks={node.blocks} />
3235
</div>
3336
</div>

src/asciidoc/templates/Sidebar.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import cn from 'classnames'
2+
import parse from 'html-react-parser'
23

34
import { Content } from '../'
45
import { type Block } from '../utils/prepareDocument'
@@ -11,6 +12,7 @@ const Sidebar = ({ node }: { node: Block }) => (
1112
>
1213
<div className="content">
1314
<Title text={node.title} />
15+
{node.content && parse(node.content)}
1416
<Content blocks={node.blocks} />
1517
</div>
1618
</div>

src/examples/sidebar.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ AsciiDoc was first released in Nov 2002 by Stuart Rackham.
2121
It was designed from the start to be a shorthand syntax
2222
for producing professional documents like DocBook and LaTeX.
2323
****
24+
25+
[sidebar]
26+
AsciiDoc was first released in Nov 2002 by Stuart Rackham.
27+
It was designed from the start to be a shorthand syntax
28+
for producing professional documents like DocBook and LaTeX.
2429
`
2530

2631
export default sidebar

0 commit comments

Comments
 (0)