From b094fe1de66cb0124842c667a5cb9bc27b95e844 Mon Sep 17 00:00:00 2001 From: Philip Molares Date: Tue, 6 Oct 2020 14:20:23 +0200 Subject: [PATCH] added js as an extra highlighted language (#646) --- src/components/editor/editor-pane/autocompletion/code-block.ts | 2 +- src/components/editor/editorTestContent.ts | 2 +- .../highlighted-fence/highlighted-code/highlighted-code.tsx | 2 ++ 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/components/editor/editor-pane/autocompletion/code-block.ts b/src/components/editor/editor-pane/autocompletion/code-block.ts index 9c66d4318..987fc51ab 100644 --- a/src/components/editor/editor-pane/autocompletion/code-block.ts +++ b/src/components/editor/editor-pane/autocompletion/code-block.ts @@ -15,7 +15,7 @@ const codeBlockHint = (editor: Editor): Promise< Hints| null > => { } const term = searchResult[1] if (allSupportedLanguages.length === 0) { - allSupportedLanguages = hljs.listLanguages().concat('csv', 'flow', 'html') + allSupportedLanguages = hljs.listLanguages().concat('csv', 'flow', 'html', 'js', 'markmap', 'abc', 'graphviz', 'mermaid', 'vega-lite') } const suggestions = search(term, allSupportedLanguages) const cursor = editor.getCursor() diff --git a/src/components/editor/editorTestContent.ts b/src/components/editor/editorTestContent.ts index f9f8e0b9e..a7c163bab 100644 --- a/src/components/editor/editorTestContent.ts +++ b/src/components/editor/editorTestContent.ts @@ -230,7 +230,7 @@ https://asciinema.org/a/117928 {%pdf https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf %} ## Code highlighting -\`\`\`javascript= +\`\`\`js= var s = "JavaScript syntax highlighting"; alert(s); function $initHighlight(block, cls) { diff --git a/src/components/markdown-renderer/replace-components/highlighted-fence/highlighted-code/highlighted-code.tsx b/src/components/markdown-renderer/replace-components/highlighted-fence/highlighted-code/highlighted-code.tsx index 649b71257..e34457927 100644 --- a/src/components/markdown-renderer/replace-components/highlighted-fence/highlighted-code/highlighted-code.tsx +++ b/src/components/markdown-renderer/replace-components/highlighted-fence/highlighted-code/highlighted-code.tsx @@ -24,6 +24,8 @@ const correctLanguage = (language: string | undefined): string | undefined => { switch (language) { case 'html': return 'xml' + case 'js': + return 'javascript' default: return language }