ReadMe's flavored Markdown parser and MDX rendering engine.
npm install --save @readme/markdown
import React from 'react';
import rmdx from '@readme/markdown';
export default ({ body }) => <div className="markdown-body">{run(compile(body))}</div>;Compiles mdx to js. A wrapper around mdx.compile
You usually only need this when calling run as well. It's been left as a seperate step as a potential caching opportunity.
string(string) -- An mdx documentopts(CompileOpts, optional) -- configuration
compiled code (string)
Run compiled code. A wrapper around mdx.run
Caution
This eval's JavaScript.
string(string) -- A compiled mdx documentopts(RunOpts, optional) -- configuration
A module (RMDXModule) of renderable components
Compiles an ast to mdx.
Parses mdx to an mdast.
Parses mdx to an hast.
Note
unimplemented
Additional defaults, helpers, components, etc.
Extends CompileOptions
lazyImages(boolean, optional) -- Load images lazily.safeMode(boolean, optional) -- Extract script tags fromHTMLBlockscomponents(Record<string, string>, optional) -- An object of tag names to mdx.copyButtons(Boolean, optional) — Automatically insert a button to copy a block of text to the clipboard. Currently used on<code>elements.
Extends RunOptions
components(Record<string, MDXModule>, optional) -- An object of tag names to executed components.imports(Record<string, unknown>, optional) -- An object of modules to import.terms(GlossaryTerm[], optional)variables(Variables, optional) -- An object containing [user variables}(https://github.com/readmeio/variable).
default(() => MDXContent) -- The mdx douments default exporttoc(HastHeading[]) -- A list of headings in the documentToc(() => MDCContent) -- A table of contents component
Our old editor rendered "Magic Block" components from a custom, JSON-based syntax. To provide seamless backwards-compatibility, our new processor ships with built in support for parsing this old format, and transpiles it straight in to our new, flavored Markdown.
We've also sprinkled a bit of our own syntactic sugar on top to let you supercharge your docs. Learn more about ReadMe's flavored syntax!
To make changes to the RDMD engine locally, run the local development server. Clone the repo, cd in to it, npm install, and npm run start!
Running the browser tests requires docker. Follow the docker install instructions for mac. You may want to increase the memory usage. If you have not already, you'll need to create an account for docker hub and sign-in locally.
If you make changes to the docs or how the markdown is rendered, you may need to update the visual regression snapshots. You can run the visual regression tests in a docker container with:
make updateSnapshot
- License: MIT
- Authors: Dom Harrington, Rafe Goldberg
