{"id":16718750,"url":"https://github.com/planeshifter/insert-equations","last_synced_at":"2025-10-07T07:10:54.264Z","repository":{"id":148376693,"uuid":"59214160","full_name":"Planeshifter/insert-equations","owner":"Planeshifter","description":"Parse README.md files and turn LaTeX equations into SVGs.","archived":false,"fork":false,"pushed_at":"2016-05-19T15:52:38.000Z","size":21,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-06-03T07:28:48.220Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Planeshifter.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-05-19T14:29:59.000Z","updated_at":"2016-10-28T15:47:30.000Z","dependencies_parsed_at":"2023-05-19T22:30:46.045Z","dependency_job_id":null,"html_url":"https://github.com/Planeshifter/insert-equations","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Planeshifter/insert-equations","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Planeshifter%2Finsert-equations","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Planeshifter%2Finsert-equations/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Planeshifter%2Finsert-equations/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Planeshifter%2Finsert-equations/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Planeshifter","download_url":"https://codeload.github.com/Planeshifter/insert-equations/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Planeshifter%2Finsert-equations/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278735163,"owners_count":26036569,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-07T02:00:06.786Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-12T21:38:20.765Z","updated_at":"2025-10-07T07:10:54.259Z","avatar_url":"https://github.com/Planeshifter.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"insert-equations\n===\n[![NPM version][npm-image]][npm-url] [![Build Status][build-image]][build-url] [![Coverage Status][coverage-image]][coverage-url] [![Dependencies][dependencies-image]][dependencies-url]\n\n\u003e Parse README.md files and turn LaTeX equations into SVGs.\n\n\n## Installation\n\n``` bash\n$ npm install insert-equations\n```\n\n\n## Usage\n\n``` javascript\nvar insertEquations = require( 'insert-equations' );\n```\n\n#### insertEquations( dir, clbk )\n\nParses the `README.md` file in the supplied directory and inserts SVG images for all `\u003cequation\u003e` tags. The `label`, `align`, `raw` and `alt` attributes of the equation tag will be used. Upon creating the SVG images, the `README.md` file will be overwritten with the newly generated markup.\n\n``` javascript\ninsertEquations( 'mydirectory', done )\n\nfunction done( err ) {\n\tif ( err ) {\n\t\tthrow err;\n\t}\n\tconsole.log( 'README.md file successfully processed.' );\n} // end FUNCTION done()\n```\n\n## Notes\n\n*\tAs a concrete example\n\n\t``` html\n\t\u003c!-- \u003cequation class=\"equation\" label=\"eq:gamma_function_positive_integers\" align=\"center\" raw=\"\\Gamma ( n ) = (n-1)!\" alt=\"Gamma function for positive integers.\"\u003e --\u003e\n\t\u003c!-- \u003c/equation\u003e --\u003e\n\t```\n\n\twill be transformed to\n\n\t``` html\n\t\u003c!-- \u003cequation class=\"equation\" label=\"eq:gamma_function_positive_integers\" align=\"center\" raw=\"\\Gamma ( n ) = (n-1)!\" alt=\"Gamma function for positive integers.\"\u003e --\u003e\n\t\u003cdiv class=\"equation\" align=\"center\" data-raw-text=\"\\Gamma ( n ) = (n-1)!\" data-equation=\"eq:gamma_function_positive_integers\"\u003e\n\t\t\u003cimg src=\"https://cdn.rawgit.com/Planeshifter/insert-equations-examples/8fd73c14a23a0bcb1d31e7e3246ae411e11a0c70/docs/img/eqn1.svg\" alt=\"Gamma function for positive integers.\"\u003e\n\t\t\u003cbr\u003e\n\t\u003c/div\u003e\n\t\u003c!-- \u003c/equation\u003e --\u003e\n\t```\n\n*\tThe supplied directory has to be a git project with a remote branch on GitHub. Otherwise, `insertEquations` will throw an error.\n*\tBeware: `insertEquations` automatically creates a commit for the newly created files and changes to `README.md`.\n\n\n## Examples\n\n``` javascript\nvar child_process = require( 'child_process' );\nvar fs = require( 'fs-extra' );\nvar path = require( 'path' );\nvar insertEquations = require( 'insert-equations' );\n\nvar fPath = path.resolve( __dirname, './fixtures' );\nvar inputPath = path.join( fPath, '_README.md' );\nvar outputPath = path.join( fPath, 'README.md' );\n\nfs.copySync( inputPath, outputPath );\n\nchild_process.execSync( 'rm -rf .git', { cwd: fPath } );\nchild_process.execSync( 'git init', { cwd: fPath } );\nchild_process.execSync( 'git remote add origin https://github.com/Planeshifter/insert-equations-examples.git', { cwd: fPath } );\n\ninsertEquations( fPath, done );\n\nfunction done( err ) {\n\tif ( err ) {\n\t\tthrow err;\n\t}\n\tconsole.log( 'README.md file successfully processed.' );\n} // end FUNCTION done()\n```\n\nTo run the example code from the top-level application directory,\n\n``` bash\n$ node ./examples/index.js\n```\n\n\n---\n## CLI\n\n### Installation\n\nTo use the module as a general utility, install the module globally\n\n``` bash\n$ npm install -g insert-equations\n```\n\n\n### Usage\n\n``` bash\n\nUsage: insert-equations [options] [directory]\n\nOptions:\n\n  -h,    --help                Print this message.\n  -V,    --version             Print the package version.\n\n```\n\n## Notes\n\n*\tIf no `directory` is supplied, the current working directory will be used to look for a `README.md` file.\n\n\n### Examples\n\n``` bash\n$ insert-equations examples/fixtures\n```\n\n\n---\n## Tests\n\n### Unit\n\nThis repository uses [tape][tape] for unit tests. To run the tests, execute the following command in the top-level application directory:\n\n``` bash\n$ make test\n```\n\nAll new feature development should have corresponding unit tests to validate correct functionality.\n\n\n### Test Coverage\n\nThis repository uses [Istanbul][istanbul] as its code coverage tool. To generate a test coverage report, execute the following command in the top-level application directory:\n\n``` bash\n$ make test-cov\n```\n\nIstanbul creates a `./reports/coverage` directory. To access an HTML version of the report,\n\n``` bash\n$ make view-cov\n```\n\n\n### Browser Support\n\nThis repository uses [Testling][testling] for browser testing. To run the tests in a (headless) local web browser, execute the following command in the top-level application directory:\n\n``` bash\n$ make test-browsers\n```\n\nTo view the tests in a local web browser,\n\n``` bash\n$ make view-browser-tests\n```\n\n\u003c!-- [![browser support][browsers-image]][browsers-url] --\u003e\n\n\n---\n## License\n\n[MIT license](http://opensource.org/licenses/MIT).\n\n\n## Copyright\n\nCopyright \u0026copy; 2016. Philipp Burckhardt.\n\n\n[npm-image]: http://img.shields.io/npm/v/insert-equations.svg\n[npm-url]: https://npmjs.org/package/insert-equations\n\n[build-image]: http://img.shields.io/travis/Planeshifter/insert-equations/master.svg\n[build-url]: https://travis-ci.org/Planeshifter/insert-equations\n\n[coverage-image]: https://img.shields.io/codecov/c/github/Planeshifter/insert-equations/master.svg\n[coverage-url]: https://codecov.io/github/Planeshifter/insert-equations?branch=master\n\n[dependencies-image]: http://img.shields.io/david/Planeshifter/insert-equations.svg\n[dependencies-url]: https://david-dm.org/Planeshifter/insert-equations\n\n[dev-dependencies-image]: http://img.shields.io/david/dev/Planeshifter/insert-equations.svg\n[dev-dependencies-url]: https://david-dm.org/dev/Planeshifter/insert-equations\n\n[github-issues-image]: http://img.shields.io/github/issues/Planeshifter/insert-equations.svg\n[github-issues-url]: https://github.com/Planeshifter/insert-equations/issues\n\n[tape]: https://github.com/substack/tape\n[istanbul]: https://github.com/gotwarlost/istanbul\n[testling]: https://ci.testling.com\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fplaneshifter%2Finsert-equations","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fplaneshifter%2Finsert-equations","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fplaneshifter%2Finsert-equations/lists"}