NakoBase Logo
NPM Package

A npm package to convert Markdown to HTML

Published At
Updated At
#Markdown#HTML#React#npm
A npm package to convert Markdown to HTML

Overview

Github repository: https://github.com/nakobase/nakobase-md-html

I have created an npm package to convert Markdown to HTML.

There are many packages already, but the following are the features of this
package.

  • Basic markdown support
  • Code highlight support
  • Import styles to use them as is
    • Supports multiple box and heading styles

Usage

Installation

# npm
npm install @nakobase/nakobase-md-html

# yarn
yarn add @nakobase/nakobase-md-html

# pnpm
pnpm add @nakobase/nakobase-md-html

Basic Usage

import { mdToHtml } from '@nakobase/nakobase-md-html';

const html = mdToHtml(
  `
# Hello World

This is a test of the markdown to html converter.
`,
  { codeHighlight: true },
); // codeHighlight is optional, default is false

console.log(html);

Add .nbcontents to the container of the markdown.

<div class="nbcontent">
  <!-- HTML parsed from markdown -->
</div>

Styles

import '@nakobase/nakobase-md-html/styles/style.css';

import 'prismjs/themes/prism-okaidia.css'; // Import any prism theme if you want

Future

I will continue to develop and add more custom blocks and styles.