markdown-to-jsx
Advanced tools
Comparing version 6.6.9 to 6.7.0
@@ -665,2 +665,3 @@ 'use strict'; | ||
options.overrides = options.overrides || {}; | ||
options.slugify = options.slugify || slugify; | ||
@@ -921,3 +922,3 @@ var createElementFn = options.createElement || _react2.default.createElement; | ||
content: parseInline(_parse2, capture[2], state), | ||
id: slugify(capture[2]), | ||
id: options.slugify(capture[2]), | ||
level: capture[1].length | ||
@@ -924,0 +925,0 @@ }; |
@@ -651,2 +651,3 @@ var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
options.overrides = options.overrides || {}; | ||
options.slugify = options.slugify || slugify; | ||
@@ -907,3 +908,3 @@ var createElementFn = options.createElement || React.createElement; | ||
content: parseInline(_parse2, capture[2], state), | ||
id: slugify(capture[2]), | ||
id: options.slugify(capture[2]), | ||
level: capture[1].length | ||
@@ -910,0 +911,0 @@ }; |
@@ -715,2 +715,3 @@ /* @jsx h */ | ||
options.overrides = options.overrides || {}; | ||
options.slugify = options.slugify || slugify; | ||
@@ -996,3 +997,3 @@ const createElementFn = options.createElement || React.createElement; | ||
content: parseInline(parse, capture[2], state), | ||
id: slugify(capture[2]), | ||
id: options.slugify(capture[2]), | ||
level: capture[1].length, | ||
@@ -999,0 +1000,0 @@ }; |
@@ -6,3 +6,3 @@ { | ||
"license": "MIT", | ||
"version": "6.6.9", | ||
"version": "6.7.0", | ||
"engines": { | ||
@@ -92,3 +92,7 @@ "node": ">= 4" | ||
] | ||
}, | ||
"collective": { | ||
"type": "opencollective", | ||
"url": "https://opencollective.com/markdown-to-jsx" | ||
} | ||
} |
100
README.md
@@ -1,24 +0,32 @@ | ||
# Markdown Component for React, Preact + Friends | ||
**markdown-to-jsx** | ||
The most lightweight, customizable React markdown component. | ||
[![npm version](https://badge.fury.io/js/markdown-to-jsx.svg)](https://badge.fury.io/js/markdown-to-jsx) [![build status](https://api.travis-ci.org/probablyup/markdown-to-jsx.svg)](https://travis-ci.org/probablyup/markdown-to-jsx) [![codecov](https://codecov.io/gh/probablyup/markdown-to-jsx/branch/master/graph/badge.svg)](https://codecov.io/gh/probablyup/markdown-to-jsx) [![downloads](https://img.shields.io/npm/dm/markdown-to-jsx.svg)](https://npm-stat.com/charts.html?package=markdown-to-jsx) | ||
[![Backers on Open Collective](https://opencollective.com/markdown-to-jsx/backers/badge.svg)](#backers) [![Sponsors on Open Collective](https://opencollective.com/markdown-to-jsx/sponsors/badge.svg)](#sponsors) | ||
<!-- TOC --> | ||
- [Markdown Component for React, Preact + Friends](#markdown-component-for-react-preact--friends) | ||
- [Installation](#installation) | ||
- [Usage](#usage) | ||
- [Parsing Options](#parsing-options) | ||
- [options.forceBlock](#optionsforceblock) | ||
- [options.forceInline](#optionsforceinline) | ||
- [options.overrides - Override Any HTML Tag's Representation](#optionsoverrides---override-any-html-tags-representation) | ||
- [options.overrides - Rendering Arbitrary React Components](#optionsoverrides---rendering-arbitrary-react-components) | ||
- [options.createElement - Custom React.createElement behavior](#optionscreateelement---custom-reactcreateelement-behavior) | ||
- [Getting the smallest possible bundle size](#getting-the-smallest-possible-bundle-size) | ||
- [Usage with Preact](#usage-with-preact) | ||
- [Gotchas](#gotchas) | ||
- [Significant indentation inside arbitrary HTML](#significant-indentation-inside-arbitrary-html) | ||
- [Code blocks](#code-blocks) | ||
- [Nested lists](#nested-lists) | ||
- [Using The Compiler Directly](#using-the-compiler-directly) | ||
- [Changelog](#changelog) | ||
- [Installation](#installation) | ||
- [Usage](#usage) | ||
- [Parsing Options](#parsing-options) | ||
- [options.forceBlock](#optionsforceblock) | ||
- [options.forceInline](#optionsforceinline) | ||
- [options.overrides - Override Any HTML Tag's Representation](#optionsoverrides---override-any-html-tags-representation) | ||
- [options.overrides - Rendering Arbitrary React Components](#optionsoverrides---rendering-arbitrary-react-components) | ||
- [options.createElement - Custom React.createElement behavior](#optionscreateelement---custom-reactcreateelement-behavior) | ||
- [options.slugify](#optionsslugify) | ||
- [Getting the smallest possible bundle size](#getting-the-smallest-possible-bundle-size) | ||
- [Usage with Preact](#usage-with-preact) | ||
- [Gotchas](#gotchas) | ||
- [Significant indentation inside arbitrary HTML](#significant-indentation-inside-arbitrary-html) | ||
- [Code blocks](#code-blocks) | ||
- [Nested lists](#nested-lists) | ||
- [Using The Compiler Directly](#using-the-compiler-directly) | ||
- [Changelog](#changelog) | ||
- [Donate](#donate) | ||
- [Credits](#credits) | ||
- [Contributors](#contributors) | ||
- [Backers](#backers) | ||
- [Sponsors](#sponsors) | ||
@@ -29,3 +37,3 @@ <!-- /TOC --> | ||
`markdown-to-jsx` uses a fork of [simple-markdown](https://github.com/Khan/simple-markdown) as its parsing engine and extends it in a number of ways to make your life easier. Notably, this package offers the following additional benefits: | ||
`markdown-to-jsx` uses a heavily-modified fork of [simple-markdown](https://github.com/Khan/simple-markdown) as its parsing engine and extends it in a number of ways to make your life easier. Notably, this package offers the following additional benefits: | ||
@@ -48,8 +56,6 @@ - Arbitrary HTML is supported and parsed into the appropriate JSX representation | ||
Install `markdown-to-jsx` with your favorite package manager. | ||
```shell | ||
# if you use npm | ||
npm i markdown-to-jsx | ||
# if you use yarn | ||
yarn add markdown-to-jsx | ||
``` | ||
@@ -342,2 +348,18 @@ | ||
#### options.slugify | ||
By default, a [lightweight deburring function](https://github.com/probablyup/markdown-to-jsx/blob/bc2f57412332dc670f066320c0f38d0252e0f057/index.js#L261-L275) is used to generate an HTML id from headings. You can override this by passing a function to `options.slugify`. This is helpful when you are using non-alphanumeric characters (e.g. Chinese or Japanese characters) in headings. For example: | ||
```jsx | ||
<Markdown options={{ slugify: str => str }}># 中文</Markdown>; | ||
// or | ||
compiler('# 中文', { slugify: str => str }); | ||
// renders: | ||
<h1 id="中文">中文</h1> | ||
``` | ||
### Getting the smallest possible bundle size | ||
@@ -438,2 +460,34 @@ | ||
## Donate | ||
Like this library? It's developed entirely on a volunteer basis; chip in a few bucks if you can at the [OpenCollective](https://opencollective.com/markdown-to-jsx). | ||
## Credits | ||
### Contributors | ||
This project exists thanks to all the people who contribute. [[Contribute](CONTRIBUTING.md)]. | ||
<a href="graphs/contributors"><img src="https://opencollective.com/markdown-to-jsx/contributors.svg?width=890&button=false" /></a> | ||
### Backers | ||
Thank you to all our backers! 🙏 [[Become a backer](https://opencollective.com/markdown-to-jsx#backer)] | ||
<a href="https://opencollective.com/markdown-to-jsx#backers" target="_blank"><img src="https://opencollective.com/markdown-to-jsx/backers.svg?width=890"></a> | ||
### Sponsors | ||
Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [[Become a sponsor](https://opencollective.com/markdown-to-jsx#sponsor)] | ||
<a href="https://opencollective.com/markdown-to-jsx/sponsor/0/website" target="_blank"><img src="https://opencollective.com/markdown-to-jsx/sponsor/0/avatar.svg"></a> | ||
<a href="https://opencollective.com/markdown-to-jsx/sponsor/1/website" target="_blank"><img src="https://opencollective.com/markdown-to-jsx/sponsor/1/avatar.svg"></a> | ||
<a href="https://opencollective.com/markdown-to-jsx/sponsor/2/website" target="_blank"><img src="https://opencollective.com/markdown-to-jsx/sponsor/2/avatar.svg"></a> | ||
<a href="https://opencollective.com/markdown-to-jsx/sponsor/3/website" target="_blank"><img src="https://opencollective.com/markdown-to-jsx/sponsor/3/avatar.svg"></a> | ||
<a href="https://opencollective.com/markdown-to-jsx/sponsor/4/website" target="_blank"><img src="https://opencollective.com/markdown-to-jsx/sponsor/4/avatar.svg"></a> | ||
<a href="https://opencollective.com/markdown-to-jsx/sponsor/5/website" target="_blank"><img src="https://opencollective.com/markdown-to-jsx/sponsor/5/avatar.svg"></a> | ||
<a href="https://opencollective.com/markdown-to-jsx/sponsor/6/website" target="_blank"><img src="https://opencollective.com/markdown-to-jsx/sponsor/6/avatar.svg"></a> | ||
<a href="https://opencollective.com/markdown-to-jsx/sponsor/7/website" target="_blank"><img src="https://opencollective.com/markdown-to-jsx/sponsor/7/avatar.svg"></a> | ||
<a href="https://opencollective.com/markdown-to-jsx/sponsor/8/website" target="_blank"><img src="https://opencollective.com/markdown-to-jsx/sponsor/8/avatar.svg"></a> | ||
<a href="https://opencollective.com/markdown-to-jsx/sponsor/9/website" target="_blank"><img src="https://opencollective.com/markdown-to-jsx/sponsor/9/avatar.svg"></a> | ||
MIT |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
257156
4045
490