1.0.1 • Published 5 months ago

@nakobase/nakobase-md-html v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
5 months ago

@nakobase/nakobase-md-html

Convert Markdown to sanitized HTML and apply consistent styles – simple, secure, and styled.

Installation

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

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

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

Usage

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);

Styles

We have some default styles that are applied to the HTML.

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

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

Add .nbcontents to the container of the markdown.

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