{"name":"escape-latex","version":"0.1.3","description":"Escape LaTeX special characters with Javascript","main":"index.js","scripts":{"test":"mocha -u tdd"},"repository":{"type":"git","url":"git+https://github.com/dangmai/escape-latex.git"},"keywords":["latex","escape"],"devDependencies":{"mocha":"2.4.5","chai":"3.5.0"},"author":{"name":"Dang Mai"},"license":"MIT","gitHead":"b08776dfd6b2e8eeafca88bf22679d22163d9815","bugs":{"url":"https://github.com/dangmai/escape-latex/issues"},"homepage":"https://github.com/dangmai/escape-latex#readme","_id":"escape-latex@0.1.3","_shasum":"97efd3e6421b89a37e19c686b0ca600f91650c1c","_from":".","_npmVersion":"3.6.0","_nodeVersion":"5.7.1","_npmUser":{"name":"dangmai","email":"contact@dangmai.net"},"dist":{"shasum":"97efd3e6421b89a37e19c686b0ca600f91650c1c","tarball":"http://registry-npm.ywwl.com/escape-latex/download/escape-latex-0.1.3.tgz","integrity":"sha512-r2enrdSO0fnCaUbXS83T/upAdYSPmut9DC51zpgMsJIA0vkR9xYLfTLaOdo1HbPJ+qQ3ErqZ6P7sHOm8ZaFZ2A==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDbCXQf40H/gVujgjsbDqaYwg/PvLuiubHfuRF5FcU8twIhAMWyqDyl8uw7NTSF1ushZ22zN4O1XmSZL0b3pvRc8pxf"}],"size":2872,"noattachment":false,"key":"/escape-latex/-/escape-latex-0.1.3.tgz"},"maintainers":[{"name":"dangmai","email":"contact@dangmai.net"}],"_npmOperationalInternal":{"host":"packages-13-west.internal.npmjs.com","tmp":"tmp/escape-latex-0.1.3.tgz_1457639747924_0.1608553749974817"},"directories":{},"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":1457639751693,"_cnpm_publish_time":1457639751693,"dist-tags":{"latest":"1.2.0","next":"1.0.0-beta.3"}}