GithubHelp home page GithubHelp logo

lclc98 / remark-underline Goto Github PK

View Code? Open in Web Editor NEW

This project forked from emilschutte/remark-underline

0.0 1.0 0.0 228 KB

A remark plugin that repurposes double underscores for underlining.

License: MIT License

JavaScript 100.00%

remark-underline's Introduction

remark-underline

npm version

A remark plugin that adds support for underlining. By default this is done by repurposing __ from the bold formatter. Bold also supports ** so repurposing __ is a popular choice for underlining text.

Installation

npm install remark-underline

For best results you should use remark-html or similar.

Usage

Import the plugin and then pass it into remark or your unified processor chain.

import remark from 'remark';
import html from 'remark-html';
import underline from 'remark-underline';

remark.use(html).use(underline).process("__hello world__");

With the plugin the output will be

<p>
  <ins class="underline">hello world</ins>
</p>

Without the plugin the output will be

<p>
  <strong>hello world</strong>
</p>

Options

You may supply an optional options object to configure the plugin. These are the options currently supported.

  • marker - The token used to identify unerlined text. By default this is '__'.
  • nodeType - The name of the node to create. By default this is 'underline'.
  • tagType - The name of the HTML tag to wrap the text in. The default is 'ins' however this may not always be appropriate.
  • classNames - An array of class names to use for the HTML tag. By default this is just 'underline'. Passing an empty array will disable this.

Example

    const underlineOptions = {
        marker: '!!',
        classNames: ['thing1', 'thing2']
    }

    remark().use(html).use(underline, underlineOptions).process("!!I Am Underline!!");

License

MIT © Darkhax

remark-underline's People

Contributors

darkhax avatar emilschutte avatar

Watchers

James Cloos 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.