1
0
mirror of synced 2025-12-20 10:28:40 -05:00

Pretty format (#20352)

* Update prettier flow to include JS

* Run prettier

* ...run prettier
This commit is contained in:
Kevin Heis
2021-07-14 14:35:01 -07:00
committed by GitHub
parent ae3db795f4
commit 8a56437c93
333 changed files with 6904 additions and 5350 deletions

View File

@@ -70,7 +70,7 @@ const LANGUAGE_MAP = {
// Unofficial languages
shellsession: 'Shell',
jsx: 'JSX'
jsx: 'JSX',
}
const COPY_REGEX = /\{:copy\}$/
@@ -78,7 +78,7 @@ const COPY_REGEX = /\{:copy\}$/
/**
* Adds a bar above code blocks that shows the language and a copy button
*/
export default function addCodeHeader (node) {
export default function addCodeHeader(node) {
// Check if the language matches `lang{:copy}`
const hasCopy = node.lang && COPY_REGEX.test(node.lang)
@@ -109,30 +109,24 @@ export default function addCodeHeader (node) {
'p-2',
'text-small',
'rounded-top-1',
'border'
]
'border',
],
},
[
h('span', language),
h(
'button',
{
class: [
'js-btn-copy',
'btn',
'btn-sm',
'tooltipped',
'tooltipped-nw'
],
class: ['js-btn-copy', 'btn', 'btn-sm', 'tooltipped', 'tooltipped-nw'],
'data-clipboard-text': node.value,
'aria-label': 'Copy code to clipboard'
'aria-label': 'Copy code to clipboard',
},
btnIcon
)
),
]
)
return {
before: [header]
before: [header],
}
}