From 56139c8cec4b8e85ac06e4a466691731ac84d757 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zi=E8=8E=B1=E5=8D=B7?=
Date: Mon, 14 Sep 2020 17:04:36 +0800
Subject: [PATCH] Update plugin-handbook.md
---
translations/zh-Hans/plugin-handbook.md | 31 +++++++++++++------------
1 file changed, 16 insertions(+), 15 deletions(-)
diff --git a/translations/zh-Hans/plugin-handbook.md b/translations/zh-Hans/plugin-handbook.md
index 6e0a7c81..d2757dd4 100644
--- a/translations/zh-Hans/plugin-handbook.md
+++ b/translations/zh-Hans/plugin-handbook.md
@@ -1404,10 +1404,10 @@ ReturnStatement(path) {
```
> **注意:>当用多个节点替换一个表达式时,它们必须是 声明。 这是因为Babel在更换节点时广泛使用启发式算法,这意味着您可以做一些非常疯狂的转换,否则将会非常冗长。
->
-> ### 用字符串源码替换节点
->
-> ```js
+
+### 用字符串源码替换节点
+
+```js
FunctionDeclaration(path) {
path.replaceWithSourceString(`function add(a, b) {
return a + b;
@@ -1424,10 +1424,10 @@ FunctionDeclaration(path) {
```
> **注意:>不建议使用这个API,除非您正在处理动态的源码字符串,否则在访问者外部解析代码更有效率。
->
-> ### 插入兄弟节点
->
-> ```js
+
+### 插入兄弟节点
+
+```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.")));
@@ -1443,13 +1443,14 @@ FunctionDeclaration(path) {
```
> 注意:>这里同样应该使用声明或者一个声明数组。 这个使用了在用多个节点替换一个节点>中提到的相同的启发式算法。.
->
-> ### 插入到容器(container)中
->
-> 如果您想要在AST节点属性中插入一个像` body 0>那样的数组。
+
+### 插入到容器(container)中
+
+如果您想要在AST节点属性中插入一个像` body 0>那样的数组。
+
它与 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')));
@@ -2158,4 +2159,4 @@ pluginTester({
* * *
-> ***对于将来的更新,请跟随 @thejameskyle >和 @babeljs > 的Twitter。
\ No newline at end of file
+> ***对于将来的更新,请跟随 @thejameskyle >和 @babeljs > 的Twitter。