Socket
Socket
Sign inDemoInstall

markdown-model

Package Overview
Dependencies
1
Maintainers
1
Versions
77
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    markdown-model

Markdown object model, parser, and renderer


Version published
Weekly downloads
37
decreased by-53.75%
Maintainers
1
Install size
121 kB
Created
Weekly downloads
 

Readme

Source

markdown-model

npm GitHub

The markdown-model package is a JavaScript Markdown parser and renderer.

Parsing Markdown

To parse a Markdown document, use the parseMarkdown function:

import {parseMarkdown} from 'markdown-model/lib/parser.js';

const markdownModel = parseMarkdown(markdownText);

Note: Markdown documents are parsed as GitHub Flavored Markdown (with the exception of HTML blocks).

Rendering Markdown

To render the parsed Markdown in a web browser, use the markdownElements function with the renderElements function from the element-model package:

import {markdownElements} from 'markdown-model/lib/elements.js';
import {renderElements} from 'element-model/lib/elementModel.js';

renderElements(document.body, markdownElements(markdownModel));

Computing the Markdown Title

To compute the title of the parsed Markdown, use the getMarkdownTitle function:

import {getMarkdownTitle} from 'markdown-model/lib/parser.js';

const markdownTitle = getMarkdownTitle(markdownModel);

Development

This package is developed using javascript-build. It was started using javascript-template as follows:

template-specialize javascript-template/template/ markdown-model/ -k package markdown-model -k name 'Craig A. Hobbs' -k email 'craigahobbs@gmail.com' -k github 'craigahobbs' -k noapp 1

Keywords

FAQs

Last updated on 20 Mar 2024

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc