Giter Site home page Giter Site logo

justinhachemeister / metalsmith-more Goto Github PK

View Code? Open in Web Editor NEW

This project forked from kfranqueiro/metalsmith-more

0.0 1.0 0.0 220 KB

A Metalsmith plugin to store the content before <!--more--> in HTML files.

License: MIT License

JavaScript 100.00%

metalsmith-more's Introduction

metalsmith-more

A Metalsmith plugin to store the content before <!--more--> in HTML files, akin to WordPress' More tag.

This plugin processes HTML files and adds a less key with the part of contents preceding the <!--more--> tag. The file extension to filter by, tag to truncate on, and key to store content in are customizable; see Options below.

Installation

$ npm install metalsmith-more

CLI Usage

Add the metalsmith-more key to your metalsmith.json file:

{
	"plugins": {
		"metalsmith-more": true
	}
}

JavaScript Usage

var more = require('metalsmith-more');
metalsmith.use(more());

Options

metalsmith-more can be used with zero configuration, but it also supports the following options to customize its behavior:

  • ext - Extension to match against when examining files to operate on; default is html
  • regexp - Regular expression to truncate against; default is /\s*<!--\s*more\s*-->/. May also be specified as a string, which a RegExp will be constructed from.
  • key - Key to store truncated content in; default is less
  • alwaysAddKey - whether to always add the specified key even if a file contains no match to regexp; default is false.
    • When false, any file with no match will not contain the specified key.
    • When true, any file with no match will have the specified key's value set equal to the file's contents.

These options can be specified in an object passed to the plugin function or assigned to the metalsmith-more key in metalsmith.json.

License

MIT

metalsmith-more's People

Contributors

kfranqueiro avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.