Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

correct the invalid markdown syntax #218

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
31 changes: 16 additions & 15 deletions translations/zh-Hans/plugin-handbook.md
Expand Up @@ -1404,10 +1404,10 @@ ReturnStatement(path) {
```

> **注意:</>当用多个节点替换一个表达式时,它们必须是   声明。 这是因为Babel在更换节点时广泛使用启发式算法,这意味着您可以做一些非常疯狂的转换,否则将会非常冗长。</p> </blockquote>
>
> ### <a id="toc-replacing-a-node-with-a-source-string"></a>用字符串源码替换节点
>
> ```js

### <a id="toc-replacing-a-node-with-a-source-string"></a>用字符串源码替换节点

```js
FunctionDeclaration(path) {
path.replaceWithSourceString(`function add(a, b) {
return a + b;
Expand All @@ -1424,10 +1424,10 @@ FunctionDeclaration(path) {
```

> **注意:</>不建议使用这个API,除非您正在处理动态的源码字符串,否则在访问者外部解析代码更有效率。</p> </blockquote>
>
> ### <a id="toc-inserting-a-sibling-node"></a>插入兄弟节点
>
> ```js

### <a id="toc-inserting-a-sibling-node"></a>插入兄弟节点

```js
FunctionDeclaration(path) {
path.insertBefore(t.expressionStatement(t.stringLiteral("Because I'm easy come, easy go.")));
path.insertAfter(t.expressionStatement(t.stringLiteral("A little high, little low.")));
Expand All @@ -1443,13 +1443,14 @@ FunctionDeclaration(path) {
```

> 注意:</>这里同样应该使用声明或者一个声明数组。 这个使用了在用多个节点替换一个节点</>中提到的相同的启发式算法。.</p> </blockquote>
>
> ### <a id="toc-inserting-into-a-container"></a>插入到容器(container)中
>
> 如果您想要在AST节点属性中插入一个像` body </ 0>那样的数组。

### <a id="toc-inserting-into-a-container"></a>插入到容器(container)中

如果您想要在AST节点属性中插入一个像` body </ 0>那样的数组。

它与 <code> insertBefore `/` insertAfter ` 类似, 但您必须指定 ` listKey ` (通常是 ` 正文 `).
>
> ```js

```js
ClassMethod(path) {
path.get('body').unshiftContainer('body', t.expressionStatement(t.stringLiteral('before')));
path.get('body').pushContainer('body', t.expressionStatement(t.stringLiteral('after')));
Expand Down Expand Up @@ -2158,4 +2159,4 @@ pluginTester({

* * *

> ***对于将来的更新,请跟随 @thejameskyle </>和 @babeljs </> 的Twitter。</em></strong></p> </blockquote>
> ***对于将来的更新,请跟随 @thejameskyle </>和 @babeljs </> 的Twitter。</em></strong></p> </blockquote>