https://github.com/nodef/extra-markdown-text
Utility methods for Markdown text.
https://github.com/nodef/extra-markdown-text
code-block code-block-match-function code-block-replace-function code-blocks extra for-each-code-block for-each-link for-each-link-reference for-each-table link link-match-function link-reference link-reference-match-function link-reference-replace-function link-replace-function markdown table table-match-function table-replace-function text
Last synced: 6 months ago
JSON representation
Utility methods for Markdown text.
- Host: GitHub
- URL: https://github.com/nodef/extra-markdown-text
- Owner: nodef
- License: mit
- Created: 2022-04-01T17:29:38.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2025-04-08T17:19:19.000Z (9 months ago)
- Last Synced: 2025-06-19T08:45:45.209Z (7 months ago)
- Topics: code-block, code-block-match-function, code-block-replace-function, code-blocks, extra, for-each-code-block, for-each-link, for-each-link-reference, for-each-table, link, link-match-function, link-reference, link-reference-match-function, link-reference-replace-function, link-replace-function, markdown, table, table-match-function, table-replace-function, text
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/extra-markdown-text
- Size: 138 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Citation: CITATION.cff
Awesome Lists containing this project
README
Utility methods for Markdown text.
📦 [Node.js](https://www.npmjs.com/package/extra-markdown-text),
🌐 [Web](https://www.npmjs.com/package/extra-markdown-text.web),
📜 [Files](https://unpkg.com/extra-markdown-text/),
📰 [Docs](https://nodef.github.io/extra-markdown-text/).
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](https://www.youtube.com/watch?v=L1j93RnIxEo).
[jsDelivr CDN]: https://cdn.jsdelivr.net/npm/extra-markdown-text.web/index.js
```javascript
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. |
[](https://www.youtube.com/watch?v=bJirgZjBqNg)
[](https://nodef.github.io)
[](https://zenodo.org/badge/latestdoi/476812269)

[forEachCodeBlock]: https://nodef.github.io/extra-markdown-text/modules.html#forEachCodeBlock
[codeBlocks]: https://nodef.github.io/extra-markdown-text/modules.html#codeBlocks
[replaceCodeBlocks]: https://nodef.github.io/extra-markdown-text/modules.html#replaceCodeBlocks
[tagCodeBlocks]: https://nodef.github.io/extra-markdown-text/modules.html#tagCodeBlocks
[untagCodeBlocks]: https://nodef.github.io/extra-markdown-text/modules.html#untagCodeBlocks
[forEachLink]: https://nodef.github.io/extra-markdown-text/modules.html#forEachLink
[links]: https://nodef.github.io/extra-markdown-text/modules.html#links
[replaceLinks]: https://nodef.github.io/extra-markdown-text/modules.html#replaceLinks
[forEachLinkReference]: https://nodef.github.io/extra-markdown-text/modules.html#forEachLinkReference
[linkReferences]: https://nodef.github.io/extra-markdown-text/modules.html#linkReferences
[replaceLinkReferences]: https://nodef.github.io/extra-markdown-text/modules.html#replaceLinkReferences
[forEachTable]: https://nodef.github.io/extra-markdown-text/modules.html#forEachTable
[tables]: https://nodef.github.io/extra-markdown-text/modules.html#tables
[replaceTables]: https://nodef.github.io/extra-markdown-text/modules.html#replaceTables