https://github.com/agentofuser/remark-giphy
Replace giphy:query in markdown with gif url for first result
https://github.com/agentofuser/remark-giphy
gif giphy giphy-api markdown remark remark-plugin unifiedjs
Last synced: about 2 months ago
JSON representation
Replace giphy:query in markdown with gif url for first result
- Host: GitHub
- URL: https://github.com/agentofuser/remark-giphy
- Owner: agentofuser
- License: mit
- Created: 2019-06-09T22:38:38.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2022-12-09T05:49:58.000Z (almost 3 years ago)
- Last Synced: 2024-12-23T10:36:45.337Z (10 months ago)
- Topics: gif, giphy, giphy-api, markdown, remark, remark-plugin, unifiedjs
- Language: TypeScript
- Homepage:
- Size: 3.19 MB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 23
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# remark-giphy
[![Downloads][downloads-badge]][downloads] [![Chat][chat-badge]][chat]
Add `giphy:` as a
[CommonMark URI scheme](https://spec.commonmark.org/0.29/#scheme).Examples:
- Replace `` with first matching gif from giphy.
- Replace `![]()` with first matching gif from giphy.
- Replace `[link]()` with first matching gif from giphy.## Installation
[yarn][]:
```bash
yarn add @agentofuser/remark-giphy
```## Usage
Say we have the following file, `demo.md`:
```markdown
Hello there! 👋
```And our script, `example.js`, looks as follows:
```javascript
var fs = require('fs')
var remark = require('remark')
var giphy = require('@agentofuser/remark-giphy')remark()
.use(giphy, { giphyApiKey: 'your-key' })
.process(fs.readFileSync('demo.md'), function(err, file) {
if (err) throw err
console.log(String(file))
})
```Now, running `node example` yields:
```markdown
Hello there! 👋
```## API
### `remark().use(giphy, options)`
Take `` and replace with first matching gif from giphy.
- The object `options` MUST contain a valid Giphy API key as the `giphyApiKey`
property.
- The object `options` MAY contain a valid Giphy API ID as the
`notFoundGiphyId` property. It will be used when there are no search results
for the term used. The default is this one:
## 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-giphy.svg
[build]: https://travis-ci.org/agentofuser/remark-giphy
[downloads-badge]: https://img.shields.io/npm/dm/remark-giphy.svg
[downloads]: https://www.npmjs.com/package/@agentofuser/remark-giphy
[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