transform-markdown-links

2019-10-10 admin

transform-markdown-links是什么

什么是transform-markdown-links,Transform the links in a Markdown file

transform-markdown-links使用教程帮助文档

transform-markdown-links

Travis npm

Transform the links in a Markdown file

Transforms the URLs of links in a Markdown file using a transform function.

Installation

npm install transform-markdown-links

Usage

import transformLinks from 'transform-markdown-links';

const input = 'This [link](page.md) will be transformed.';

transformLinks(input, (link, text) => link + '?hooray');
// => 'This [link](page.md?hooray) will be transformed.'

API

transformLinks(input, transform)

Transform the links in a Markdown string using a transform function. Returns a String of Markdown with transformed links.

  • input (String): Markdown input.
  • transform (Function): Callback to transform each link. Should return a string to change the link’s URL, or undefined to leave it as-is. Gets these parameters:
    • link (String): URL of the link.
    • text (String): text of the link.

Local Development

git clone https://github.com/gakimball/transform-markdown-links
cd transform-markdown-links
npm install
npm test

License

MIT © Geoff Kimball

本站文章除注明转载外,均为本站原创或编译。欢迎任何形式的转载,但请务必注明出处。

转载请注明:文章转载自 JavaScript中文网 [https://www.javascriptcn.com]

本文地址:https://www.javascriptcn.com/read-77029.html

文章标题:transform-markdown-links

回到顶部