gatsby-remark-katex
Advanced tools
Comparing version 1.1.0-alpha.f5c1df61 to 1.1.0-alpha.f98688ee
20
index.js
@@ -1,11 +0,7 @@ | ||
"use strict"; | ||
const visit = require(`unist-util-visit`); | ||
const katex = require(`katex`); | ||
const remarkMath = require(`remark-math`); | ||
var visit = require(`unist-util-visit`); | ||
var katex = require(`katex`); | ||
var remarkMath = require(`remark-math`); | ||
module.exports = function (_ref) { | ||
var markdownAST = _ref.markdownAST; | ||
visit(markdownAST, `inlineMath`, function (node) { | ||
module.exports = ({ markdownAST }) => { | ||
visit(markdownAST, `inlineMath`, node => { | ||
node.type = `html`; | ||
@@ -17,3 +13,3 @@ node.value = katex.renderToString(node.value, { | ||
visit(markdownAST, `math`, function (node) { | ||
visit(markdownAST, `math`, node => { | ||
node.type = `html`; | ||
@@ -26,4 +22,2 @@ node.value = katex.renderToString(node.value, { | ||
module.exports.setParserPlugins = function () { | ||
return [remarkMath]; | ||
}; | ||
module.exports.setParserPlugins = () => [remarkMath]; |
{ | ||
"name": "gatsby-remark-katex", | ||
"description": "Transform math nodes to html markup", | ||
"version": "1.1.0-alpha.f5c1df61", | ||
"version": "1.1.0-alpha.f98688ee", | ||
"author": "Jeffrey Xiao <jeffrey.xiao1998@gmail.com>", | ||
"bugs": { | ||
"url": "https://github.com/gatsbyjs/gatsby/issues" | ||
}, | ||
"dependencies": { | ||
"babel-runtime": "^6.26.0", | ||
"@babel/runtime": "^7.0.0-beta.38", | ||
"katex": "^0.8.3", | ||
"remark-math": "^0.2.4", | ||
"remark-math": "^1.0.3", | ||
"unist-util-visit": "^1.1.1" | ||
}, | ||
"devDependencies": { | ||
"cross-env": "^5.0.5" | ||
}, | ||
"homepage": "https://github.com/gatsbyjs/gatsby/tree/master/packages/gatsby-remark-katex#readme", | ||
"keywords": [ | ||
"gatsby", | ||
"gatsby-plugin", | ||
"remark", | ||
"katex" | ||
"katex", | ||
"remark" | ||
], | ||
"license": "MIT", | ||
"main": "index.js", | ||
"repository": "https://github.com/gatsbyjs/gatsby/tree/master/packages/gatsby-remark-katex", | ||
"scripts": { | ||
"build": "babel src --out-dir . --ignore __tests__", | ||
"watch": "babel -w src --out-dir . --ignore __tests__", | ||
"prepublish": "cross-env NODE_ENV=production npm run build" | ||
}, | ||
"devDependencies": { | ||
"cross-env": "^5.0.5" | ||
"prepublish": "cross-env NODE_ENV=production npm run build", | ||
"watch": "babel -w src --out-dir . --ignore __tests__" | ||
} | ||
} |
@@ -16,3 +16,3 @@ const Remark = require(`remark`) | ||
it(`renders math node properly`, () => { | ||
it(`renders double $ inlineMath node properly`, () => { | ||
const equation = `$$a^2 + b^2 = c^2$$` | ||
@@ -27,2 +27,13 @@ let remark = new Remark() | ||
}) | ||
it(`renders math node properly`, () => { | ||
const equation = `$$\na^2 + b^2 = c^2\n$$` | ||
let remark = new Remark() | ||
for (let parserPlugins of plugin.setParserPlugins()) { | ||
remark = remark.use(parserPlugins) | ||
} | ||
const markdownAST = remark.parse(equation) | ||
plugin({ markdownAST }) | ||
expect(markdownAST).toMatchSnapshot() | ||
}) | ||
}) |
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
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
14386
69
0
1
+ Added@babel/runtime@7.26.0(transitive)
+ Addedcharacter-entities@1.2.4(transitive)
+ Addedcharacter-entities-legacy@1.1.4(transitive)
+ Addedcharacter-reference-invalid@1.1.4(transitive)
+ Addedcollapse-white-space@1.0.6(transitive)
+ Addedinherits@2.0.4(transitive)
+ Addedis-alphabetical@1.0.4(transitive)
+ Addedis-alphanumerical@1.0.4(transitive)
+ Addedis-decimal@1.0.4(transitive)
+ Addedis-hexadecimal@1.0.4(transitive)
+ Addedis-whitespace-character@1.0.4(transitive)
+ Addedis-word-character@1.0.4(transitive)
+ Addedmarkdown-escapes@1.0.4(transitive)
+ Addedparse-entities@1.2.2(transitive)
+ Addedregenerator-runtime@0.14.1(transitive)
+ Addedremark-math@1.0.6(transitive)
+ Addedremark-parse@6.0.3(transitive)
+ Addedrepeat-string@1.6.1(transitive)
+ Addedstate-toggle@1.0.3(transitive)
+ Addedtrim@0.0.1(transitive)
+ Addedunherit@1.1.3(transitive)
+ Addedunist-util-remove-position@1.1.4(transitive)
+ Addedvfile-location@2.0.6(transitive)
+ Addedxtend@4.0.2(transitive)
- Removedbabel-runtime@^6.26.0
- Removed@types/debug@4.1.12(transitive)
- Removed@types/mdast@4.0.4(transitive)
- Removed@types/ms@0.7.34(transitive)
- Removed@types/unist@3.0.3(transitive)
- Removedbabel-runtime@6.26.0(transitive)
- Removedbail@2.0.2(transitive)
- Removedcharacter-entities@2.0.2(transitive)
- Removedcore-js@2.6.12(transitive)
- Removeddebug@4.4.0(transitive)
- Removeddecode-named-character-reference@1.0.2(transitive)
- Removeddequal@2.0.3(transitive)
- Removeddevlop@1.1.0(transitive)
- Removedextend@3.0.2(transitive)
- Removedis-plain-obj@4.1.0(transitive)
- Removedmdast-util-from-markdown@2.0.2(transitive)
- Removedmdast-util-to-string@4.0.0(transitive)
- Removedmicromark@4.0.1(transitive)
- Removedmicromark-core-commonmark@2.0.2(transitive)
- Removedmicromark-factory-destination@2.0.1(transitive)
- Removedmicromark-factory-label@2.0.1(transitive)
- Removedmicromark-factory-space@2.0.1(transitive)
- Removedmicromark-factory-title@2.0.1(transitive)
- Removedmicromark-factory-whitespace@2.0.1(transitive)
- Removedmicromark-util-character@2.1.1(transitive)
- Removedmicromark-util-chunked@2.0.1(transitive)
- Removedmicromark-util-classify-character@2.0.1(transitive)
- Removedmicromark-util-combine-extensions@2.0.1(transitive)
- Removedmicromark-util-decode-numeric-character-reference@2.0.2(transitive)
- Removedmicromark-util-decode-string@2.0.1(transitive)
- Removedmicromark-util-encode@2.0.1(transitive)
- Removedmicromark-util-html-tag-name@2.0.1(transitive)
- Removedmicromark-util-normalize-identifier@2.0.1(transitive)
- Removedmicromark-util-resolve-all@2.0.1(transitive)
- Removedmicromark-util-sanitize-uri@2.0.1(transitive)
- Removedmicromark-util-subtokenize@2.0.3(transitive)
- Removedmicromark-util-symbol@2.0.1(transitive)
- Removedmicromark-util-types@2.0.1(transitive)
- Removedms@2.1.3(transitive)
- Removedregenerator-runtime@0.11.1(transitive)
- Removedremark-math@0.2.4(transitive)
- Removedremark-parse@11.0.0(transitive)
- Removedtrough@2.2.0(transitive)
- Removedunified@11.0.5(transitive)
- Removedunist-util-stringify-position@4.0.0(transitive)
- Removedvfile@6.0.3(transitive)
- Removedvfile-message@4.0.2(transitive)
Updatedremark-math@^1.0.3