New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

remark-excerpt

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

remark-excerpt

Remark transformer for extracting an excerpt.

beta
latest
Source
npmnpm
Version
1.0.0-beta.1
Version published
Maintainers
1
Created
Source

remark-excerpt

Remark transformer for extracting an excerpt.

This is a remark plugin for transformer for extracting an excerpt, similar to WordPress's excerpt functionality.

Installation

NPM

$ npm i remark-excerpt

Yarn

$ yarn add remark-excerpt

Usage

Say we have the following file, example.md:

# Title

Paragraph 1.

Paragraph 2.

<!-- excerpt -->

Paragraph 3.

Paragraph 4.

And our script, example.js, looks as follows:

const remark = require('remark');
const excerpt = require('remark-excerpt');
const vfile = require('to-vfile');

(async () => {
    const file = await vfile.read('example.md');
    const result = await remark()
        .use(excerpt)
        .process(file);

    console.log(result.toString());
})();

Now, running node example yields:

# Title

Paragraph 1.

Paragraph 2.

You can try this yourself by downloading or cloning the project, installing dependencies, and running yarn example.

API

remark().use(excerpt[, options])

Returns markdown content specified before the excerpt comment.

Options

identifier

Type: String Default: excerpt, more, preview, or teaser

Specifies the excerpt comment identifier to look for.

License

MIT © Michael Novotny

Keywords

excerpt

FAQs

Package last updated on 18 Feb 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts