From 5b1658c8232c6f30fb883b196c974c8df4eb147d Mon Sep 17 00:00:00 2001 From: Yang Jun Date: Tue, 20 Aug 2024 03:35:37 +0800 Subject: [PATCH] docs: fix styles and escape --- docs/source/tutorials/parse-parameters.md | 2 +- docs/source/tutorials/render-tag-content.md | 4 ++-- docs/source/zh-cn/tutorials/parse-parameters.md | 2 +- docs/source/zh-cn/tutorials/render-tag-content.md | 2 +- docs/themes/navy/source/css/_partial/highlight.styl | 5 ++++- docs/themes/navy/source/css/_partial/page.styl | 3 ++- 6 files changed, 11 insertions(+), 7 deletions(-) diff --git a/docs/source/tutorials/parse-parameters.md b/docs/source/tutorials/parse-parameters.md index 1d3e3e0697..dfb7c01983 100644 --- a/docs/source/tutorials/parse-parameters.md +++ b/docs/source/tutorials/parse-parameters.md @@ -92,7 +92,7 @@ engine.registerTag('random', { }) ``` -Rendering `{% random from:2, to:max %}` in scope `{ max: 10 }` will generate a random number in the range [2, 10]. See this JSFiddle: +Rendering `{% raw %}{% random from:2, to:max %}{% endraw %}` in scope `{ max: 10 }` will generate a random number in the range [2, 10]. See this JSFiddle: [register-tags]: /tutorials/register-filters-tags.html diff --git a/docs/source/tutorials/render-tag-content.md b/docs/source/tutorials/render-tag-content.md index cae51a73f6..3b4445af5c 100644 --- a/docs/source/tutorials/render-tag-content.md +++ b/docs/source/tutorials/render-tag-content.md @@ -24,8 +24,8 @@ Expected output: Firstly, [register][register-tags] a tag with name `wrap` and parse the content into `this.tpls`. Here in `parse(tagToken, remainTokens)`, -- `tagToken` is current token `{% wrap %}`, and -- `remainTokens` is an array of all tokens following `{% wrap %}` until the end of this template file. +- `tagToken` is current token `{%raw%}{% wrap %}{%endraw%}`, and +- `remainTokens` is an array of all tokens following `{%raw%}{% wrap %}{%endraw%}` until the end of this template file. Basically, what we need to do is take/`.shift()` enough tags from `remainTokens` until we got a `endwrap` token (the name can be arbitrary, but in convention, we need it to be `endwrap`). And if there's no `endwrap` until the end of template file, we need to throw an tag-not-closed `Error`. diff --git a/docs/source/zh-cn/tutorials/parse-parameters.md b/docs/source/zh-cn/tutorials/parse-parameters.md index a7cadefc2e..3f5cbaa65c 100644 --- a/docs/source/zh-cn/tutorials/parse-parameters.md +++ b/docs/source/zh-cn/tutorials/parse-parameters.md @@ -93,7 +93,7 @@ engine.registerTag('random', { }) ``` -在 `{ max: 10 }` 上下文上渲染 `{% random from:2, to:max %}` 将会得到 [2, 10] 范围内的随机数。见这个 JSFiddle:。 +在 `{ max: 10 }` 上下文上渲染 `{% raw %}{% random from:2, to:max %}{% endraw %}` 将会得到 [2, 10] 范围内的随机数。见这个 JSFiddle:。 [register-tags]: /tutorials/register-filters-tags.html [Tokenizer]: /api/classes/Tokenizer.html diff --git a/docs/source/zh-cn/tutorials/render-tag-content.md b/docs/source/zh-cn/tutorials/render-tag-content.md index 0a5df44f17..76968556a2 100644 --- a/docs/source/zh-cn/tutorials/render-tag-content.md +++ b/docs/source/zh-cn/tutorials/render-tag-content.md @@ -24,7 +24,7 @@ title: 渲染标签内容 首先 [注册][register-tags] 一个名为 `wrap` 的标签,把内容解析到 `this.tpls` 数组里。`parse(tagToken, remainTokens)` 中, -- `tagToken` 是当前 *Token* `{% wrap %}`, +- `tagToken` 是当前 *Token* `{%raw%}{% wrap %}{%endraw%}`, - `remainTokens` 是当前模板中后续所有 *Token* 的数组。 我们要做的是从 `remainTokens` 里拿出来/`.shift()` 足够的标签直到遇到 `endwrap`(其实可以是任意名字,但按照惯例应该叫 `endwrap`)。如果到模板结尾都没遇到 `endwrap`,需要抛出一个标签未关闭的 `Error`。 diff --git a/docs/themes/navy/source/css/_partial/highlight.styl b/docs/themes/navy/source/css/_partial/highlight.styl index d14714b68a..908010296f 100644 --- a/docs/themes/navy/source/css/_partial/highlight.styl +++ b/docs/themes/navy/source/css/_partial/highlight.styl @@ -41,8 +41,10 @@ pre table margin: 0 !important border: 0 - th, td + .gutter, .code padding: 0 + .gutter + padding-right: 12px figcaption clearfix() margin: -5px 0 5px @@ -53,6 +55,7 @@ pre margin: 0 padding: 0 background: none + white-space: pre .line height: 22px diff --git a/docs/themes/navy/source/css/_partial/page.styl b/docs/themes/navy/source/css/_partial/page.styl index 02fa49ef74..31337fdf51 100644 --- a/docs/themes/navy/source/css/_partial/page.styl +++ b/docs/themes/navy/source/css/_partial/page.styl @@ -38,7 +38,8 @@ note-warn = hsl(0, 100%, 50%) margin: 40px auto .sidebar-title border-top: none - +.toc-item + list-style: none .toc-link @extend .sidebar-link