Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/agentofuser/remark-oembed
Convert URLs in markdown for youtube, twitter, etc. surrounded by newlines into html embeds
https://github.com/agentofuser/remark-oembed
html-embed markdown oembed remark-plugin remarkjs twitter unifiedjs youtube
Last synced: 27 days ago
JSON representation
Convert URLs in markdown for youtube, twitter, etc. surrounded by newlines into html embeds
- Host: GitHub
- URL: https://github.com/agentofuser/remark-oembed
- Owner: agentofuser
- License: mit
- Created: 2019-06-05T02:27:45.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2022-12-09T05:15:18.000Z (about 2 years ago)
- Last Synced: 2024-12-23T10:36:45.387Z (about 1 month ago)
- Topics: html-embed, markdown, oembed, remark-plugin, remarkjs, twitter, unifiedjs, youtube
- Language: TypeScript
- Homepage: https://oembed.com/
- Size: 981 KB
- Stars: 48
- Watchers: 2
- Forks: 5
- Open Issues: 39
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# remark-oembed
[![Downloads][downloads-badge]][downloads] [![Chat][chat-badge]][chat]
Converts URLs surrounded by newlines into embeds.
The important part of this code is taken directly from
[Benedicte Raae](https://www.raae.codes/)'s excellent
[gatsby-remark-oembed](https://github.com/raae/gatsby-remark-oembed) plugin, so
thank you very much [@raae](https://github.com/raae) 🙏## Installation
[yarn][]:
```bash
yarn add @agentofuser/remark-oembed
```## Usage
Say we have the following file, `demo.md`:
```markdown
Hey this is a nice youtube video about making modern react apps with gatsby:https://www.youtube.com/watch?v=GN0xHSk2P8Q
Check it out 👆
```And our script, `example.js`, looks as follows:
```javascript
var fs = require('fs')
var remark = require('remark')
var oembed = require('@agentofuser/remark-oembed')remark()
.use(oembed)
.process(fs.readFileSync('demo.md'), function(err, file) {
if (err) throw err
console.log(String(file))
})
```Now, running `node example` yields:
```markdown
Hey this is a nice youtube video about making modern react apps with gatsby:Check it out 👆
```## API
### `remark().use(oembed)`
Converts URLs surrounded by newlines into embeds.
## Contribute
See [`contributing.md` in `remarkjs/remark`][contribute] for ways to get
started.This organisation has a [Code of Conduct][coc]. By interacting with this
repository, organisation, or community you agree to abide by its terms.## License
[MIT][license] © [Agent of User][author]
[build-badge]: https://img.shields.io/travis/agentofuser/remark-oembed.svg
[build]: https://travis-ci.org/agentofuser/remark-oembed
[downloads-badge]: https://img.shields.io/npm/dm/remark-oembed.svg
[downloads]: https://www.npmjs.com/package/@agentofuser/remark-oembed
[chat-badge]:
https://img.shields.io/badge/join%20the%20community-on%20spectrum-7b16ff.svg
[chat]: https://spectrum.chat/unified/remark
[yarn]: https://yarnpkg.com/en/docs/install
[license]: LICENSE.md
[author]: https://agentofuser.com
[remark]: https://github.com/remarkjs/remark
[contribute]: https://github.com/remarkjs/remark/blob/master/contributing.md
[coc]: https://github.com/remarkjs/remark/blob/master/code-of-conduct.md