0.1.5 ā€¢ Published 1 year ago

extra-markdown-text v0.1.5

Weekly downloads
-
License
BSD-3-Clause
Repository
github
Last release
1 year ago

Utility methods for Markdown text. šŸ“¦ Node.js, šŸŒ Web, šŸ“œ Files, šŸ“° Docs.

This package is available in both Node.js and Web formats. The web format is exposed as extra_markdown_text standalone variable and can be loaded from jsDelivr CDN.

Stability: Experimental.

const fs        = require('fs');
const xmarkdown = require('extra-markdown-text');

function main() {
  var txt = fs.readFileSync('README.md', 'utf8').replace(/\r?\n/, '\n');

  xmarkdown.links(txt);
  // [
  //   {
  //     full: '[Node.js](https://www.npmjs.com/package/extra-markdown-text)',
  //     name: 'Node.js',
  //     reference: '',
  //     url: 'https://www.npmjs.com/package/extra-markdown-text'
  //   },
  //   {
  //     full: '[Web](https://www.npmjs.com/package/extra-markdown-text.web)',
  //     name: 'Web',
  //     reference: '',
  //     url: 'https://www.npmjs.com/package/extra-markdown-text.web'
  //   },
  //   ...
  // ]

  xmarkdown.linkReferences(txt);
  // [
  //   {
  //     full: '[jsDelivr CDN]: https://cdn.jsdelivr.net/npm/extra-markdown-text.web/index.js',
  //     name: 'jsDelivr CDN',
  //     url: 'https://cdn.jsdelivr.net/npm/extra-markdown-text.web/index.js',
  //     title: ''
  //   },
  //   {
  //     full: '[forEachCodeBlock]: https://nodef.github.io/extra-markdown-text/modules.html#forEachCodeBlock',
  //     name: 'forEachCodeBlock',
  //     url: 'https://nodef.github.io/extra-markdown-text/modules.html#forEachCodeBlock',
  //     title: ''
  //   },
  //   ...
  // ]
}
main();

Index

PropertyDescription
forEachCodeBlockMatch code blocks in markdown text.
codeBlocksGet code blocks in markdown text.
replaceCodeBlocksReplace code blocks in markdown text.
tagCodeBlocksTag code blocks in markdown text and remove them.
untagCodeBlocksUntag code blocks in markdown text by adding them back.
forEachLinkMatch links in markdown text.
linksGet links in markdown text.
replaceLinksReplace links in markdown text.
forEachLinkReferenceMatch link references in markdown text.
linkReferencesGet link references in markdown text.
replaceLinkReferencesReplace link references in markdown text.
forEachTableMatch tables in markdown text.
tablesGet tables in markdown text.
replaceTablesReplace tables in markdown text.

npm.io ORG DOI