https://github.com/kaushalmodi/ox-hugo/issues/119 Also: - Remove leading/trailing whitespace from Special Block contentmaster
parent
82386c3610
commit
6bf16103f1
7 changed files with 180 additions and 14 deletions
@ -0,0 +1,54 @@ |
||||
+++ |
||||
title = "Paired shortcodes using special blocks" |
||||
tags = ["shortcode", "paired", "special-block"] |
||||
draft = false |
||||
+++ |
||||
|
||||
Test case for feature requested in `ox-hugo` Issue #[119](https://github.com/kaushalmodi/ox-hugo/issues/119). |
||||
|
||||
|
||||
## Paired markdown shortcode {#paired-markdown-shortcode} |
||||
|
||||
{{% mdshortcode %}} |
||||
Content **with** _emphasis_ characters is rendered. |
||||
|
||||
The HTML <b>markup</b> will also get rendered. |
||||
{{% /mdshortcode %}} |
||||
|
||||
This will export as: |
||||
|
||||
```md |
||||
{{%/* mdshortcode */%}} Content rendered as Markdown {{%/* /mdshortcode */%}} |
||||
``` |
||||
|
||||
|
||||
## Paired non-markdown (default) shortcode {#paired-non-markdown--default--shortcode} |
||||
|
||||
{{< myshortcode >}} |
||||
Content is rendered <b>like HTML</b>. The Markdown _emphasis_ |
||||
characters are !! NOT !! rendered. |
||||
|
||||
So a blank line before this sentence in the Markdown source will |
||||
<b>not</b> result in a new paragraph in HTML. <p>But this will be a |
||||
new paragraph as it is wrapped in HTML <code><p></code> |
||||
tags.</p> |
||||
{{< /myshortcode >}} |
||||
|
||||
This will export as: |
||||
|
||||
```md |
||||
{{</* myshortcode */>}} Content NOT rendered as Markdown {{</* /myshortcode */>}} |
||||
``` |
||||
|
||||
|
||||
## Not a recognized paired shortcode {#not-a-recognized-paired-shortcode} |
||||
|
||||
<div class="foo"> |
||||
<div></div> |
||||
|
||||
Content **with** Markdown _emphasis_ characters is rendered fine in the |
||||
default Special Blocks. |
||||
</div> |
||||
|
||||
This will export as [Special Blocks](/posts/special-blocks) --- either wrapped with `<div>` |
||||
tags or HTML5-recognized tags. |
||||
@ -0,0 +1 @@ |
||||
{{ .Inner }} |
||||
@ -0,0 +1 @@ |
||||
{{ .Inner }} |
||||
Loading…
Reference in new issue