diff --git a/help/FEATURES.md b/help/FEATURES.md index 0aa9abfe..ae5ae82c 100644 --- a/help/FEATURES.md +++ b/help/FEATURES.md @@ -443,7 +443,9 @@ Yank Note 运行你在页面中嵌入宏,用以动态的替换文档。 <= => ``` -其中 `expression` 是需要执行的 js 代码。 +其中 `expression` 是需要执行的 js 表达式。 + +如果表达式中需要包含 <\= 或 =\> 请输入 `<\=` 或 `=\>` 转义替换 ### 示例 @@ -451,6 +453,7 @@ Yank Note 运行你在页面中嵌入宏,用以动态的替换文档。 - 自定义变量: <= customVar => - 当前文档名: <= $doc.basename => - 当前时间: <= ctx.lib.dayjs().format('YYYY-MM-DD HH:mm') => +- 限定符转义: <= (1 <\= 3) ? 'result =\> true' : 'result =\> false' => - 四则运算: <= (1 + 2) / 2 => - 九九乘法表 <= diff --git a/src/renderer/plugins/markdown-macro.ts b/src/renderer/plugins/markdown-macro.ts index b104e747..3c009d51 100644 --- a/src/renderer/plugins/markdown-macro.ts +++ b/src/renderer/plugins/markdown-macro.ts @@ -59,6 +59,7 @@ export default { const expression = match .substring(2, match.length - 2) .trim() + .replace(/(?:=\\>|<\\=)/g, x => x.replace('\\', '')) const result = macro(expression, vars)