rehype-mathjax
Advanced tools
Comparing version 1.0.0 to 2.0.0
47
index.js
@@ -1,46 +0,1 @@ | ||
const visit = require('unist-util-visit') | ||
const unified = require('unified') | ||
const parse = require('rehype-parse') | ||
const toText = require('hast-util-to-text') | ||
module.exports = rehypeMathjax | ||
const assign = Object.assign | ||
const parseHtml = unified().use(parse, {fragment: true, position: false}) | ||
const source = 'rehype-mathjax' | ||
function rehypeMathjax(options) { | ||
const opts = options || {} | ||
const throwOnError = opts.throwOnError || false | ||
return transformMath | ||
function transformMath(tree, file) { | ||
visit(tree, 'element', onelement) | ||
function onelement(element) { | ||
const classes = element.properties.className || [] | ||
const inline = classes.includes('math-inline') | ||
const displayMode = classes.includes('math-display') | ||
if (!inline && !displayMode) { | ||
return | ||
} | ||
const value = toText(element) | ||
let result = value | ||
if (inline) { | ||
result = `$` + result + `$`; | ||
} | ||
if (displayMode) { | ||
result = `$$` + result + `$$`; | ||
} | ||
element.children = parseHtml.parse(result).children | ||
} | ||
} | ||
} | ||
module.exports = require('./svg') |
{ | ||
"name": "rehype-mathjax", | ||
"version": "1.0.0", | ||
"description": "", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
"version": "2.0.0", | ||
"description": "rehype plugin to transform inline and block math with MathJax", | ||
"license": "MIT", | ||
"keywords": [ | ||
"unified", | ||
"remark", | ||
"rehype", | ||
"rehype-plugin", | ||
"plugin", | ||
"mdast", | ||
"markdown", | ||
"hast", | ||
"html", | ||
"math", | ||
"mathjax", | ||
"latex", | ||
"tex" | ||
], | ||
"repository": "https://github.com/remarkjs/remark-math/tree/master/packages/rehype-mathjax", | ||
"bugs": "https://github.com/remarkjs/remark-math/issues", | ||
"funding": { | ||
"type": "opencollective", | ||
"url": "https://opencollective.com/unified" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/Ir1d/rehype-mathjax.git" | ||
"browser": { | ||
"./lib/adaptor.js": "./lib/adaptor.browser.js" | ||
}, | ||
"author": "Ir1d", | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/Ir1d/rehype-mathjax/issues" | ||
"author": "TANIGUCHI Masaya <mew@cat.ovh> (https://docs.casa)", | ||
"contributors": [ | ||
"TANIGUCHI Masaya <mew@cat.ovh> (https://docs.casa)", | ||
"Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)" | ||
], | ||
"files": [ | ||
"lib/", | ||
"browser.js", | ||
"chtml.js", | ||
"svg.js", | ||
"index.js" | ||
], | ||
"main": "index.js", | ||
"dependencies": { | ||
"hast-util-from-dom": "^2.0.0", | ||
"hast-util-to-text": "^2.0.0", | ||
"jsdom": "^16.0.0", | ||
"mathjax-full": "^3.0.0", | ||
"unist-util-visit": "^2.0.0" | ||
}, | ||
"homepage": "https://github.com/Ir1d/rehype-mathjax#readme" | ||
"devDependencies": {}, | ||
"xo": false | ||
} |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
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 tests
QualityPackage does not have any tests. This is a strong signal of a poorly maintained or low quality package.
Found 1 instance in 1 package
11161
13
115
193
5
1
1
2
+ Addedhast-util-from-dom@^2.0.0
+ Addedhast-util-to-text@^2.0.0
+ Addedjsdom@^16.0.0
+ Addedmathjax-full@^3.0.0
+ Addedunist-util-visit@^2.0.0
+ Added@tootallnate/once@1.1.2(transitive)
+ Added@types/unist@2.0.11(transitive)
+ Addedabab@2.0.6(transitive)
+ Addedacorn@7.4.18.12.1(transitive)
+ Addedacorn-globals@6.0.0(transitive)
+ Addedacorn-walk@7.2.0(transitive)
+ Addedagent-base@6.0.2(transitive)
+ Addedasynckit@0.4.0(transitive)
+ Addedbrowser-process-hrtime@1.0.0(transitive)
+ Addedcombined-stream@1.0.8(transitive)
+ Addedcomma-separated-tokens@1.0.8(transitive)
+ Addedcommander@9.2.0(transitive)
+ Addedcssom@0.3.80.4.4(transitive)
+ Addedcssstyle@2.3.0(transitive)
+ Addeddata-urls@2.0.0(transitive)
+ Addeddebug@4.3.7(transitive)
+ Addeddecimal.js@10.4.3(transitive)
+ Addeddelayed-stream@1.0.0(transitive)
+ Addeddomexception@2.0.1(transitive)
+ Addedescodegen@2.1.0(transitive)
+ Addedesm@3.2.25(transitive)
+ Addedesprima@4.0.1(transitive)
+ Addedestraverse@5.3.0(transitive)
+ Addedesutils@2.0.3(transitive)
+ Addedform-data@3.0.1(transitive)
+ Addedhast-util-from-dom@2.0.5(transitive)
+ Addedhast-util-is-element@1.1.0(transitive)
+ Addedhast-util-parse-selector@2.2.5(transitive)
+ Addedhast-util-to-text@2.0.1(transitive)
+ Addedhastscript@5.1.2(transitive)
+ Addedhtml-encoding-sniffer@2.0.1(transitive)
+ Addedhttp-proxy-agent@4.0.1(transitive)
+ Addedhttps-proxy-agent@5.0.1(transitive)
+ Addediconv-lite@0.4.24(transitive)
+ Addedis-potential-custom-element-name@1.0.1(transitive)
+ Addedjsdom@16.7.0(transitive)
+ Addedlodash@4.17.21(transitive)
+ Addedmathjax-full@3.2.2(transitive)
+ Addedmhchemparser@4.2.1(transitive)
+ Addedmime-db@1.52.0(transitive)
+ Addedmime-types@2.1.35(transitive)
+ Addedmj-context-menu@0.6.1(transitive)
+ Addedms@2.1.3(transitive)
+ Addednwsapi@2.2.13(transitive)
+ Addedparse5@6.0.1(transitive)
+ Addedproperty-information@5.6.0(transitive)
+ Addedpsl@1.9.0(transitive)
+ Addedpunycode@2.3.1(transitive)
+ Addedquerystringify@2.2.0(transitive)
+ Addedrepeat-string@1.6.1(transitive)
+ Addedrequires-port@1.0.0(transitive)
+ Addedsafer-buffer@2.1.2(transitive)
+ Addedsaxes@5.0.1(transitive)
+ Addedsource-map@0.6.1(transitive)
+ Addedspace-separated-tokens@1.1.5(transitive)
+ Addedspeech-rule-engine@4.0.7(transitive)
+ Addedsymbol-tree@3.2.4(transitive)
+ Addedtough-cookie@4.1.4(transitive)
+ Addedtr46@2.1.0(transitive)
+ Addedunist-util-find-after@3.0.0(transitive)
+ Addedunist-util-is@4.1.0(transitive)
+ Addedunist-util-visit@2.0.3(transitive)
+ Addedunist-util-visit-parents@3.1.1(transitive)
+ Addeduniversalify@0.2.0(transitive)
+ Addedurl-parse@1.5.10(transitive)
+ Addedw3c-hr-time@1.0.2(transitive)
+ Addedw3c-xmlserializer@2.0.0(transitive)
+ Addedweb-namespaces@1.1.4(transitive)
+ Addedwebidl-conversions@5.0.06.1.0(transitive)
+ Addedwhatwg-encoding@1.0.5(transitive)
+ Addedwhatwg-mimetype@2.3.0(transitive)
+ Addedwhatwg-url@8.7.0(transitive)
+ Addedwicked-good-xpath@1.3.0(transitive)
+ Addedws@7.5.10(transitive)
+ Addedxml-name-validator@3.0.0(transitive)
+ Addedxmlchars@2.2.0(transitive)
+ Addedxmldom-sre@0.1.31(transitive)
+ Addedxtend@4.0.2(transitive)