Dynamic SMILES rendering in the browser
Try editing the markdown content and rendering options below to see client-side rendering in action:
// Client-side rendering (default)
const md = markdownit().use(MarkdownItSmiles, {
renderAtParse: false,
smilesDrawerOptions: {
default: {
width: 400,
height: 300,
theme: 'light'
}
}
})
// Update content dynamically
function updateContent(newMarkdown) {
const html = md.render(newMarkdown)
document.getElementById('content').innerHTML = html
// Re-apply smiles-drawer to new content
if (window.SmiDrawer) {
SmiDrawer.apply()
}
}
const md = markdownit().use(MarkdownItSmiles, {
renderAtParse: false,
smilesDrawerOptions: {
default: {
width: 500,
height: 400,
bondThickness: 1.2,
theme: 'dark'
},
inline: {
width: 60,
height: 60,
bondThickness: 0.8
},
block: {
width: 600,
height: 500,
padding: 30
}
}
})