mirror of
https://github.com/dillonzq/LoveIt.git
synced 2024-11-14 02:46:16 +01:00
feat: raw shortcode
This commit is contained in:
parent
73a705a629
commit
85a710d6c2
3 changed files with 68 additions and 0 deletions
|
@ -17,6 +17,9 @@ tags: ["shortcodes"]
|
|||
categories: ["documentation"]
|
||||
|
||||
lightgallery: true
|
||||
|
||||
math:
|
||||
enable: true
|
||||
---
|
||||
|
||||
**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 >}}
|
||||
console.log('Hello LoveIt!');
|
||||
{{< /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"]
|
||||
|
||||
lightgallery: true
|
||||
|
||||
math:
|
||||
enable: true
|
||||
mapbox:
|
||||
lightStyle: mapbox://styles/mapbox/light-zh-v1?optimize=true
|
||||
darkStyle: mapbox://styles/mapbox/dark-zh-v1?optimize=true
|
||||
|
@ -1295,3 +1298,33 @@ console.log('Hello LoveIt!');
|
|||
{{< script >}}
|
||||
console.log('Hello LoveIt!');
|
||||
{{< /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 -}}
|
Loading…
Reference in a new issue