Docusaurus: How to use remarkable-katex plugin with docusaurus?

Created on 17 Apr 2018  ·  3Comments  ·  Source: facebook/docusaurus

Is this a bug report?

Not sure. Perhaps I don't understand how the plugin service for docusaurus works.

Have you read the Contributing Guidelines on issues?

Yes

Environment

(OS, Node, npm, yarn)

MacOS, Node 8.9.1, NPM 5.6.0

Steps to Reproduce

I am trying to get the remarkable-katex plugin to work in my docusaurus site. I added it to the package. json:

{
  "scripts": {
    "examples": "docusaurus-examples",
    "start": "docusaurus-start",
    "build": "docusaurus-build",
    "publish-gh-pages": "docusaurus-publish",
    "write-translations": "docusaurus-write-translations",
    "version": "docusaurus-version",
    "rename-version": "docusaurus-rename-version"
  },
  "devDependencies": {
    "docusaurus": "^1.0.11",
    "remarkable-katex": "^1.0.1"
  }
}

Then I did an npm install:

~/g/o/d/website (master|●33✚11) $ npm install
npm WARN website No description
npm WARN website No repository field.
npm WARN website No license field.

up to date in 1.327s
~/g/o/d/website (master|●33✚11) $ npm list remarkable-katex
/Users/philipjohnson/github/openpowerquality/docusaurus/website
└── [email protected] 

~/g/o/d/website (master|●33✚11) $ 

Then I tried to run docusaurus:

npm start

Expected Behavior

I expected the system to work.

Actual Behavior

Instead, the npm start command failed with this error:

npm start

> @ start /Users/philipjohnson/github/openpowerquality/docusaurus/website
> docusaurus-start

Starting Docusaurus server on port 3000...
/Users/philipjohnson/github/openpowerquality/docusaurus/website/node_modules/docusaurus/lib/start-server.js:70
        throw ex;
        ^

TypeError: plugin is not a function
    at Remarkable.use (/Users/philipjohnson/github/openpowerquality/docusaurus/website/node_modules/remarkable/lib/index.js:122:3)
    at /Users/philipjohnson/github/openpowerquality/docusaurus/website/node_modules/docusaurus/lib/core/renderMarkdown.js:65:12
    at Array.forEach (<anonymous>)
    at new MarkdownRenderer (/Users/philipjohnson/github/openpowerquality/docusaurus/website/node_modules/docusaurus/lib/core/renderMarkdown.js:64:34)
    at Object.<anonymous> (/Users/philipjohnson/github/openpowerquality/docusaurus/website/node_modules/docusaurus/lib/core/renderMarkdown.js:81:24)
    at Module._compile (module.js:635:30)
    at loader (/Users/philipjohnson/github/openpowerquality/docusaurus/website/node_modules/babel-register/lib/node.js:144:5)
    at Object.require.extensions.(anonymous function) [as .js] (/Users/philipjohnson/github/openpowerquality/docusaurus/website/node_modules/babel-register/lib/node.js:154:7)
    at Module.load (module.js:554:32)
    at tryModuleLoad (module.js:497:12)

Reproducible Demo

(Paste the link to an example repo, including a siteConfig.js, and exact instructions to reproduce the issue.)

https://github.com/openpowerquality/docusaurus/tree/remarkable-katex

Most helpful comment

Wow! Now that's service! Thank you so much for the quick response. Things almost work perfectly now---KaTeX needs the DOCTYPE added to HTML files, but I see that you've just merged #383 yesterday so I will patiently await the next release for perfection.

All 3 comments

Hi @philipmjohnson the markdownPlugins field is supposed to take in an array of functions that receive the remarkable instance as a parameter. Refer to the example config.

I fixed it for you in https://github.com/openpowerquality/docusaurus/pull/1. Have a go at it 😄

Wow! Now that's service! Thank you so much for the quick response. Things almost work perfectly now---KaTeX needs the DOCTYPE added to HTML files, but I see that you've just merged #383 yesterday so I will patiently await the next release for perfection.

@philipmjohnson I should be pushing another release sometime this week, possibly today or tomorrow.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sebqq picture sebqq  ·  3Comments

ericnakagawa picture ericnakagawa  ·  3Comments

muuvmuuv picture muuvmuuv  ·  3Comments

rickyvetter picture rickyvetter  ·  3Comments

ericnakagawa picture ericnakagawa  ·  3Comments