Gathering detailed insights and metrics for escape-latex
Gathering detailed insights and metrics for escape-latex
Gathering detailed insights and metrics for escape-latex
Gathering detailed insights and metrics for escape-latex
npm install escape-latex
99.6
Supply Chain
89.8
Quality
75.7
Maintenance
100
Vulnerability
100
License
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
19 Stars
142 Commits
4 Forks
3 Watching
23 Branches
1 Contributors
Updated on 19 Nov 2024
JavaScript (100%)
Cumulative downloads
Total Downloads
Last day
-28.6%
161,480
Compared to previous day
Last week
0.3%
1,103,940
Compared to previous week
Last month
7.9%
4,570,316
Compared to previous month
Last year
40.5%
36,498,746
Compared to previous year
Escape LaTeX special characters with Javascript in NodeJS (>= 14.x) environment.
1npm install escape-latex 2var lescape = require('escape-latex'); 3lescape("String to be escaped here #yolo");
1lescape((input: String), { 2 preserveFormatting: Boolean, 3 escapeMapFn: Function, 4});
By default,
escape-latex
only escapes characters that would result in malformed LaTeX.
These characters include # $ % & \ ^ _ { }
.
This means that the final LaTeX output might not look the same as your input Javascript string. For example, multiple spaces are kept as-is, which may be truncated to 1 space by your LaTeX software.
If you want the final output string to be as similar to your input Javascript string as possible,
you can set the preserveFormatting
param to true
, like so:
1lescape("Hello World", { preserveFormatting: true }); 2// Hello~~~World
Which will be converted to three non-breaking spaces by your LaTeX software.
The list of format characters that are escaped include space, \t (tab), – (en-dash), — (em-dash)
.
There is also the param escapeMapFn
to modify the mapping of escaped characters,
so you can add/modify/remove your own escapes if necessary.
It accepts a callback function that takes in the default character escapes and the formatting escapes as parameters, and returns a complete escape mapping. Here's an example:
1lescape("Hello World", { 2 preserveFormatting: true, 3 escapeMapFn: function (defaultEscapes, formattingEscapes) { 4 formattingEscapes[" "] = "\\\\"; 5 return Object.assign({}, defaultEscapes, formattingEscapes); 6 }, 7}); 8// Hello\\\\\\world
npm test
escape-latex < 1.0.0
,
the en-dash
and em-dash
are no longer escaped by default.
Please use preserveFormatting
to turn them on if necessary.MIT
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
2 commit(s) and 1 issue activity found in the last 90 days -- score normalized to 2
Reason
Found 0/3 approved changesets -- score normalized to 0
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2024-11-25
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More