@hashicorp/platform-markdown-utils

0.3.2 • Public • Published

@hashicorp/platform-markdown-utils

Shared utilities for rendering markdown content across our marketing properties

markdownDefaults

Returns an object containing rehypePlugins and remarkPlugins, with our default plugins used for rendering markdown content.

import markdownDefaults from '@hashicorp/platform-markdown-utils'

const defaults = markdownDefaults({
  // Additional rehype or remark plugins
  addRehypePlugins?: []Plugin,
  addRemarkPlugins?: []Plugin,
  // options passed to remark plugins, example shown below
  // see https://github.com/hashicorp/remark-plugins for more info
  pluginOptions?: PluginOptions,
  // passes the value to `resolveFrom` include-markdown plugin
  // https://github.com/hashicorp/remark-plugins/blob/master/plugins/include-markdown/README.md#options
  resolveIncludes?: String,
  // enables math function processing via https://github.com/remarkjs/remark-math
  enableMath?: Boolean

})

markdownToHtml

Converts a markdown string into HTML.

import markdownToHtml from '@hashicorp/platform-markdown-utils/markdown-to-html'

const html = markdownToHtml('# Hello world!')

markdownToInlineHtml

Converts a markdown string into inline HTML.

import markdownToInlineHtml from '@hashicorp/platform-markdown-utils/markdown-to-inline-html'

const html = markdownToInlineHtml('Some inline *markdown* to _test_.')

Readme

Keywords

none

Package Sidebar

Install

npm i @hashicorp/platform-markdown-utils

Weekly Downloads

3,396

Version

0.3.2

License

MPL-2.0

Unpacked Size

19.5 kB

Total Files

9

Last publish

Collaborators

  • abhishek-hashicorp
  • dstaley
  • cameronperera
  • alexju
  • consul-ui-services
  • wenincode-hashicorp
  • hashicb
  • britt.lindgren
  • paulhcp
  • nandereck
  • tstormk
  • hashibot-hds
  • lackeyjb1
  • youriwims
  • jpogran
  • _natmegs
  • thrashr888
  • melsumner
  • mwickett
  • didoo
  • zchsh
  • hcitsec
  • gregone
  • meirish
  • enmod
  • kaxcode
  • anubhavmishra-hashicorp
  • hashibot-web
  • cstitt-hashi
  • kstraut
  • mocohen
  • dhaulagiri