docs: update docs for website

This commit is contained in:
Harttle
2021-09-30 23:52:26 +08:00
committed by harttle
parent f0e2e07f0b
commit d742de79ba
5 changed files with 5675 additions and 523 deletions
+6 -6
View File
@@ -1,9 +1,3 @@
-
url: https://github.com/harttle/liquidjs/pull/5
date: '2016-09-12'
title:
zh-cn: '异步化:重写了解析器和渲染器,使 LiquidJS 可以提供 Promise API 并支持异步的自定义 Tag 实现。'
en: 'Async spike: rewrite the parser and render to support Promise, which enables async tags.'
-
url: https://opencollective.com/liquidjs/#section-contribute
date: '2020-02-26'
@@ -22,3 +16,9 @@
title:
zh-cn: '性能提升:引入 AST 并重新设计 Token 类型系统,使渲染性能平均提升 100.3%。'
en: 'Performance Boost: a simple AST to improve render performance by 100.3%.'
-
url: https://github.com/harttle/liquidjs/milestone/3?closed=1
date: '2021-09-30'
title:
zh-cn: '流式渲染:4 倍渲染速度,并增加了对流式渲染的支持。'
en: 'Streamed Rendering: now render is 4x faster and support streamed rendering.'
+8 -4
View File
@@ -2,7 +2,7 @@
title: Options
---
The [Liquid][liquid] constructor accepts a plain object as options to define the behaviour of LiquidJS. All of these options are optional thus we can specify any of them, for example the `cache` option:
The [Liquid][liquid] constructor accepts a plain object as options to define the behavior of LiquidJS. All of these options are optional thus we can specify any of them, for example the `cache` option:
```javascript
const { Liquid } = require('liquidjs')
@@ -42,7 +42,7 @@ LiquidJS defaults this option to <code>true</code> to be compatible with shopify
## extname
**extname** defines the default extname to be appended into filenames if the filename has no extname. Defaults to `''` which means it's disabled by default. By setting it to `.liquid`:
**extname** defines the default extension name to be appended into filenames if the filename has no extension name. Defaults to `''` which means it's disabled by default. By setting it to `.liquid`:
```liquid
{% render "foo" %} there's no extname, adds `.liquid` and loads foo.liquid
@@ -79,7 +79,7 @@ it defaults to false. For example, when set to true, a blank string would evalu
## Trimming
**greedy**, **trimOutputLeft**, **trimOutputRight**, **trimTagLeft**, **trimTagRight** options are used to eliminate extra newlines and indents in templates arround Liquid Constructs. See [Whitespace Control][wc] for details.
**greedy**, **trimOutputLeft**, **trimOutputRight**, **trimTagLeft**, **trimTagRight** options are used to eliminate extra newlines and indents in templates around Liquid Constructs. See [Whitespace Control][wc] for details.
## Delimiter
@@ -98,9 +98,13 @@ it defaults to false. For example, when set to true, a blank string would evalu
**lenientIf** modifies the behavior of `strictVariables` to allow handling optional variables. If set to `true`, an undefined variable will *not* cause an exception in the following two situations: a) it is the condition to an `if`, `elsif`, or `unless` tag; b) it occurs right before a `default` filter. Irrelevant if `strictVariables` is not set. Defaults to `false`.
{% note info Non-existent Tags %}
Non-existent tags always throw errors during parsing and this behaviour can not be customized.
Non-existent tags always throw errors during parsing and this behavior can not be customized.
{% endnote %}
## Parameter Order
Parameter orders are ignored by default, for ea `{% for i in (1..8) reversed limit:3 %}` will always perform `limit` before `reversed`, even if `reversed` occurs before `limit`. To make parameter order respected, set **orderedFilterParameters** to `true`. Its default value is `false`.
[liquid]: ../api/classes/liquid_.liquid.html
[caching]: ./caching.html
[abstract-fs]: ./render-file.html#Abstract-File-System
+4
View File
@@ -98,6 +98,10 @@ LiquidJS 把这个选项默认值设为 <code>true</code> 以兼容于 shopify/l
不存在的标签总是会抛出一个解析异常,这一行为无法自定义。
{% endnote %}
## 参数顺序
默认会忽略参数出现的顺序,例如 `{% for i in (1..8) reversed limit:3 %}` 里总是会先执行 `limit` 再执行 `reversed`,虽然 `reversed` 先出现。为了让 LiquidJS 按顺序执行参数,需要设置 **orderedFilterParameters**`true`。它的默认值为 `false`
[liquid]: ../api/classes/liquid_.liquid.html
[caching]: ./caching.html
[abstract-fs]: ./render-file.html#Abstract-File-System