我用 obsidian-latex-suite 解决中文标点输入的问题

本来 obsidian-latex-suite 是使用文本片段更快地编写LaTeX . 我用它解决中文标点输入.

先上配置

[
    {trigger: "(?<![\\x00-\\xff])\\, ", replacement: ",", options: "rtA"},
    {trigger: "(?<![\\x00-\\xff])\\. ", replacement: "。", options: "rtA"},
    {trigger: "(?<![\\x00-\\xff])\\? ", replacement: "?", options: "rtA"},
    {trigger: "(?<![\\x00-\\xff])\\\\ ", replacement: "、", options: "rtA"},
    {trigger: "(?<![\\x00-\\xff])\\! ", replacement: "!", options: "rtA"},
    {trigger: "(?<![\\x00-\\xff])\\; ", replacement: ";", options: "rtA"},
    {trigger: "(?<![\\x00-\\xff])\\: ", replacement: ":", options: "rtA"},
    {trigger: "(?<![\\x00-\\xff])\\^ ", replacement: "……", options: "rtA"},
    {trigger: "(?<![\\x00-\\xff])\\_ ", replacement: "——", options: "rtA"},
    {trigger: "(?<![\\x00-\\xff])\'\' ", replacement: "‘$0’", options: "rtA"},
    {trigger: "(?<![\\x00-\\xff])\"\" ", replacement: "“$0”", options: "rtA"},
    {trigger: "(?<![\\x00-\\xff])\\(\\) ", replacement: "($0)", options: "rtA"},
    {trigger: "(?<![\\x00-\\xff])\\[\\] ", replacement: "【$0】", options: "rtA"},
    {trigger: "(?<![\\x00-\\xff])\\<\\> ", replacement: "《$0》", options: "rtA"},
]

我习惯用半角标点(英文标点)写 markdown , 标点后习惯加个空格.
该配置会在中文字符或标点后, 输入半角符号 + 空格, 自动转为中文标点.
打字格外丝滑.

还有其他用法欢迎补充.

2 个赞

我也一直头疼这个问题。纯小白弱弱地问一下,这个代码加到哪儿?

1 个赞

安装 obsidian-latex-suite 插件,在配置中的 Snippets 下增加上面配置(不要中括号)