我想将本地文件作为代码片段嵌入到我用玉制作的静态网站中,标记和代码镜像以进行语法高亮。我会写一个翡翠过滤器来做到这一点。
它归结为我需要从文件扩展名中提出codemirror模式和github风格的markdown语言(你在做语言时写的东西)。
至少一些代码镜像模式对应于 gfm 语言。它们都重合吗?某处是否有列表,或者名称的一些理由?
谢谢
我想将本地文件作为代码片段嵌入到我用玉制作的静态网站中,标记和代码镜像以进行语法高亮。我会写一个翡翠过滤器来做到这一点。
它归结为我需要从文件扩展名中提出codemirror模式和github风格的markdown语言(你在做语言时写的东西)。
至少一些代码镜像模式对应于 gfm 语言。它们都重合吗?某处是否有列表,或者名称的一些理由?
谢谢
mode/meta.js
CodeMirror 发行版中的文件将名称与模式相关联(通过CodeMirror.findModeByName
函数),如果您获得 CodeMirror 4.8 版(昨天发布),该gfm
模式将使用此列表尝试为声明语言的受保护代码块使用正确的模式。
括号中的这个列表匹配带有 cm 模式的文件扩展名。我把它变成了这样:
{“常规”:“常规”, “ini”:“属性”, “属性”:“属性”, “css”:“css”, “scss”:“css”, "html": "htmlmixed", "htm": "htmlmixed", "shtm": "htmlmixed", "shtml": "htmlmixed", "xhtml": "htmlmixed", "cfm": "htmlmixed", "cfml": "htmlmixed", "cfc": "htmlmixed", "dhtml": "htmlmixed", "xht": "htmlmixed", "tpl": "htmlmixed", “树枝”:“htmlmixed”, "hbs": "htmlmixed", “车把”:“htmlmixed”, "kit": "htmlmixed", "jsp": "htmlmixed", "aspx": "htmlmixed", "ascx": "htmlmixed", "asp": "htmlmixed", "master": "htmlmixed", "cshtml": "htmlmixed", "vbhtml": "htmlmixed", "ejs": "htmlembedded", "dust": "htmlembedded", "erb": "htmlembedded", “js”:“javascript”, "jsx": "javascript", "jsm": "javascript", "_js": "javascript", "vbs": "vbscript", “vb”:“vb”, “json”:“javascript”, "xml": "xml", "svg": "xml", "wxs": "xml", "wxl": "xml", "wsdl": "xml", “rss”:“xml”, “原子”:“xml”, “rdf”:“xml”, "xslt": "xml", "xsl": "xml", “xul”:“xml”, "xbl": "xml", “数学”:“xml”, “配置”:“xml”, “plist”:“xml”, "xaml": "xml", "php": "php", "php3": "php", "php4": "php", "php5": "php", “phtm”:“php”, "phtml": "php", "ctp": "php", "c": "clike", "h": "clike", “我”:“喜欢”, "cc": "clike", "cp": "clike", "cpp": "clike", "c++": "clike", "cxx": "clike", "hh": "clike", "hpp": "clike", "hxx": "clike", "h++": "clike", "ii": "clike", “ino”:“clike”, "cs": "clike", “asax”:“clike”, “ashx”:“clike”, “java”:“clike”, “scala”:“clike”, "sbt": "clike", “咖啡”:“咖啡脚本”, "cf": "coffeescript", “cson”:“咖啡脚本”, "_coffee": "coffeescript", "clj": "clojure", “cljs”:“clojure”, “cljx”:“clojure”, “pl”:“perl”, "pm": "perl", "rb": "红宝石", "ru": "红宝石", “gemspec”:“红宝石”, “耙子”:“红宝石”, “py”:“蟒蛇”, “pyw”:“蟒蛇”, “wsgi”:“蟒蛇”, “萨斯”:“萨斯”, “卢亚”:“卢亚”, "sql": "sql", “差异”:“差异”, “补丁”:“差异”, “md”:“降价”, “降价”:“降价”, “mdown”:“降价”, “mkdn”:“降价”, “yaml”:“yaml”, “yml”:“yaml”, “hx”:“haxe”, “sh”:“壳”, “命令”:“外壳”, “bash”:“外壳”}