UNPKG

html-from-md

Version:

A simple TypeScript library that formats Markdown and returns a formatted HTML.

31 lines (22 loc) 1.09 kB
# html-from-md A simple TypeScript library that formats Markdown and returns a formatted HTML. ## Usage `const { html, links } = formatMarkdown(mdFile)` | Option | Description |--------------------------------------------------------------|--------------------------------------------------- | `formatMarkdown(mdFile, { keepSections: ["Features"] })` | keeps only specified section | `formatMarkdown(mdFile, { excludeSections: ["License"] })` | excludes a section | `formatMarkdown(mdFile, { gfm: true })` | applies GitHub-Flavored Markdown | `formatMarkdown(mdFile, { useImgAltText: true })` | replaces images with alt text | `formatMarkdown(mdFile, { maxChars: 50 })` | truncates output when maxChars is set | `formatMarkdown(mdFile, { removeImages: true })` | removes images ## Installation ```shell $ npm install html-from-md ``` ## Contributing 1. Fork this repo 2. Create a feature branch 3. Commit your changes 4. Push to the branch 5. Open a Pull Request