github-style-markdown

1.4.0 • Public • Published

github-style-markdown

  • An NPM library that handles GitHub markdown-style text.
  • Remember that you have to write your own CSS stylesheet to imitate the below screenshot's aesthetics.
  • A replacement for react-markdown package.

npm version

markdown-screenshot


Installing

  • Using NPM: npm install github-style-markdown
  • Using Yarn: yarn install github-style-markdown

Usage

  • In React, you can call it by
import React from 'react';
import parseMarkdown from 'github-style-markdown';

const MyComponent = () => {
  const markdownText = `
  # Hello, world!
  This is **bold** and this is *italic*.
  > This is a quote.
  `;

  const htmlText = parseMarkdown(markdownText);

  return (
    <div dangerouslySetInnerHTML={{ __html: htmlText }} />
  );
};

export default MyComponent;
  • In Vanilla JS, call it by
const parseMarkdown = require('github-style-markdown');

const markdownText = `
# Hello, world!
This is **bold** and this is *italic*.
> This is a quote.
`;

const htmlText = parseMarkdown(markdownText);

console.log(htmlText);

Package Sidebar

Install

npm i github-style-markdown

Weekly Downloads

0

Version

1.4.0

License

MIT

Unpacked Size

3.95 kB

Total Files

4

Last publish

Collaborators

  • wonmor