An open API service indexing awesome lists of open source software.

https://github.com/hougesen/mrkdwny

Markdown to HTML parser
https://github.com/hougesen/mrkdwny

markdown markdown-parser markdown-to-html

Last synced: about 2 months ago
JSON representation

Markdown to HTML parser

Awesome Lists containing this project

README

        

# mrkdwny

Parser for turning markdown into HTML.

[![ci](https://github.com/hougesen/mrkdwny/workflows/ci/badge.svg)](https://github.com/hougesen/mrkdwny/actions/workflows/ci.yml)
[![npm-publish](https://github.com/hougesen/mrkdwny/workflows/npm-publish/badge.svg)](https://github.com/hougesen/mrkdwny/actions/workflows/npm-publish.yml)
[![npm version](https://badge.fury.io/js/mrkdwny.svg)](https://badge.fury.io/js/mrkdwny)

## Install

```sh
npm i mrkdwny
```

## Usage

```ts
import { parseMarkdown } from 'mrkdwny';
// or the following if you are using mjs/ts
const parseMarkdown = require('mrkdwny').parseMarkdown;

const dummyMarkdown = `
---
title: markdown-example
---

# This is a h1 heading

## This is a h2 heading

### This is a h3 heading

#### This is a h4 heading

##### This is a h5 heading

###### This is a h6 heading

This is a paragraph

[this is a link](https://mhouge.dk)

this is a paragraph with a link inside [link](https://google.com) :D

![this is the alt tag](https://mhouge.dk/logo.png)

`;

const result = parseMarkdown(fileContent);

console.log(result.metadata);
// { title: 'markdown-example' }

console.log(result.html);
//

This is a h1 heading


//

This is a h2 heading


//

This is a h3 heading


//

This is a h4 heading


//
This is a h5 heading

//
This is a h6 heading

//

This is a paragraph


//

this is a link


//

this is a paragraph with a link inside link :D


// this is the alt tag
```