Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
md.parse = (markdown: string, env: any) => {
// Generate tokens by Marp if enabled
if (detectMarpFromMarkdown(markdown)) {
const mdFolder = Uri.parse(md.normalizeLink('.')).with({ scheme: 'file' })
const workspaceFolder = workspace.getWorkspaceFolder(mdFolder)
const baseFolder = workspaceFolder ? workspaceFolder.uri : mdFolder
const marp = new Marp(marpCoreOptionForPreview(md.options))
.use(customTheme)
.use(outline)
.use(lineNumber)
// Load custom themes
let shouldRefresh = false
Promise.all(
themes.loadStyles(baseFolder).map(promise =>
promise
.then(theme => {
if (theme.registered) shouldRefresh = true
})
.catch(e => console.error(e))
)
).then(() => {
module.exports = opts => {
return new Marp(opts)
.use(markdownItMark)
// .use(markdownItFootnote)
.use(markdownItAbbr)
.use(markdownItSup)
.use(markdownItSub)
.use(markdownItEmoji)
.use(html5Media)
.use(markdownItContainer, 'note');
}
export const Marp = props => {
const marp = new MarpCore({
container: null,
script: false,
printable: false,
})
marp.markdown.normalizeLink = url => resolvePath(url)
const rendered = marp.render(props.markdown, { htmlAsArray: true })
return (
<div>
</div>