ui: 即时预览astyle-format

This commit is contained in:
undefined committed 2021-04-16 01:22:08 +08:00
1 parent a89d8bfde8
commit 92986442d4
5 files changed
+193 -3

No files matched your search

@@ -110,7 +110,7 @@ const prismjsApiWrap = {
console.log(success.result);
code.original = $code.text();
if (!success) Notification.error('Code format fail');
else $code.text(result.replace(/^#(include|import)[\t ]*(<|")/gm, (match, p1, p2) => `#${p1} ${p2}`));
else $code.text(result);
}
// try to map the language name
const m = language.match(/language-([a-z]+)/);
@@ -123,6 +123,8 @@ const prismjsApiWrap = {
Prism.highlightElement(code);
});
},
highlight: (text, grammar, language) => Prism.highlight(text, grammar, language),
Prism,
};
export default prismjsApiWrap;