remark.js 613 B

12345678910111213141516171819202122232425
  1. md.remark = {
  2. defaults: {
  3. gfm: true,
  4. yaml: true,
  5. commonmark: false,
  6. footnotes: false,
  7. pedantic: false,
  8. breaks: false,
  9. sanitize: false
  10. // blocks (Array.<string>, default: list of block HTML elements)
  11. },
  12. compile: (markdown, sendResponse) => {
  13. chrome.storage.sync.get('remark', (res) => {
  14. var html = remark.unified()
  15. .use(remark.parse, res.remark)
  16. .use(remark.stringify)
  17. .use(remarkSlug)
  18. .use(remarkHTML, res.remark) // sanitize
  19. .processSync(markdown)
  20. .contents
  21. sendResponse({message: 'html', html})
  22. })
  23. }
  24. }