editor: Fix in-browser prettification of html files.
This commit is contained in:
parent
9758844da3
commit
8273277c91
@ -1782,10 +1782,11 @@ async function sourcePretty() {
|
|||||||
let prettier = (await import('/prettier/standalone.mjs')).default;
|
let prettier = (await import('/prettier/standalone.mjs')).default;
|
||||||
let babel = (await import('/prettier/babel.mjs')).default;
|
let babel = (await import('/prettier/babel.mjs')).default;
|
||||||
let estree = (await import('/prettier/estree.mjs')).default;
|
let estree = (await import('/prettier/estree.mjs')).default;
|
||||||
|
let prettier_html = (await import('/prettier/html.mjs')).default;
|
||||||
let source = gEditor.state.doc.toString();
|
let source = gEditor.state.doc.toString();
|
||||||
let formatted = await prettier.format(source, {
|
let formatted = await prettier.format(source, {
|
||||||
parser: 'babel',
|
parser: gCurrentFile?.toLowerCase()?.endsWith('.html') ? 'html' : 'babel',
|
||||||
plugins: [babel, estree],
|
plugins: [babel, estree, prettier_html],
|
||||||
trailingComma: 'es5',
|
trailingComma: 'es5',
|
||||||
useTabs: true,
|
useTabs: true,
|
||||||
semi: true,
|
semi: true,
|
||||||
|
Loading…
Reference in New Issue
Block a user