Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rehype-prism

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rehype-prism - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

.nyc_output/6178d783-1db7-4e4d-add8-08004454525a.json

10

CHANGELOG.md

@@ -5,2 +5,12 @@ # Change Log

<a name="0.1.1"></a>
## [0.1.1](https://github.com/Val-istar-Guo/rehype-prism/compare/v0.1.0...v0.1.1) (2019-03-05)
### Bug Fixes
* preLangClass not work ([c6fedf5](https://github.com/Val-istar-Guo/rehype-prism/commit/c6fedf5))
<a name="0.1.0"></a>

@@ -7,0 +17,0 @@ # [0.1.0](https://github.com/Val-istar-Guo/rehype-prism/compare/v0.0.2...v0.1.0) (2018-12-15)

8

dist/bundle.js

@@ -40,3 +40,3 @@ 'use strict';

const preVisitor = node => {
const preVisitor = preLangClass => node => {
const langs = [];

@@ -47,9 +47,11 @@

node.properties.className = node.properties.className || [];
node.properties.className.push(...langs);
if (preLangClass) node.properties.className.push(...langs);
};
var index = (option = {}) => (tree, file) => {
visit(tree, preSelector, preVisitor);
const { preLangClass = true } = option;
visit(tree, preSelector, preVisitor(preLangClass));
}
module.exports = index;

@@ -17,6 +17,8 @@ {

"release:first": "standard-version --first-release",
"postpublish": "git push"
"postpublish": "git push",
"report": "nyc npm run test",
"coveralls": "nyc npm test && nyc report --reporter=text-lcov | coveralls"
},
"description": "[![version](https://img.shields.io/npm/v/rehype-prism.svg?style=flat-square)](https://www.npmjs.com/package/rehype-prism) [![downloads](https://img.shields.io/npm/dm/rehype-prism.svg?style=flat-square)](https://www.npmjs.com/package/rehype-prism) [![license](https://img.shields.io/npm/l/rehype-prism.svg?style=flat-square)](https://www.npmjs.com/package/rehype-prism) [![dependencies](https://img.shields.io/david/Val-istar-Guo/rehype-prism.svg?style=flat-square)](https://www.npmjs.com/package/rehype-prism)",
"version": "0.1.0",
"description": "The unified plugin used to highlight code block in html with Prism",
"version": "0.1.1",
"directories": {

@@ -37,3 +39,6 @@ "test": "test"

"html",
"remark"
"remark",
"highlighting",
"syntax",
"syntax-highlighting plugin"
],

@@ -62,2 +67,4 @@ "author": "Val-istar-Guo <val.istar.guo@gmail.com>",

"devDependencies": {
"@commitlint/cli": "^7.2.0",
"@commitlint/config-conventional": "^7.1.2",
"ava": "^1.0.0-beta.4",

@@ -70,3 +77,10 @@ "babel-core": "^6.26.0",

"babel-register": "^6.26.0",
"commitizen": "^3.0.2",
"coveralls": "^3.0.2",
"cz-conventional-changelog": "^2.1.0",
"husky": "^1.0.1",
"nyc": "^13.1.0",
"rehype-stringify": "^5.0.0",
"remark-parse": "^6.0.3",
"remark-rehype": "^4.0.0",
"rollup": "^0.58.0",

@@ -77,7 +91,4 @@ "rollup-plugin-babel": "^3.0.3",

"rollup-plugin-node-resolve": "^3.3.0",
"commitizen": "^3.0.2",
"cz-conventional-changelog": "^2.1.0",
"@commitlint/cli": "^7.2.0",
"@commitlint/config-conventional": "^7.1.2",
"standard-version": "^4.4.0"
"standard-version": "^4.4.0",
"unified": "^7.1.0"
},

@@ -84,0 +95,0 @@ "dependencies": {

@@ -7,4 +7,10 @@ # rehype-prism

[![dependencies](https://img.shields.io/david/Val-istar-Guo/rehype-prism.svg?style=flat-square)](https://www.npmjs.com/package/rehype-prism)
[![coveralls](https://img.shields.io/coveralls/github/Val-istar-Guo/rehype-prism.svg?style=flat-square)](https://coveralls.io/github/Val-istar-Guo/rehype-prism)
<!-- custom -->
The unified plugin used to highlight code block in html with Prism.
And you have the ability to control whether to copy the `language-` class to `<pre>` tag
## Install

@@ -20,2 +26,3 @@

import unified from 'unified'
import rehyper from 'rehyper'
import markdown from 'remark-parse'

@@ -26,2 +33,3 @@ import remark2rehype from 'remark-rehype'

// parse markdown to html
unified()

@@ -33,2 +41,9 @@ .use(markdown)

.use(html)
.parse(/* markstring string */)
// parse code block in html string
rehyper()
.use(highlightCode)
.use(html)
.parse(/* html string */)
```

@@ -45,3 +60,3 @@

- **preLangClass(default: false)**: Whether to copy the `language-` class to the `<pre>` tag.
- **preLangClass(default: true)**: Whether to copy the `language-` class to the `<pre>` tag.

@@ -48,0 +63,0 @@ Some css style will be set to the `<pre class="language-xxx">`, if you use the official theme.

@@ -35,3 +35,3 @@ // write your code here

const preVisitor = node => {
const preVisitor = preLangClass => node => {
const langs = []

@@ -42,8 +42,9 @@

node.properties.className = node.properties.className || []
node.properties.className.push(...langs)
if (preLangClass) node.properties.className.push(...langs)
}
export default (option = {}) => (tree, file) => {
const { preLangClass = false } = option
visit(tree, preSelector, preVisitor)
const { preLangClass = true } = option
visit(tree, preSelector, preVisitor(preLangClass))
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc