|
| 1 | +/** |
| 2 | + * Copyright (C) 2021 Tencent. |
| 3 | + * |
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | + * you may not use this file except in compliance with the License. |
| 6 | + * You may obtain a copy of the License at |
| 7 | + * |
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | + * |
| 10 | + * Unless required by applicable law or agreed to in writing, software |
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | + * See the License for the specific language governing permissions and |
| 14 | + * limitations under the License. |
| 15 | + */ |
| 16 | +// import Bold from './hooks/Bold'; |
| 17 | +// import Italic from './hooks/Italic'; |
| 18 | +// import Underline from './hooks/Underline'; |
| 19 | +import Color from './hooks/Color'; |
| 20 | +import BackgroundColor from './hooks/BackgroundColor'; |
| 21 | +import Size from './hooks/Size'; |
| 22 | +import Strikethrough from './hooks/Strikethrough'; |
| 23 | +import Sup from './hooks/Sup'; |
| 24 | +import Sub from './hooks/Sub'; |
| 25 | +import InlineCode from './hooks/InlineCode'; |
| 26 | +import CodeBlock from './hooks/CodeBlock'; |
| 27 | +import Link from './hooks/Link'; |
| 28 | +import Emphasis from './hooks/Emphasis'; |
| 29 | +import Paragraph from './hooks/Paragraph'; |
| 30 | +import Header from './hooks/Header'; |
| 31 | +import Transfer from './hooks/Transfer'; |
| 32 | +import Table from './hooks/Table'; |
| 33 | +import Br from './hooks/Br'; |
| 34 | +import Hr from './hooks/Hr'; |
| 35 | +import Image from './hooks/Image'; |
| 36 | +import List from './hooks/List'; |
| 37 | +import Blockquote from './hooks/Blockquote'; |
| 38 | +import AutoLink from './hooks/AutoLink'; |
| 39 | +import MathBlock from './hooks/MathBlock'; |
| 40 | +import InlineMath from './hooks/InlineMath'; |
| 41 | +import Toc from './hooks/Toc'; |
| 42 | +import Footnote from './hooks/Footnote'; |
| 43 | +import CommentReference from './hooks/CommentReference'; |
| 44 | +import HtmlBlock from './hooks/HtmlBlock'; |
| 45 | +import Emoji from './hooks/Emoji'; |
| 46 | +import Underline from './hooks/Underline'; |
| 47 | +import HighLight from './hooks/HighLight'; |
| 48 | +// 不引入 Suggester,因为它依赖 codemirror,Stream 版本不需要 |
| 49 | +// import Suggester from './hooks/Suggester'; |
| 50 | +import Ruby from './hooks/Ruby'; |
| 51 | +import Panel from './hooks/Panel'; |
| 52 | +import Detail from './hooks/Detail'; |
| 53 | +import FrontMatter from './hooks/FrontMatter'; |
| 54 | +import Space from './hooks/Space'; |
| 55 | +import AiFlowAutoClose from './hooks/AiFlowAutoClose'; |
| 56 | +/** |
| 57 | + * 引擎各语法的配置 (Stream 版本) |
| 58 | + * 主要决定支持哪些语法,以及各语法的执行顺序 |
| 59 | + * |
| 60 | + * 与完整版的区别: |
| 61 | + * - 不包含 Suggester(依赖 codemirror,用于编辑器输入建议) |
| 62 | + */ |
| 63 | +const hooksConfig = [ |
| 64 | + // 段落级 Hook |
| 65 | + // 引擎会按当前排序顺序执行beforeMake、makeHtml方法 |
| 66 | + // 引擎会按当前排序逆序执行afterMake方法 |
| 67 | + FrontMatter, |
| 68 | + CodeBlock, |
| 69 | + InlineCode, |
| 70 | + /** |
| 71 | + * 理论上行内公式(InlineMath)应该在段落公式(MathBlock)的后面,否则行内公式会破坏段落公式的渲染 |
| 72 | + * 但实际交换顺序后,发现没啥问题,还顺带解决了[这个issue #1090](https://github.com/Tencent/cherry-markdown/issues/1090)的问题 |
| 73 | + * 没问题的原因是对于段落公式(比如$$(a+b)^2=a^2+2ab+b^2$$),行内公式的确会命中,会识别出来两个'$$',所以无事发生 |
| 74 | + */ |
| 75 | + InlineMath, |
| 76 | + MathBlock, |
| 77 | + AiFlowAutoClose, |
| 78 | + HtmlBlock, |
| 79 | + Footnote, |
| 80 | + CommentReference, |
| 81 | + Transfer, |
| 82 | + Br, |
| 83 | + Table, |
| 84 | + Toc, |
| 85 | + Blockquote, |
| 86 | + Header, // 处理标题, 传入strict属性严格要求ATX风格标题#后带空格 |
| 87 | + Hr, |
| 88 | + List, |
| 89 | + Detail, |
| 90 | + Panel, |
| 91 | + Paragraph, // 普通段落 |
| 92 | + |
| 93 | + // 行内Hook |
| 94 | + // 引擎会按当前顺序执行makeHtml方法 |
| 95 | + Emoji, |
| 96 | + Image, |
| 97 | + Link, |
| 98 | + AutoLink, |
| 99 | + Emphasis, |
| 100 | + BackgroundColor, |
| 101 | + Color, |
| 102 | + Size, |
| 103 | + Sub, |
| 104 | + Sup, |
| 105 | + Ruby, |
| 106 | + Strikethrough, |
| 107 | + Underline, |
| 108 | + HighLight, |
| 109 | + // 不包含 Suggester,Stream 版本不需要编辑器输入建议功能 |
| 110 | + // Suggester, |
| 111 | + Space, |
| 112 | +]; |
| 113 | + |
| 114 | +export default hooksConfig; |
0 commit comments