{"name":"escape-latex","version":"1.0.1","description":"Escape LaTeX special characters with Javascript","main":"./dist/index.js","files":["dist"],"scripts":{"test":"mocha --require babel-core/register -u tdd ./src/**/*.test.js","preversion":"npm test && npm 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-preset-env":"^1.6.1","chai":"^4.1.2","eslint":"^4.15.0","eslint-config-google":"^0.9.1","eslint-config-prettier":"^2.9.0","husky":"^0.14.3","lint-staged":"^7.0.5","mocha":"^5.0.0","prettier":"^1.9.2"},"author":{"name":"Dang Mai"},"license":"MIT","gitHead":"2f37a9b39cff0bfee8456023243a5885c3a05149","bugs":{"url":"https://github.com/dangmai/escape-latex/issues"},"homepage":"https://github.com/dangmai/escape-latex#readme","_id":"escape-latex@1.0.1","_npmVersion":"5.5.1","_nodeVersion":"8.9.2","_npmUser":{"name":"dangmai","email":"contact@dangmai.net"},"dist":{"integrity":"sha512-bufASdPCqtyUA1p4KbeywqK0ehgoss2j9bCHIGSQMGRvBsj9hCI0v4Pc0vjQtwEKG4Fa2rlNEH7fGNnXqgjTKQ==","shasum":"d9cc390a837a17c038d310458641326436197317","tarball":"http://registry-npm.ywwl.com/escape-latex/download/escape-latex-1.0.1.tgz","fileCount":3,"unpackedSize":4686,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJa63jlCRA9TVsSAnZWagAARwEP/1NKjgV8QXfbHaOnZL2W\nM4cHPfaePjpCtTF6lfJ/JUlldtUZ0xiKd0AR+t5eELW92eBAeKdgJwpLy7P8\nBHutVhZUayZ2VybdXFD5W1B9blhcsawjGATry96TwQUnpgd+ROd7UYZjoVbK\nSgf2ze+ALgQqrvRn/fh4GvLKvUQtu3XG61pX4xCtNOVu9DLS8ItupuxusY/o\nN0ANUYUJB9PybNDmJ5yxaWctayYDJ6RM9OUjMppkycbjzBsM0jIavHgqVHGI\n/fcATJG236zqxJM81c9IqEdRsuIBxl7KXI9BMEOgp5MrABk/FbOAYMfWTBe+\n2LsCX+hjty2ajLny7iVZsCz7KdBDfjIW+/pyo90/6cXTZ+2GVusyZTU6UMub\nsHAiFo4QNn9b01oG2Iedputc8QnFOnlxULaF9u+2cvbZUrU1Lz3TC14sTgrK\n8rIIjxRfiNO7oYojVI2jBfagMZwzUHqv5JBFEZ/Go50/30Rx+vtC3FbYkIJV\nrt8TdEZmgz5kreAT2SROvk9upqD0+rjAez00p/GZXyH3vdSdVN0uAJcvq4wl\nvCaCPIUEKOhdFfLafYhiMTj/rN70N6oPDtsEfCS4l5D0q67IIPf5bLwxl51R\nqiMV0knOLz6CKFFxzRDOk+im15Op5oF/n5URyKMY9Evo19AS7DKADpV/BDio\nlO2T\r\n=LIFO\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIApF2qaUx+Web4nBAiEp940Y/Ajw+g8tRs76fucHUnEaAiAQLI/n4TjI15Jk9YToNM308mLVFE/PF2ZuztfemyiYaA=="}],"size":2387,"noattachment":false,"key":"/escape-latex/-/escape-latex-1.0.1.tgz"},"maintainers":[{"name":"dangmai","email":"contact@dangmai.net"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/escape-latex_1.0.1_1525381348791_0.9682818276566763"},"_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":1525381348854,"_cnpm_publish_time":1525381348854,"dist-tags":{"latest":"1.2.0","next":"1.0.0-beta.3"}}