2021-07-27 22:43:40 +00:00
|
|
|
import md from '@hashicorp/platform-markdown-utils/markdown-to-html'
|
|
|
|
import mdInline from '@hashicorp/platform-markdown-utils/markdown-to-inline-html'
|
2021-02-11 21:29:38 +00:00
|
|
|
|
|
|
|
export default async function processBeforeAfterDiagramProps(props) {
|
|
|
|
const { beforeHeadline, beforeContent, afterHeadline, afterContent } = props
|
|
|
|
// Transform headline markdown to HTML, for inline bold / italic support
|
|
|
|
props.beforeHeadline = await mdInline(beforeHeadline)
|
|
|
|
props.afterHeadline = await mdInline(afterHeadline)
|
|
|
|
// Transform content markdown to HTML, using custom type classes
|
|
|
|
const contentOptions = {
|
|
|
|
contentPlugins: {
|
|
|
|
pluginOptions: {
|
|
|
|
typography: {
|
|
|
|
map: {
|
|
|
|
h1: 'g-type-label',
|
|
|
|
h2: 'g-type-label',
|
|
|
|
h3: 'g-type-label',
|
|
|
|
h4: 'g-type-label',
|
|
|
|
h5: 'g-type-label',
|
|
|
|
h6: 'g-type-label',
|
|
|
|
p: 'g-type-body-small',
|
|
|
|
li: 'g-type-body-small',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
props.beforeContent = await md(beforeContent, contentOptions)
|
|
|
|
props.afterContent = await md(afterContent, contentOptions)
|
|
|
|
return props
|
|
|
|
}
|