1.0.4 • Published 2 months ago

@chailotl/remark-videos v1.0.4

Weekly downloads
-
License
MIT
Repository
github
Last release
2 months ago

remark-videos

A remark plugin to embed videos with ![]().

Contents

What is this?

This package is a unified (remark) plugin to embed videos with ![]().

When should I use this?

This project is useful if you want to embed videos using the ![]() syntax.

Install

This package is ESM only. In Node.js (version 16+), install with npm:

npm install @chailotl/remark-videos

Use

Say we have the following file example.md.

# Image

![](image.png)

# Video

![](video.mp4)

...and a module example.js:

import {remark} from 'remark'
import remarkVideos from '@chailotl/remark-videos'
import {read} from 'to-vfile'

const file = await remark()
  .use(remarkVideos)
  .process(await read('example.md'))

console.log(String(file))

...then running node example.js yields:

<h1>Image</h1>
<p><img src="image.png" alt=""></p>
<h1>Video</h1>
<p><video src="video.mp4" controls=""></video></p>

API

This package exports no identifiers. The default export is remarkVideos.

unified().use(remarkVideos)

Embeds video links using the ![](video.mp4) syntax

Parameters

There are no parameters.

Returns

Transform (Transformer).

Security

Use of remark-videos does not involve rehype (hast) or user content so there are no openings for cross-site scripting (XSS) attacks.

License

MIT © Chai

1.0.2

2 months ago

1.0.1

2 months ago

1.0.4

2 months ago

1.0.0

3 months ago