Markdown Extensions Not Working in TiddlyWiki Startup

I’m not sure module-type value “startup” is correct on this file. Initially, I made modifications directly in the markdown plugins’s wrapper.js file; Now, I’m trying to separate it to single plugin, but after TiddlyWiki starts, the extensions don’t seem to work. Each Markdown-type tiddler requires entering edit mode and making a change (possibly triggering the parser’s rendering) before the Markdown plugin extensions start work;

/*\
title: $:/plugins/oeyoews/neotw-markdown-extensions/extensions.js
type: application/javascript
module-type: startup

Extension markdown-it

\*/
(function () {
  /*jslint node: true, browser: true */
  /*global $tw: false */
  "use strict";

  function LoadExtensions() {
    const md = $tw.Wiki.parsers["text/markdown"].prototype.md;
    const emoji = require("./markdown-it-emoji");
    const toc = require("./markdown-it-toc");
    const task = require("./markdown-it-task");
    md.use(emoji).use(toc).use(task);
  }

  exports.name = "markdown-extension-startup-hook";
  exports.platforms = ["browser"];
  exports.after = ["load-modules"];
  exports.synchronous = true;
  exports.startup = LoadExtensions;
})();

This is a discussion related to github discussions

1 Like

IMO md-plugins have module-type: library … Did you try that?

I set it up at the beginning, so it shouldn’t be the problem

1 Like

But your header says: module-type: startup. … TW uses the /*\ as an indicator to read the following text as tiddler fields. … So IMO it uses module-type: startup and not library.

maybe you need to add

exports.before = ["startup"];

MarkdownExtensions Currently supports TOC, Task, Container, Abbr, Emoji five extensions

1 Like

Recommended to use



GitHub - cdruan/tw-markdown-more: Extends TiddlyWiki Markdown plugin

1 Like