Update to support go in code block syntax highlighting

This commit is contained in:
Wu Cheng-Han 2016-11-26 22:48:20 +08:00
parent 79d5b2c37f
commit b43e63dd21
4 changed files with 9 additions and 7 deletions

View file

@ -3,6 +3,7 @@ require('prismjs/themes/prism.css');
var Prism = require('prismjs'); var Prism = require('prismjs');
require('prismjs/components/prism-wiki'); require('prismjs/components/prism-wiki');
require('prismjs/components/prism-haskell'); require('prismjs/components/prism-haskell');
require('prismjs/components/prism-go');
var hljs = require('highlight.js'); var hljs = require('highlight.js');
var PDFObject = require('pdfobject'); var PDFObject = require('pdfobject');
var S = require('string'); var S = require('string');
@ -474,10 +475,10 @@ function finishView(view) {
var result = { var result = {
value: code value: code
}; };
} else if (reallang == "haskell") { } else if (reallang == "haskell" || reallang == "go") {
code = S(code).unescapeHTML().s; code = S(code).unescapeHTML().s;
var result = { var result = {
value: Prism.highlight(code, Prism.languages.haskell) value: Prism.highlight(code, Prism.languages[reallang])
}; };
} else if (reallang == "tiddlywiki" || reallang == "mediawiki") { } else if (reallang == "tiddlywiki" || reallang == "mediawiki") {
code = S(code).unescapeHTML().s; code = S(code).unescapeHTML().s;

View file

@ -213,7 +213,7 @@ var cursorMenuThrottle = 50;
var cursorActivityDebounce = 50; var cursorActivityDebounce = 50;
var cursorAnimatePeriod = 100; var cursorAnimatePeriod = 100;
var supportContainers = ['success', 'info', 'warning', 'danger']; var supportContainers = ['success', 'info', 'warning', 'danger'];
var supportCodeModes = ['javascript', 'htmlmixed', 'htmlembedded', 'css', 'xml', 'clike', 'clojure', 'ruby', 'python', 'shell', 'php', 'sql', 'haskell', 'coffeescript', 'yaml', 'pug', 'lua', 'cmake', 'nginx', 'perl', 'sass', 'r', 'dockerfile', 'tiddlywiki', 'mediawiki']; var supportCodeModes = ['javascript', 'htmlmixed', 'htmlembedded', 'css', 'xml', 'clike', 'clojure', 'ruby', 'python', 'shell', 'php', 'sql', 'haskell', 'coffeescript', 'yaml', 'pug', 'lua', 'cmake', 'nginx', 'perl', 'sass', 'r', 'dockerfile', 'tiddlywiki', 'mediawiki', 'go'];
var supportCharts = ['sequence', 'flow', 'graphviz', 'mermaid']; var supportCharts = ['sequence', 'flow', 'graphviz', 'mermaid'];
var supportHeaders = [ var supportHeaders = [
{ {

File diff suppressed because one or more lines are too long

View file

@ -56,6 +56,7 @@ mode/r/r.js \
mode/dockerfile/dockerfile.js \ mode/dockerfile/dockerfile.js \
mode/tiddlywiki/tiddlywiki.js \ mode/tiddlywiki/tiddlywiki.js \
mode/mediawiki/mediawiki.js \ mode/mediawiki/mediawiki.js \
mode/go/go.js \
keymap/emacs.js \ keymap/emacs.js \
keymap/sublime.js \ keymap/sublime.js \
keymap/vim.js keymap/vim.js