Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sindresorhus/urls-md
Convert URLs to Markdown links: Extracts URLs from text → Gets their article title → Creates Markdown links
https://github.com/sindresorhus/urls-md
Last synced: 4 months ago
JSON representation
Convert URLs to Markdown links: Extracts URLs from text → Gets their article title → Creates Markdown links
- Host: GitHub
- URL: https://github.com/sindresorhus/urls-md
- Owner: sindresorhus
- License: mit
- Created: 2014-02-14T20:34:57.000Z (almost 11 years ago)
- Default Branch: main
- Last Pushed: 2023-05-17T19:18:24.000Z (over 1 year ago)
- Last Synced: 2024-04-14T11:09:17.356Z (10 months ago)
- Language: JavaScript
- Size: 27.3 KB
- Stars: 80
- Watchers: 7
- Forks: 11
- Open Issues: 1
-
Metadata Files:
- Readme: readme.md
- License: license
Awesome Lists containing this project
- project-awesome - sindresorhus/urls-md - Convert URLs to Markdown links: Extracts URLs from text → Gets their article title → Creates Markdown links (JavaScript)
- jimsghstars - sindresorhus/urls-md - Convert URLs to Markdown links: Extracts URLs from text → Gets their article title → Creates Markdown links (JavaScript)
README
# urls-md
> Convert URLs to Markdown links and images
[Extracts URLs from text](https://github.com/sindresorhus/get-urls) → [Gets their article title](https://github.com/sindresorhus/article-title) → Creates Markdown links and images
Useful for when you have a linkdump and want them in Markdown.
###### From
```
Lorem ipsum dolor sit amet
http://updates.html5rocks.com/2014/01/Yo-Polymer-A-Whirlwind-Tour-Of-Web-Component-Tooling
Magnis dis parturient montes.
Lorem http://codelittle.com/tag/yeoman/
https://github.global.ssl.fastly.net/images/modules/logos_page/GitHub-Mark.png
```###### To
```
[Yo Polymer – A Whirlwind Tour Of Web Component Tooling](http://updates.html5rocks.com/2014/01/Yo-Polymer-A-Whirlwind-Tour-Of-Web-Component-Tooling)[How To Use Yeoman](http://codelittle.com/tag/yeoman/)
![](https://github.global.ssl.fastly.net/images/modules/logos_page/GitHub-Mark.png)
```## Install
```sh
npm install urls-md
```## Usage
```js
import urslMd from 'urls-md';const urls = await urlsMd('Lorem ipsum http://codelittle.com/tag/yeoman/');
console.log(urls);
//=> ['[How To Use Yeoman](http://codelittle.com/tag/yeoman/)']
```## API
### urlsMd(input)
#### input
Type: `string`
Text to extract Markdown links and images from.
## CLI
```sh
npm install --global urls-md
``````sh
urls-md --helpUsage
urls-md
cat | urls-md
```You can also easily run through multiple files using shell scripting. In this example using ZSH syntax:
```sh
# Loops through all .txt files in the current directory and outputs the converted files with .md extension
for f (*.txt) { urls-md $f > $f.md }
```