Published July 30, 2022 | Version 0.1.0
Software Open

nodef/extra-markdown-text: Utility methods for Markdown text

Creators

Description

Utility methods for Markdown text.<br> 📦 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.

<br>

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

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

  markdown.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'
  //   },
  //   ...
  // ]

  markdown.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();

<br> <br>

Index
Property Description
forEachCodeBlock Match code blocks in markdown text.
codeBlocks Get code blocks in markdown text.
replaceCodeBlocks Replace code blocks in markdown text.
tagCodeBlocks Tag code blocks in markdown text and remove them.
untagCodeBlocks Untag code blocks in markdown text by adding them back.
forEachLink Match links in markdown text.
links Get links in markdown text.
replaceLinks Replace links in markdown text.
forEachLinkReference Match link references in markdown text.
linkReferences Get link references in markdown text.
replaceLinkReferences Replace link references in markdown text.
forEachTable Match tables in markdown text.
tables Get tables in markdown text.
replaceTables Replace tables in markdown text.

<br> <br>

Files

nodef/extra-markdown-text-0.1.0.zip

Files (27.4 kB)

Name Size Download all
md5:6fad927f5ea65d74c305de056da86444
27.4 kB Preview Download

Additional details