Closed ljguo1020 closed 2 weeks ago
Name is case-sensitive. Make it "name": "latex-expl3"
.
import { defineConfig } from 'vitepress'
import latex3 from '../src/LaTeX-Expl3.tmLanguage.json';
export default defineConfig({
...
themeConfig: {
...
},
markdown: {
languages: [latex3]
}
})
I changed the file like this, and it actually worked in the html. But there is still a error hint from VScode:
不能将类型“{ name: string; patterns: ({ begin: string; beginCaptures: { "1": { name: string; }; "0"?: undefined; }; end: string; endCaptures: { "1": { name: string; }; "0"?: undefined; }; name: string; patterns: ({ match: string; name: string; include?: undefined; } | { ...; })[]; include?: undefined; } | { ...; } | { ...; })[...”分配给类型“LanguageInput”。
不能将类型“{ name: string; patterns: ({ begin: string; beginCaptures: { "1": { name: string; }; "0"?: undefined; }; end: string; endCaptures: { "1": { name: string; }; "0"?: undefined; }; name: string; patterns: ({ match: string; name: string; include?: undefined; } | { ...; })[]; include?: undefined; } | { ...; } | { ...; })[...”分配给类型“LanguageRegistration”。
属性“repository”的类型不兼容。
不能将类型“{ latex3: { patterns: { captures: { "1": { name: string; }; }; match: string; name: string; }[]; }; }”分配给类型“IRawRepository”。
类型“{ latex3: { patterns: { captures: { "1": { name: string; }; }; match: string; name: string; }[]; }; }”缺少类型“IRawRepositoryMap”中的以下属性: $self, $base
That language is not fully compatible with Shiki types. But if it works you can use // @ts-ignore
or // @ts-expect-error
above that line.
That language is not fully compatible with Shiki types. But if it works you can use
// @ts-ignore
or// @ts-expect-error
above that line.
It works. Thanks a lot.
Describe the bug
我想自定义一种代码高亮语言, 这是我的 LaTeX-Expl3.tmLanguage.json, 在线链接 LaTeX-Expl3.tmLanguage.json
我的 vitepress 配置文件如下
它没有正常工作,控制台出现
The language 'latex-expl3' is not loaded, falling back to 'txt' for syntax highlighting.
Reproduction
如上效果
Expected behavior
正常渲染 LaTeX3 的代码
System Info
Additional context
No response
Validations