{"name":"escape-latex","version":"1.2.0","description":"Escape LaTeX special characters with Javascript","main":"./dist/index.js","scripts":{"test":"mocha --require babel-core/register -u tdd ./src/**/*.test.js","preversion":"npm test && npm run build","postversion":"git push && git push --tags","precommit":"npm run lint && lint-staged","prettier":"prettier --write ./src/**/*.js","lint":"eslint ./src","init":"mkdir dist","clean":"rm -rf dist","prebuild":"npm run clean && npm run init","build":"babel ./src -d ./dist --ignore index.test.js"},"lint-staged":{"*.{js,json,css,md}":["npm run prettier","git add"]},"eslintConfig":{"parserOptions":{"ecmaVersion":8},"extends":["eslint:recommended","google","prettier"],"env":{"node":"true"}},"prettier":{"trailingComma":"all"},"repository":{"type":"git","url":"git+https://github.com/dangmai/escape-latex.git"},"keywords":["latex","escape"],"devDependencies":{"babel-cli":"^6.26.0","babel-core":"^6.26.0","babel-plugin-transform-object-assign":"^6.22.0","babel-preset-env":"^1.6.1","chai":"^4.1.2","eslint":"^5.0.1","eslint-config-google":"^0.9.1","eslint-config-prettier":"^3.0.1","husky":"^0.14.3","lint-staged":"^7.0.5","mocha":"^5.0.0","prettier":"^1.9.2"},"author":{"name":"Dang Mai"},"license":"MIT","gitHead":"15cc5ef8572ba0fe7e0d96ec4339ceec549c8d6b","bugs":{"url":"https://github.com/dangmai/escape-latex/issues"},"homepage":"https://github.com/dangmai/escape-latex#readme","_id":"escape-latex@1.2.0","_npmVersion":"6.4.1","_nodeVersion":"8.12.0","_npmUser":{"name":"dangmai","email":"contact@dangmai.net"},"dist":{"integrity":"sha512-nV5aVWW1K0wEiUIEdZ4erkGGH8mDxGyxSeqPzRNtWP7ataw+/olFObw7hujFWlVjNsaDFw5VZ5NzVSIqRgfTiw==","shasum":"07c03818cf7dac250cce517f4fda1b001ef2bca1","tarball":"http://registry-npm.ywwl.com/escape-latex/download/escape-latex-1.2.0.tgz","fileCount":4,"unpackedSize":7474,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJb1LZ+CRA9TVsSAnZWagAAjMAP/jBPKHZ2+Uyl+l9aG3Xv\nreN3ZH5FZNa7FwQyICTvQ+OAKQUNE4nVt7A2/VrFGYi/K2ja2Ix1U+SgoDzt\naepZxIfyWbB7MCOmMr35Ldmomq/vtCjYQyhpMZDi3Iz/tE4ZRgoHVIwoRrQJ\nTCSoSOU4WvKeOho95vcgBKEbfRKGuYc3oTfTxLSheR9oaItPMTiuME0D+Ast\nnsp6YHm8R3XynYTrXwLyPcSPpUat/xOwz26PmUIeVjh2FkuG+I7vpwJiQa49\n+MKjF5jt6mJpBEWuJzmMaCHE3sW8NHNVkfeysj7qgD/cKqG/hWrG3QtL02tN\n8scPiMWZNVXO5JVU8mad4UUCdBLFqUE0MrXLzJSKJbdO38In1bascjymLKsW\nhJr7aNIhC5OmtjGbvVIIdZu9mqGoIDUC9tOAxyE0XvEPM35x9A4mF1+MdbhR\nHsfMiniVLujMZrRvvfuAlVxhSsaQIHbxXxoEwC1iBo8bGJUIxlq438Ao2fZL\nOe12gloFKGMNmy9horQyP9u2pMQrtjvhKE30ZRKM6DJIhhEqxCA8kIVeSdbP\n7k7ZHKBmc+p2/RCCigdqyEMPVKQo98SdqYKyk/e0Ml8Qxe8Mdl4GiVSK2ukU\nt2za4aBz6ySQaMC3SYIQdCDqhNR6/53UaUdG+sb5BKpskDfTiZVgO2xzi5rW\nbcbX\r\n=xTyh\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDgKbIHj4ttkL3RBIlzACIZWbLj5CFF5hjzFt6yv1CHAAiAfccB+KiRFsozEQJCy3WNnwTgVeIvEWhxd6t9wFxhihw=="}],"size":3377,"noattachment":false,"key":"/escape-latex/-/escape-latex-1.2.0.tgz"},"maintainers":[{"name":"dangmai","email":"contact@dangmai.net"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/escape-latex_1.2.0_1540667005948_0.37336630788936165"},"_hasShrinkwrap":false,"readme":"# escape-latex\n\n[![Greenkeeper badge](https://badges.greenkeeper.io/dangmai/escape-latex.svg)](https://greenkeeper.io/)\n\n[![Build Status](https://travis-ci.org/dangmai/escape-latex.png)](https://travis-ci.org/dangmai/escape-latex)\n\nEscape LaTeX special characters with Javascript in NodeJS (>= 4.x) environment.\n\n## Usage\n\n```javascript\nnpm install escape-latex\nvar lescape = require('escape-latex');\nlescape(\"String to be escaped here #yolo\");\n```\n\n## API\n\n```javascript\nlescape((input: String), {\n  preserveFormatting: Boolean,\n  escapeMapFn: Function,\n});\n```\n\nBy default,\n`escape-latex` only escapes characters that would result in malformed LaTeX.\nThese characters include `# $ % & \\ ^ _ { }`.\n\nThis means that the final LaTeX output might not look the same as your input Javascript string.\nFor example, multiple spaces are kept as-is, which may be truncated to 1 space by your LaTeX software.\n\nIf you want the final output string to be as similar to your input Javascript string as possible,\nyou can set the `preserveFormatting` param to `true`, like so:\n\n```javascript\nlescape(\"Hello   World\", { preserveFormatting: true });\n// Hello~~~World\n```\n\nWhich will be converted to three non-breaking spaces by your LaTeX software.\n\nThe list of format characters that are escaped include `space, \\t (tab), – (en-dash), — (em-dash)`.\n\nThere is also the param `escapeMapFn` to modify the mapping of escaped characters,\nso you can add/modify/remove your own escapes if necessary.\n\nIt 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:\n\n```javascript\nlescape(\"Hello   World\", {\n  preseveFormatting: true,\n  escapeMapFn: function(defaultEscapes, formattingEscapes) {\n    formattingEscapes[\" \"] = \"\\\\\\\\\";\n    return Object.assign({}, defaultEscapes, formattingEscapes);\n  },\n});\n// Hello\\\\\\\\\\\\world\n```\n\n## Testing\n\n```\nnpm test\n```\n\n## Notes\n\n* If you are updating from `escape-latex < 1.0.0`,\n  the `en-dash` and `em-dash` are no longer escaped by default.\n  Please use `preserveFormatting` to turn them on if necessary.\n\n## License\n\nMIT\n","publish_time":1540667006058,"_cnpm_publish_time":1540667006058,"dist-tags":{"latest":"1.2.0","next":"1.0.0-beta.3"}}