# bibtex

> Library for parsing a BiBTeX file in pure Javascript / Typescript

Latest version **0.9.0** (published 2017-09-09) · MIT license · 0 weekly downloads

## Install

```sh
npm install bibtex
pnpm add bibtex
yarn add bibtex
bun add bibtex
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.9.0 |
| Published | 2017-09-09 |
| First published | 2017-05-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 85 |
| Author | Maarten Trompper |
| Maintainers | digitalheir |
| Keywords | bibtex, parser |

## Links

- npm: https://www.npmjs.com/package/bibtex
- Repository: https://github.com/digitalheir/bibtex-js
- Homepage: https://github.com/digitalheir/bibtex-js#readme
- Issues: https://github.com/digitalheir/bibtex-js/issues
- npm.io page: https://npm.io/package/bibtex

## Alternatives

- [babylon](https://npm.io/package/babylon.md) — 5.1M weekly downloads
- [csscolorparser](https://npm.io/package/csscolorparser.md) — 3.7M weekly downloads
- [expr-eval-fork](https://npm.io/package/expr-eval-fork.md) — 1.5M weekly downloads
- [@leeoniya/ufuzzy](https://npm.io/package/@leeoniya/ufuzzy.md) — 247.7K weekly downloads
- [xml-parser](https://npm.io/package/xml-parser.md) — 78.4K weekly downloads

## Recent versions

- 0.9.0 (latest) — 2017-09-09
- 0.5.0 — 2017-09-09
- 0.4.2 — 2017-09-09
- 0.4.1 — 2017-08-09
- 0.4.0 — 2017-08-09
- 0.3.1 — 2017-08-07
- 0.3.0 — 2017-08-07
- 0.2.2 — 2017-05-25
- 0.2.1 — 2017-05-25
- 0.2.0 — 2017-05-25
- 0.1.0 — 2017-05-25

## README

# bibtex-js 

[![npm version](https://badge.fury.io/js/bibtex.svg)](https://badge.fury.io/js/bibtex)
[![Build Status](https://travis-ci.org/digitalheir/bibtex-js.svg?branch=master)](https://travis-ci.org/digitalheir/bibtex-js)
[![License](https://img.shields.io/npm/l/bibtex.svg)](https://github.com/digitalheir/bibtex-js/blob/master/LICENSE)
[![Code Climate](https://codeclimate.com/github/digitalheir/bibtex-js/badges/gpa.svg)](https://codeclimate.com/github/digitalheir/bibtex-js)


[Live demo in browser](https://digitalheir.github.io/bibtex-js/)

Library 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). 

Written in Typescript, compiled to ES5 Javascript (with typings provided).

This 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 `ö`). If you want to actually work with a bibliography, look for [Bibliography.js](https://github.com/digitalheir/bibliography-js).

## Implementation
Not all internal BibTeX functions are implemented, simply because I don't need them personally. 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.

[Pull requests and issues are welcome.](https://github.com/digitalheir/bibtex-js/issues)

## Usage

```js
import {parseBibFile} from "bibtex";

const bibFile = parseBibFile(`

@InProceedings{mut2011,
  author    = {Pradeep Muthukrishnan and Dragomir Radev and Qiaozhu Mei},
  title     = {Simultaneous Similarity Learning and Feature-Weight Learning for Document Clustering},
  booktitle = {Proceedings of TextGraphs-6: Graph-based Methods for Natural Language Processing},
  month     = {June},
  year      = {2011},
  address   = {Portland, Oregon},
  publisher = {Association for Computational Linguistics},
  url       = {http://www.aclweb.org/anthology/W11-1107},
  pages = {42--50}
}
`);

console.log(
    // Keys are case-insensitive
    bibFile.getEntry("MUT2011").getField("TITLE")
); // Prints some complicated string
```

## License
[MIT](https://github.com/digitalheir/bibtex-js/blob/master/LICENSE)

---
_Source: https://npm.io/package/bibtex · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
