Markdown Previewer

Loading...

A demo of πŸš€ Markdown Previewer

πŸ‘‰ Changes are re - rendered as you type.

πŸ‘ˆ Try writing some markdown on the left.

Table of contents

Syntax highlighting πŸ’„

Here is an example of a plugin to highlight code: rehype-highlight.

import React from 'react' import ReactDOM from 'react - dom' import ReactMarkdown from 'react - markdown' import rehypeHighlight from 'rehype - highlight' ReactDOM.render( <ReactMarkdown rehypePlugins={[rehypeHighlight]}>{'# Your markdown here'}</ReactMarkdown>, document.querySelector('#content') )

Pretty neat, eh? 😁



Mermaid Support in πŸ€– markdown



Mathematics βž•βž–βž— Katex Equations

Fβƒ—2=KQ1Q2∣Rβƒ—12∣2aβƒ—12=KQ1Q2∣Rβƒ—12∣3Rβƒ—12\vec{F}_{2}={K{\frac{Q_1Q_2}{|\vec{R}_{12}|^2}}\vec{a}_{12}}={K{\frac{Q_1Q_2}{|\vec{R}_{12}|^3}}\vec{R}_{12}}

GitHub flavored markdown πŸ‘οΈ (GFM)

For GFM, you can also use a plugin: remark-gfm. It adds support for GitHub-specific extensions to the language: tables, strikethrough, tasklists, and literal URLs.

These features do not work by default. πŸ™Œ used remarkGfm plugin.

FeatureSupport
CommonMark100%
GFM100% w/ remark-gfm

  • task list
  • strikethrough
  • checked item
  • GFM
  • I just love bold text
  • Italicized text is the cat's meow.
  • This text is really important.
  • H2O X2
  • http://www.example.com
  • http://www.example.com

The quarterly results look great!

  • Revenue was off the chart.

  • Profits were higher than ever.

Everything is going according to plan.


HTML in markdown

⚠️ HTML in markdown is quite unsafe, but if you want to support it, you can use rehype-raw. I have used to create fully custom component & sanitized with rehype-sanitize You should probably combine it with rehype-sanitize.

πŸ‘† Use the toggle above to add the plugin.

Components Mapping & Fully Custom Component

You can pass components to change things:

import React from 'react' import ReactDOM from 'react - dom' import ReactMarkdown from 'react - markdown' import MyFancyRule from './ components / my - fancy - rule.js' ReactDOM.render( <ReactMarkdown components={{ // Use h2s instead of h1s h1: 'h2', // Use a component instead of hrs hr: ({node, ...props}) => <MyFancyRule {...props} /> }} > # Your markdown here </ReactMarkdown>, document.querySelector('#content') )

Want Code ?

readme on GitHubπŸ™„!


Made with ❀️ by Akash πŸ€“βœŒοΈ.