Installations
npm install escape-latex
Score
99.6
Supply Chain
89.8
Quality
75.7
Maintenance
100
Vulnerability
100
License
Releases
Unable to fetch releases
Developer
dangmai
Developer Guide
Module System
CommonJS
Min. Node Version
Typescript Support
No
Node Version
8.12.0
NPM Version
6.4.1
Statistics
19 Stars
142 Commits
4 Forks
3 Watching
23 Branches
1 Contributors
Updated on 19 Nov 2024
Languages
JavaScript (100%)
Total Downloads
Cumulative downloads
Total Downloads
112,742,138
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
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
escape-latex
Escape LaTeX special characters with Javascript in NodeJS (>= 14.x) environment.
Usage
1npm install escape-latex 2var lescape = require('escape-latex'); 3lescape("String to be escaped here #yolo");
API
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
Testing
npm test
Notes
- If you are updating from
escape-latex < 1.0.0
, theen-dash
andem-dash
are no longer escaped by default. Please usepreserveFormatting
to turn them on if necessary.
License
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
- Info: project has a license file: LICENSE.md:0
- Info: FSF or OSI recognized license: MIT License: LICENSE.md:0
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
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/auto-merge.yml:11: update your workflow using https://app.stepsecurity.io/secureworkflow/dangmai/escape-latex/auto-merge.yml/master?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/auto-merge.yml:12: update your workflow using https://app.stepsecurity.io/secureworkflow/dangmai/escape-latex/auto-merge.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/tests.yml:27: update your workflow using https://app.stepsecurity.io/secureworkflow/dangmai/escape-latex/tests.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/tests.yml:30: update your workflow using https://app.stepsecurity.io/secureworkflow/dangmai/escape-latex/tests.yml/master?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/tests.yml:42: update your workflow using https://app.stepsecurity.io/secureworkflow/dangmai/escape-latex/tests.yml/master?enable=pin
- Warn: npmCommand not pinned by hash: .github/workflows/tests.yml:36
- Info: 0 out of 3 GitHub-owned GitHubAction dependencies pinned
- Info: 0 out of 2 third-party GitHubAction dependencies pinned
- Info: 0 out of 1 npmCommand dependencies pinned
Reason
detected GitHub workflow tokens with excessive permissions
Details
- Warn: no topLevel permission defined: .github/workflows/auto-merge.yml:1
- Warn: no topLevel permission defined: .github/workflows/tests.yml:1
- Info: no jobLevel write permissions found
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 27 are checked with a SAST tool
Score
3.6
/10
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