docs(ComponentCard): show all props for the code (#797)

Co-authored-by: Benjamin Canac <canacb1@gmail.com>
This commit is contained in:
KeJun
2023-10-15 23:52:20 +08:00
committed by GitHub
parent 9f4d88e0aa
commit 8867936e01
16 changed files with 157 additions and 99 deletions

29
docs/workers/prettier.js Normal file
View File

@@ -0,0 +1,29 @@
/* eslint-disable no-undef */
import('https://unpkg.com/prettier@3.0.3/standalone.js')
import('https://unpkg.com/prettier@3.0.3/plugins/html.js')
import('https://unpkg.com/prettier@3.0.3/plugins/markdown.js')
self.onmessage = async function (event) {
self.postMessage({
uid: event.data.uid,
message: await handleMessage(event.data.message)
})
}
function handleMessage (message) {
switch (message.type) {
case 'format':
return handleFormatMessage(message)
}
}
async function handleFormatMessage (message) {
const { options, source } = message
const formatted = await prettier.format(source, {
parser: 'markdown',
plugins: prettierPlugins,
...options
})
return formatted
}