Skip to content

Commit 0f82435

Browse files
committed
docs: zh-cn doc for inline comment
1 parent 3dc4290 commit 0f82435

4 files changed

Lines changed: 53 additions & 2 deletions

File tree

docs/source/tags/overview.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ Iteration | iterate over a collection | for, cycle, tablerow
1313
Control Flow | control the execution branch of template rendering | if, unless, elsif, else, case, when
1414
Variable | define and alter variables | assign, increment, decrement, capture, echo
1515
File | include another template or extend a layout template | render, include, layout
16-
Language | temporarily disable LiquidJS syntax | raw, comment, liquid
16+
Language | temporarily disable LiquidJS syntax | # (inline comment), raw, comment, liquid
1717

1818
[shopify/liquid]: https://github.com/Shopify/liquid
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
---
2+
title: "#(单行注释)"
3+
---
4+
5+
{% since %}v9.38.0{% endsince %}
6+
7+
在 Liquid 模板中添加注释,注释标签内的文字不会被输出。
8+
9+
输入
10+
```liquid
11+
注释标签内的东西都不会输出。
12+
{% # this is an inline comment %}
13+
但每行都必须以 '#' 开头。
14+
{%
15+
# this is a comment
16+
# that spans multiple lines
17+
%}
18+
```
19+
20+
输出
21+
```text
22+
注释标签内的东西都不会输出。
23+
但每行都必须以 '#' 开头。
24+
```
25+
26+
在 <a href="./liquid.html">`liquid`</a> 标签里也可以使用注释标签。
27+
28+
```liquid
29+
{% liquid
30+
# required args
31+
assign product = collection.products.first
32+
33+
# optional args
34+
assign should_show_border = should_show_border | default: true
35+
assign should_highlight = should_highlight | default: false
36+
%}
37+
```
38+
39+
但注释标签不能用于把其他标签注释掉。这时应该使用 <a href="./comment.html">`comment`</a> 标签来临时禁用其他标签。
40+
41+
输入
42+
```liquid
43+
{%- # {% echo 'Welcome to LiquidJS!' %} -%}
44+
{% comment %}{% echo 'Welcome to LiquidJS!' %}{% endcomment %}
45+
```
46+
47+
输出
48+
```text
49+
-%}
50+
```

docs/source/zh-cn/tags/overview.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ LiquidJS 支持十几个过滤器,可以分为如下几类:
1313
控制流 | 控制模板渲染的执行分支 | if, unless, elif, else, case, when
1414
变量 | 定义和修改变量 | assign, increment, decrement, capture, echo
1515
文件 | 引入或继承其他模板 | render, include, layout
16-
语言 | 暂时禁用 Liquid 语法 | raw, comment, liquid
16+
语言 | 暂时禁用 Liquid 语法 | # (单行注释), raw, comment, liquid
1717

1818
[shopify/liquid]: https://github.com/Shopify/liquid

docs/themes/navy/languages/zh-cn.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ sidebar:
5959
overview: 概述
6060
tags:
6161
overview: 概述
62+
'# (inline comment)': '#(单行注释)'
6263
api:
6364
quick_entry: 快速入口
6465
classes: 类

0 commit comments

Comments
 (0)