简单键值文件的语言(主要用于语法突出显示)

发布于 2025-02-08 16:06:17 字数 785 浏览 3 评论 0原文

因此,我有一些包含键值对的简单文件:

TITLE       language for simple key-value file (mostly for syntax highlighting)
DESCRIPTION so i have some simple files that contain key-value pairs like this.
DESCRIPTION
DESCRIPTION values can span multiple lines (in which case the key is just
DESCRIPTION repeated)
URL         https://stackoverflow.com/questions/72677445

因此,基本上,这是用于表达字典的声明性DSL:每行中的第一个单词是键,其余的就是值;钥匙和价值通过任意数量的白色分开。

现在,我希望这些文件获得一些基本的语法高光(使“键”部分与“值”部分显示不同),主要是github/gitlab/...

不幸的是,我不知道哪种语言“我应该使用。

  • 该语法是如此的最低限度,以至于自动检测只是“纯文本”。
  • 现代语法荧光笔支持多种语言(例如语言学家列出了大约650种不同的语言),这使得它是不可行的尝试每个。

有什么想法如何称为“语言”(或我可以滥用语法高音的哪种基本语言)?

so i have some simple files that contain key-value pairs like this:

TITLE       language for simple key-value file (mostly for syntax highlighting)
DESCRIPTION so i have some simple files that contain key-value pairs like this.
DESCRIPTION
DESCRIPTION values can span multiple lines (in which case the key is just
DESCRIPTION repeated)
URL         https://stackoverflow.com/questions/72677445

so basically this is a declarative DSL for expressing dictionaries: the first word in each line is the key, and the rest is the value; key and value are separated by an arbitrary amount of whitespace.

now, i would like these files to gain some basic syntax-highlighting (so that the "key" part is shown differently from the "value" part), mostly for github/gitlab/...

unfortunately I have no idea which "language" i should use.

  • the syntax is so minimal, that autodetection just ends up with "plain text".
  • modern syntax highlighters support a plethora of languages (e.g. linguist lists about 650 different languages), which makes it impractical to try each one.

any ideas how this "language" is called (or which base-language i could abuse for syntax-highlighting)?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文