feat(org): Ported components to mjs and named exports
This commit is contained in:
parent
37f7833983
commit
595417a23b
118 changed files with 836 additions and 852 deletions
13
sites/shared/components/yaml.mjs
Normal file
13
sites/shared/components/yaml.mjs
Normal file
|
@ -0,0 +1,13 @@
|
|||
import React from 'react'
|
||||
import Highlight from 'shared/components/mdx/highlight.js'
|
||||
import hljs from 'highlight.js/lib/common'
|
||||
import yaml from 'js-yaml'
|
||||
|
||||
export const Yaml = (props) => {
|
||||
let code
|
||||
if (props.json) code = yaml.dump(JSON.parse(props.json))
|
||||
else if (props.js) code = yaml.dump(props.js)
|
||||
else code = props.children
|
||||
|
||||
return <Highlight language="yaml" raw={hljs.highlight(code, { language: 'yaml' }).value} />
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue