2014-11-21 58 views
1

我想將本地文件作爲代碼片段嵌入到靜態網站中,我使用jade,標記的和用於語法highlighing的代碼鏡像。我會寫一個玉過濾器來做到這一點。代碼鏡像模式,文件擴展名和github風味降價代碼語言的對應關係?

歸結起來,我需要從文件擴展名中提出codemirror模式和github flavored markdown語言(當您執行語言時編寫的語言)。

至少有一些codemirror模式對應於gfm語言。它們都一致嗎? 有沒有一個列表,或名稱的一些理由?

由於

回答

2

mode/meta.js文件CodeMirror的分銷聯營公司名稱與模式(通過CodeMirror.findModeByName功能),如果你得到CodeMirror 4.8版(昨天發佈),該gfm模式將使用此列表嘗試使用正確的模式來聲明語言的圍欄代碼塊。

2

This list從支架與釐米模式文件的擴展名相符。我已經把它變成這樣:

 
{"groovy": "groovy", 
"ini": "properties", 
"properties": "properties", 
"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", 
"twig": "htmlmixed", 
"hbs": "htmlmixed", 
"handlebars": "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", 
"atom": "xml", 
"rdf": "xml", 
"xslt": "xml", 
"xsl": "xml", 
"xul": "xml", 
"xbl": "xml", 
"mathml": "xml", 
"config": "xml", 
"plist": "xml", 
"xaml": "xml", 
"php": "php", 
"php3": "php", 
"php4": "php", 
"php5": "php", 
"phtm": "php", 
"phtml": "php", 
"ctp": "php", 
"c": "clike", 
"h": "clike", 
"i": "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", 
"coffee": "coffeescript", 
"cf": "coffeescript", 
"cson": "coffeescript", 
"_coffee": "coffeescript", 
"clj": "clojure", 
"cljs": "clojure", 
"cljx": "clojure", 
"pl": "perl", 
"pm": "perl", 
"rb": "ruby", 
"ru": "ruby", 
"gemspec": "ruby", 
"rake": "ruby", 
"py": "python", 
"pyw": "python", 
"wsgi": "python", 
"sass": "sass", 
"lua": "lua", 
"sql": "sql", 
"diff": "diff", 
"patch": "diff", 
"md": "markdown", 
"markdown": "markdown", 
"mdown": "markdown", 
"mkdn": "markdown", 
"yaml": "yaml", 
"yml": "yaml", 
"hx": "haxe", 
"sh": "shell", 
"command": "shell", 
"bash": "shell"} 
+0

玉失蹤 – spelufo 2014-11-21 22:22:06