代码拉取完成,页面将自动刷新
同步操作将从 ravenq/markdown-it-vue 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
import 'highlight.js/styles/atom-one-light.css'
import hljs from 'highlight.js/lib/core'
import Htmlbars from 'highlight.js/lib/languages/htmlbars'
import Handlebars from 'highlight.js/lib/languages/handlebars'
import Css from 'highlight.js/lib/languages/css'
import Shell from 'highlight.js/lib/languages/shell'
import Bash from 'highlight.js/lib/languages/bash'
import C from 'highlight.js/lib/languages/c'
import Clike from 'highlight.js/lib/languages/c-like'
import Java from 'highlight.js/lib/languages/java'
import Python from 'highlight.js/lib/languages/python'
import Cpp from 'highlight.js/lib/languages/cpp'
import Csharp from 'highlight.js/lib/languages/csharp'
import Php from 'highlight.js/lib/languages/php'
import Sql from 'highlight.js/lib/languages/sql'
import R from 'highlight.js/lib/languages/r'
import Swift from 'highlight.js/lib/languages/swift'
import Go from 'highlight.js/lib/languages/go'
import Matlab from 'highlight.js/lib/languages/matlab'
import Ruby from 'highlight.js/lib/languages/ruby'
import Perl from 'highlight.js/lib/languages/perl'
import Objectivec from 'highlight.js/lib/languages/objectivec'
import Rust from 'highlight.js/lib/languages/rust'
import Dart from 'highlight.js/lib/languages/dart'
import Delphi from 'highlight.js/lib/languages/delphi'
import D from 'highlight.js/lib/languages/d'
import Kotlin from 'highlight.js/lib/languages/kotlin'
import Scala from 'highlight.js/lib/languages/scala'
import Sas from 'highlight.js/lib/languages/sas'
import Lisp from 'highlight.js/lib/languages/lisp'
import Lua from 'highlight.js/lib/languages/lua'
import Ada from 'highlight.js/lib/languages/ada'
import Fortran from 'highlight.js/lib/languages/fortran'
import Powershell from 'highlight.js/lib/languages/powershell'
import Vbscript from 'highlight.js/lib/languages/vbscript'
import VbscriptHtml from 'highlight.js/lib/languages/vbscript-html'
import Groovy from 'highlight.js/lib/languages/groovy'
import Julia from 'highlight.js/lib/languages/julia'
import JuliaRepl from 'highlight.js/lib/languages/julia-repl'
import Haskell from 'highlight.js/lib/languages/haskell'
import Actionscript from 'highlight.js/lib/languages/actionscript'
import Scheme from 'highlight.js/lib/languages/scheme'
import Typescript from 'highlight.js/lib/languages/typescript'
import Fsharp from 'highlight.js/lib/languages/fsharp'
import Prolog from 'highlight.js/lib/languages/prolog'
import Erlang from 'highlight.js/lib/languages/erlang'
import ErlangRepl from 'highlight.js/lib/languages/erlang-repl'
import Json from 'highlight.js/lib/languages/json'
import Ini from 'highlight.js/lib/languages/ini'
hljs.registerLanguage('json', Json)
hljs.registerLanguage('ini', Ini)
hljs.registerLanguage('handlebars', Handlebars)
hljs.registerLanguage('htmlbars', Htmlbars)
hljs.registerLanguage('css', Css)
hljs.registerLanguage('shell', Shell)
hljs.registerLanguage('bash', Bash)
hljs.registerLanguage('c-like', Clike)
hljs.registerLanguage('c', C)
hljs.registerLanguage('cpp', Cpp)
hljs.registerLanguage('java', Java)
hljs.registerLanguage('python', Python)
hljs.registerLanguage('csharp', Csharp)
hljs.registerLanguage('php', Php)
hljs.registerLanguage('sql', Sql)
hljs.registerLanguage('r', R)
hljs.registerLanguage('swift', Swift)
hljs.registerLanguage('go', Go)
hljs.registerLanguage('matlab', Matlab)
hljs.registerLanguage('ruby', Ruby)
hljs.registerLanguage('perl', Perl)
hljs.registerLanguage('objectivec', Objectivec)
hljs.registerLanguage('rust', Rust)
hljs.registerLanguage('dart', Dart)
hljs.registerLanguage('delphi', Delphi)
hljs.registerLanguage('d', D)
hljs.registerLanguage('kotlin', Kotlin)
hljs.registerLanguage('scala', Scala)
hljs.registerLanguage('sas', Sas)
hljs.registerLanguage('lisp', Lisp)
hljs.registerLanguage('lua', Lua)
hljs.registerLanguage('ada', Ada)
hljs.registerLanguage('fortran', Fortran)
hljs.registerLanguage('powershell', Powershell)
hljs.registerLanguage('vbscript', Vbscript)
hljs.registerLanguage('vbscript-html', VbscriptHtml)
hljs.registerLanguage('groovy', Groovy)
hljs.registerLanguage('julia', Julia)
hljs.registerLanguage('julia-repl', JuliaRepl)
hljs.registerLanguage('haskell', Haskell)
hljs.registerLanguage('actionscript', Actionscript)
hljs.registerLanguage('scheme', Scheme)
hljs.registerLanguage('typescript', Typescript)
hljs.registerLanguage('fsharp', Fsharp)
hljs.registerLanguage('prolog', Prolog)
hljs.registerLanguage('erlang', Erlang)
hljs.registerLanguage('erlang-repl', ErlangRepl)
const highlightPlugin = md => {
md.renderer.rules.fence = (tokens, idx) => {
const token = tokens[idx]
const code = token.content.trim()
const lang = token.info
const langObj = hljs.getLanguage(lang)
let cnt
if (langObj) {
cnt = hljs.highlight(lang, code).value
} else {
cnt = hljs.highlightAuto(code).value
}
return `<pre><code class="hljs">${cnt}</code></pre>`
}
}
export default highlightPlugin
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。