{"id":25067352,"url":"https://github.com/digitalheir/bibtex-js","last_synced_at":"2025-04-14T20:12:03.422Z","repository":{"id":55037805,"uuid":"92252929","full_name":"digitalheir/bibtex-js","owner":"digitalheir","description":"Library for parsing .bib files, used in Bibliography.js 📚","archived":false,"fork":false,"pushed_at":"2023-01-12T08:25:28.000Z","size":2879,"stargazers_count":82,"open_issues_count":7,"forks_count":5,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-28T08:23:25.998Z","etag":null,"topics":["bib","bibliography","bibtex","javascript","latex","parser","typescript"],"latest_commit_sha":null,"homepage":"https://digitalheir.github.io/bibtex-js/","language":"TypeScript","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/digitalheir.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}},"created_at":"2017-05-24T05:22:47.000Z","updated_at":"2024-11-28T02:34:33.000Z","dependencies_parsed_at":"2023-02-09T10:46:21.288Z","dependency_job_id":null,"html_url":"https://github.com/digitalheir/bibtex-js","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/digitalheir%2Fbibtex-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/digitalheir%2Fbibtex-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/digitalheir%2Fbibtex-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/digitalheir%2Fbibtex-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/digitalheir","download_url":"https://codeload.github.com/digitalheir/bibtex-js/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248659890,"owners_count":21141202,"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","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":["bib","bibliography","bibtex","javascript","latex","parser","typescript"],"created_at":"2025-02-06T20:55:34.306Z","updated_at":"2025-04-14T20:12:03.404Z","avatar_url":"https://github.com/digitalheir.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Bibtex.js\n\n[![npm version](https://badge.fury.io/js/bibtex.svg)](https://www.npmjs.com/package/bibtex)\n[![Build Status](https://travis-ci.org/digitalheir/bibtex-js.svg?branch=master)](https://travis-ci.org/digitalheir/bibtex-js)\n[![License](https://img.shields.io/npm/l/bibtex.svg)](https://github.com/digitalheir/bibtex-js/blob/master/LICENSE)\n[![Code Climate](https://codeclimate.com/github/digitalheir/bibtex-js/badges/gpa.svg)](https://codeclimate.com/github/digitalheir/bibtex-js)\n\nLibrary for parsing BibTeX .bib files, based mostly on the excellent guide to BibTeX, [*Tame the BeaST*](http://tug.ctan.org/info/bibtex/tamethebeast/ttb_en.pdf). \n\n[Live demo in browser](https://digitalheir.github.io/bibtex-js/)\n\n\nWritten in Typescript, compiled to ES5 Javascript (with typings provided).\n\nThis module literally just parses a BibTex file and processes it **as far as BibTeX goes**. It doesn't process TeX commands (i.e., `{\\\"o}` is not translated to `ö`). It does however, parse author names, as this is part of the BibTeX standard (see example below). If you want to actually work with a bibliography, look into [Bibliography.js](https://github.com/digitalheir/bibliography-js) (which is mine) or [Citation.js](https://github.com/larsgw/citation.js) or [Zotero](https://github.com/zotero/zotero). If you want to convert LaTeX to Unicode, look into my [latex-to-unicode-converter](https://github.com/digitalheir/latex-to-unicode-converter).\n\n## Implementation\nNot all internal BibTeX functions are implemented, simply because I don't need them personally and can't imagine anyone to need them. Most notably [sorting entries is still an open issue](https://github.com/digitalheir/bibtex-js/issues/1) because BibTeX has a little complicated algorithm which required a function that \"purifies\" field values, which for example makes `{\\ss}` equivalent to `ss` but makes `ä` come after `z`. I am unsure if that is actually what anyone wants in modern days though. A modern approach would be to use Unicode collation and then sort.\n\n[Pull requests and issues are welcome.](https://github.com/digitalheir/bibtex-js/issues)\n\n## Usage\n\nDownload standalone ES5 file ([latest](https://github.com/digitalheir/bibtex-js/releases/latest)) or get [from npm](https://www.npmjs.com/package/bibtex):\n\n```\nnpm install bibtex\n```\n\n```js\nimport {parseBibFile, normalizeFieldValue} from \"bibtex\";\n\nconst bibFile = parseBibFile(`\n          @InProceedings{realscience,\n            author    = {Marteen Fredrik Adriaan ding de la Trumppert and مهدي N\\\\\"allen and henQuq, jr, Mathize},\n            title     = {You Won't Believe This Proof That {P} \\\\gtreqqless {NP} Using Super-{T}uring Computation Near Big Black Holes},\n            booktitle = {Book of Qeq},\n            month     = {September},\n            year      = {2001},\n            address   = {Dordrecht},\n            publisher = {Willems Uitgeverij},\n            url       = {https://github.com/digitalheir/},\n            pages     = {6--9}\n          }\n`);\n\nconst entry = bibFile\n  .getEntry(\"realscience\") // Keys are case-insensitive\n\nconst fieldValue = entry\n  .getField(\"TITLE\"); // This is a complex BibTeX string\n\nconsole.log(\n    // But we can normalize to a JavaScript string\n    normalizeFieldValue(fieldValue)\n); \n\nconst authorField = entry\n  .getField(\"author\"); // This is a special object, divided into first names, vons and last names according to BibTeX spec\n\nauthorField.authors$.map((author, i) =\u003e console.log(\"Author: \" \n  + (author.firstNames\n            .concat(author.vons)\n            .concat(author.lastNames)\n            .concat(author.jrs)).join(\" \")));\n\n```\n\n## Contact\nMaarten Trompper (\u003cmaartentrompper@freedom.nl\u003e)\n\n## License\n[MIT](https://github.com/digitalheir/bibtex-js/blob/master/LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdigitalheir%2Fbibtex-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdigitalheir%2Fbibtex-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdigitalheir%2Fbibtex-js/lists"}