feat: raw shortcode
This commit is contained in:
@@ -17,6 +17,9 @@ tags: ["shortcodes"]
|
|||||||
categories: ["documentation"]
|
categories: ["documentation"]
|
||||||
|
|
||||||
lightgallery: true
|
lightgallery: true
|
||||||
|
|
||||||
|
math:
|
||||||
|
enable: true
|
||||||
---
|
---
|
||||||
|
|
||||||
**LoveIt** theme provides multiple shortcodes on top of built-in ones in Hugo.
|
**LoveIt** theme provides multiple shortcodes on top of built-in ones in Hugo.
|
||||||
@@ -1293,3 +1296,34 @@ You can see the output in the console of the developer tool.
|
|||||||
{{< script >}}
|
{{< script >}}
|
||||||
console.log('Hello LoveIt!');
|
console.log('Hello LoveIt!');
|
||||||
{{< /script >}}
|
{{< /script >}}
|
||||||
|
|
||||||
|
## 12 raw
|
||||||
|
|
||||||
|
`raw` is a shortcode to insert raw **:(fab fa-html5 fa-fw): HTML** content in your post.
|
||||||
|
This is useful when you want to include some Markdown content to **avoid being rendered or escaped** by Hugo.
|
||||||
|
|
||||||
|
Example `raw` input:
|
||||||
|
|
||||||
|
```markdown
|
||||||
|
Inline Formula: {{</* raw */>}}\(\mathbf{E}=\sum_{i} \mathbf{E}_{i}=\mathbf{E}_{1}+\mathbf{E}_{2}+\mathbf{E}_{3}+\cdots\){{</* /raw */>}}
|
||||||
|
|
||||||
|
Block Formula:
|
||||||
|
|
||||||
|
{{</* raw */>}}
|
||||||
|
\[ a=b+c \\ d+e=f \]
|
||||||
|
{{</* /raw */>}}
|
||||||
|
|
||||||
|
Raw content using Markdown syntax: {{</* raw */>}}**Hello**{{</* /raw */>}}
|
||||||
|
```
|
||||||
|
|
||||||
|
The rendered output looks like this:
|
||||||
|
|
||||||
|
Inline Formula: {{< raw >}}\(\mathbf{E}=\sum_{i} \mathbf{E}_{i}=\mathbf{E}_{1}+\mathbf{E}_{2}+\mathbf{E}_{3}+\cdots\){{< /raw >}}
|
||||||
|
|
||||||
|
Block Formula:
|
||||||
|
|
||||||
|
{{< raw>}}
|
||||||
|
\[ a=b+c \\ d+e=f \]
|
||||||
|
{{< /raw >}}
|
||||||
|
|
||||||
|
Raw content using Markdown syntax: {{< raw >}}**Hello**{{< /raw >}}
|
||||||
|
|||||||
@@ -17,6 +17,9 @@ tags: ["shortcodes"]
|
|||||||
categories: ["documentation"]
|
categories: ["documentation"]
|
||||||
|
|
||||||
lightgallery: true
|
lightgallery: true
|
||||||
|
|
||||||
|
math:
|
||||||
|
enable: true
|
||||||
mapbox:
|
mapbox:
|
||||||
lightStyle: mapbox://styles/mapbox/light-zh-v1?optimize=true
|
lightStyle: mapbox://styles/mapbox/light-zh-v1?optimize=true
|
||||||
darkStyle: mapbox://styles/mapbox/dark-zh-v1?optimize=true
|
darkStyle: mapbox://styles/mapbox/dark-zh-v1?optimize=true
|
||||||
@@ -1295,3 +1298,33 @@ console.log('Hello LoveIt!');
|
|||||||
{{< script >}}
|
{{< script >}}
|
||||||
console.log('Hello LoveIt!');
|
console.log('Hello LoveIt!');
|
||||||
{{< /script >}}
|
{{< /script >}}
|
||||||
|
|
||||||
|
## 12 raw
|
||||||
|
|
||||||
|
`raw` shortcode 用来在你的文章中插入原始 **:(fab fa-html5 fa-fw): HTML** 内容.
|
||||||
|
|
||||||
|
一个 `raw` 示例:
|
||||||
|
|
||||||
|
```markdown
|
||||||
|
行内公式: {{</* raw */>}}\(\mathbf{E}=\sum_{i} \mathbf{E}_{i}=\mathbf{E}_{1}+\mathbf{E}_{2}+\mathbf{E}_{3}+\cdots\){{</* /raw */>}}
|
||||||
|
|
||||||
|
公式块:
|
||||||
|
|
||||||
|
{{</* raw */>}}
|
||||||
|
\[ a=b+c \\ d+e=f \]
|
||||||
|
{{</* /raw */>}}
|
||||||
|
|
||||||
|
原始的带有 Markdown 语法的内容: {{</* raw */>}}**Hello**{{</* /raw */>}}
|
||||||
|
```
|
||||||
|
|
||||||
|
呈现的输出效果如下:
|
||||||
|
|
||||||
|
行内公式: {{< raw >}}\(\mathbf{E}=\sum_{i} \mathbf{E}_{i}=\mathbf{E}_{1}+\mathbf{E}_{2}+\mathbf{E}_{3}+\cdots\){{< /raw >}}
|
||||||
|
|
||||||
|
公式块:
|
||||||
|
|
||||||
|
{{< raw>}}
|
||||||
|
\[ a=b+c \\ d+e=f \]
|
||||||
|
{{< /raw >}}
|
||||||
|
|
||||||
|
原始的带有 Markdown 语法的内容: {{< raw >}}**Hello**{{< /raw >}}
|
||||||
|
|||||||
1
layouts/shortcodes/raw.html
Normal file
1
layouts/shortcodes/raw.html
Normal file
@@ -0,0 +1 @@
|
|||||||
|
{{- .Inner | safeHTML -}}
|
||||||
Reference in New Issue
Block a user