5/1/2017 - 2:59 PM

Use Marked for TiddlyWiki. Originally fork from

Use Marked for TiddlyWiki. Originally fork from

Use marked instead of markdown-js for Markdown parser of TiddlyWiki 5. Originally fork from

Main New Features

  • support fenced code block
  • support code highlighting


  1. Install the official Markdown and Hightlight.js plugin.

  2. Replace markdown.js with content of

  3. Replace wrapper.js with

title: $:/plugins/tiddlywiki/markdown/wrapper.js
type: application/javascript
module-type: parser

Wraps up the marked parser for use in TiddlyWiki5
Originally fork from


/*jslint node: true, browser: true */
/*global $tw: false */
"use strict";

var hljs = require("$:/plugins/tiddlywiki/highlight/highlight.js");
var marked = require("$:/plugins/tiddlywiki/markdown/markdown.js");

var HighLighter = function(str, lang) {
  try {
    if (lang && hljs.getLanguage(lang))
      return hljs.highlight(lang, str).value;
      return hljs.highlightAuto(str).value;
  } catch (err) {
    return '';

  highlight: HighLighter,
  renderer: new marked.Renderer(),
  gfm: true,
  tables: true,
  breaks: true,
  pedantic: false,
  sanitize: false,
  smartLists: true,
  smartypants: false

var MarkdownParser = function(type, text, options) {
  this.tree = [{type: "raw", html: marked(text)}];

exports["text/x-markdown"] = MarkdownParser;

  • Done