markup-it
is a JavaScript library to serialize/deserialize markdown content using an intermediate format backed by an immutable model.
$ npm i markup-it --save
const { State } = require('markup-it');
const markdown = require('markup-it/lib/markdown');
const state = State.create(markdown);
const document = state.deserializeToDocument('Hello **World**');
const { State } = require('markup-it');
const html = require('markup-it/lib/html');
const state = State.create(html);
const str = state.serializeDocument(document);
const { State } = require('markup-it');
const markdown = require('markup-it/lib/markdown');
const state = State.create(markdown);
const str = state.serializeDocument(document);