Git Product home page Git Product logo

nodef / extra-markdown-text Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 0.0 140 KB

Utility methods for Markdown text.

Home Page: https://www.npmjs.com/package/extra-markdown-text

License: MIT License

JavaScript 38.93% TypeScript 61.07%
extra markdown text code-block-match-function for-each-code-block code-block code-blocks code-block-replace-function link-match-function for-each-link link link-replace-function link-reference-match-function for-each-link-reference table for-each-table link-reference link-reference-replace-function table-match-function table-replace-function

extra-markdown-text's Introduction

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

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.



ORG DOI

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.