{"name":"escape-latex","version":"1.1.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 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":"ce61ea0fdc080fada8d6c83cd20caa9df3abe92f","bugs":{"url":"https://github.com/dangmai/escape-latex/issues"},"homepage":"https://github.com/dangmai/escape-latex#readme","_id":"escape-latex@1.1.1","_npmVersion":"6.2.0","_nodeVersion":"10.9.0","_npmUser":{"name":"dangmai","email":"contact@dangmai.net"},"dist":{"integrity":"sha512-N2D6Z2kXh8x/pQNQH+natXDCwrzghhXMRII5dZ518mlTLeuba80NL0LCQyaahqOrAidoLivmmG6GKPnGhHse+A==","shasum":"657d8632af8849a5db8766778d4a43da9dec3376","tarball":"http://registry-npm.ywwl.com/escape-latex/download/escape-latex-1.1.1.tgz","fileCount":4,"unpackedSize":7468,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbeydfCRA9TVsSAnZWagAAv9EP/3VXtIzyuVdHwQ0uLKK4\n9jaGvS7GMknquLtyR1ky/36yI/WPKm5kiI+zYsIvjCKvYUZTWTtquw/0WO6K\nPa/xd4WAZRVEcA2cePlCjhnEUhtFJgKQTAGUpVOApN+JO1wtUJ6LsTJI7MQx\nb/qGFrUq/PBIMKPbmGgVkRklisH36yjOS0EJmTnOPX33gdFE7fgV2EcwT3pt\naiNW2rtCiJE2Nc8zr4ZjnRuIH8XPT1oPPFiENLsJ63aPzLTeWPs2KQGHjiak\nZssFUEKPk6owVPGYbUr5Z0B7kMMhUQAOHhm0W8sz8seFDsz1R2bF2NSx1Igf\noYecVG6ETE7Sq7JhuIiz4yWDwW3FvdqKCQNGuInRmU/vn+Vw47arncF7fi+I\nTnyllocYv1f8ZKHzs0kWs2vOzia4e7EI4F9lDcehEPgqrtPSfHslSZjIzdZb\nkgGg7FcWD4gi9fDQrVjY6jZ5HQC2/R/1/NlWgYjU50ytmuoSzM24Mv4gDCA6\nhWX/n1zfQGFxKgF/sxmOGBSeYS865rrWCTIWn3JUDnIRZnxyVj2N5FwVJSYJ\nUXwkV8dprkm7FP8o0WQgem74cl3iFsWvkD2auDojPpt1pSl4iyv23pWhHQwy\nyWvynv1ANdnHX0jR4C6TvixIPwElAzfQvtnBobjAT8AnWc9VfjX7jxymfE4X\nYnVT\r\n=hA4T\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIC76cw59U33pm+vqCjj6gCRZ4zIH8fS6DhhuGeb9yQOWAiBUyueMNZqRBtgB5L5jOoP46DuM2XONk37Ze6dlqbtaww=="}],"size":3372,"noattachment":false,"key":"/escape-latex/-/escape-latex-1.1.1.tgz"},"maintainers":[{"name":"dangmai","email":"contact@dangmai.net"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/escape-latex_1.1.1_1534797663355_0.9020681057912046"},"_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":1534797663487,"_cnpm_publish_time":1534797663487,"dist-tags":{"latest":"1.2.0","next":"1.0.0-beta.3"}}