pretty-remarkable

Plugin for prettifying markdown with Remarkable using custom renderer rules.

pretty-remarkable

Plugin for prettifying markdown with Remarkable using custom renderer rules.

Please consider following this project's author, Jon Schlinkert, and consider starring the project to show your :heart: and support.

(TOC generated by verbusing markdown-toc)

Install

Install with npm:

$ npm install --save pretty-remarkable

Usage

var prettify = require('pretty-remarkable');

Examples

var prettify = require('pretty-remarkable');
var Remarkable = require('remarkable');
var md = new Remarkable();

// register the plugin
md.use(prettify);
var result = md.render('\n\n\n# foo\n\n\nbar\n# baz');
//=> '# foo\n\nbar\n\n# baz'

Or create a function if you need to export it or need a more reusable format:

var prettify = require('pretty-remarkable');
var Remarkable = require('remarkable');

function pretty(str, options) {
  return new Remarkable()
    .use(prettify)
    .render(str);
}

pretty('\n\n\n# foo\n\n\nbar\n# baz');
//=> '# foo\n\nbar\n\n# baz'

Formatting

In addition to the formatting mentioned in the following sections:

  • does not modify codeor gfm code blocks
  • ensures that an extra newline precedes gfm code blocks, since some text editors do not display proper hightlighting otherwise
  • unless options.condenseis false, condenses 3+ newlines down to two

Tables

Normalizes table formatting.

Example

Before
**A**|**B**|**C**
|---:|:---|---|
a |b |c
x |y |z
After

Is normalized to:

Before

| **A** | **B** | **C** | 
| ---: | :--- | --- |
| a | b | c |
| x | y | z |

After

Unordered lists

Normalizes unordered lists.

Example

* a
* b
  * c
  * d
    * e
    * f

Is normalized to:

* a
* b
  - c
  - d
    + e
    + f

Ordered lists

Normalizes ordered lists.

Example

1. foo
  a. aaa
  b. bbb
  c. ccc
1. bar
1. baz

Is normalized to:

1. foo
  a. aaa
  b. bbb
  c. ccc
2. bar
3. baz

About

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.

Running Tests

Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:

$ npm install && npm test
Building docs

(This project's readme.md is generated by verb, please don't edit the readme directly. Any changes to the readme must be made in the .verb.mdreadme template.)

To generate the readme, run the following command:

$ npm install -g verbose/verb#dev verb-generate-readme && verb

Related projects

You might also be interested in these projects:

Author

Jon Schlinkert

License

Copyright © 2018, Jon Schlinkert. Released under the MIT License.


This file was generated by verb-generate-readme, v0.6.0, on July 05, 2018.

HomePage

https://github.com/jonschlinkert/pretty-remarkable

Repository

jonschlinkert/pretty-remarkable


上一篇:sections
下一篇:minimist

相关推荐

  • 纯css3漂亮的checkbox和radio美化效果插件Pretty.css插件

    插件介绍 pretty.css是一款纯css3漂亮的checkbox和radio美化效果。pretty.css可以和多种字体图标结合使用,对原生的checkbox和radio进行美化,还可以制作按...

    9 个月前
  • 【每日一包0017】pretty-ms

    github地址:https://github.com/ABCDdouyae...(https://github.com/ABCDdouyaer/apackperdayNO.1) prettyms...

    1 年前
  • vfile-reporter-pretty

    Pretty reporter for VFile vfilereporterpretty Buildbuildbadgebuild Coveragecoveragebadgecoverage ...

    2 年前
  • stylelint-formatter-pretty

    A pretty Stylelint formatter. stylelintformatterpretty A pretty formatter for Stylelint(https://...

    1 年前
  • start-pretty-reporter

    Pretty reporter for Start startprettyreporter npm(https://img.shields.io/npm/v/startprettyreporte...

    2 年前
  • rollup-plugin-prettyuglify

    Rollup plugin to minify generated bundle into the shape of an SVG's paths rolluppluginprettyuglify...

    1 年前
  • remarkable-meta

    Add YAML metadata to the remarkable pluggable markdown parser remarkablemeta Add YAML metadata to...

    1 年前
  • remarkable

    Markdown parser, done right. 100% Commonmark support, extensions, syntax plugins, high speed all in...

    2 年前
  • prettyugly

    Pretty/uglify CSS Uglify (strip spaces) or prettify (add consistent spaces) CSS code "Ambition...

    9 个月前
  • prettysize

    Convert bytes to other sizes for prettier logging PrettySize ========== Helper utility to provide ...

    1 年前

官方社区

扫码加入 JavaScript 社区