Skip to content

dongkuo/marked-tex-extension

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

marked-tex-extension

A tex extension for markedjs.

Usage

const texExtension = require('../index')
const marked = require('marked')
const katex = require('katex')

function texRender(tex, level) {
  let html = katex.renderToString(tex, {displayMode: level === 'block'})
  if (level === 'block') {
    html = `<p class="block-tex">${html}</p>`
  }
  return html
}

const {blockTexExtension, inlineTexExtension} = texExtension(texRender)
marked.use({
  extensions: [blockTexExtension, inlineTexExtension]
})

let html = marked.parse('your Markdown')
// ...

There is a complete example in test/test.js

About

A tex extension for markedjs

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published