Types and utilities for working with CITATION.cff files in TypeScript.
The Citation File Format provides citation metadata for software and datasets in YAML.
npm install cffjsimport { readCFF, writeCFF, validateCFF } from 'cffjs';
const cff = readCFF('./CITATION.cff');
validateCFF(cff);
writeCFF(cff, './output');readCFF(file)- Read CFF data from aCITATION.cfffile (or directory containing one). Returns the parsed object without validation.writeCFF(cff, directory)- Write CFF data asCITATION.cffinto the given directory, creating it if needed.
validateCFF(input)- Validate an in-memory CFF object against the CFF 1.2.0 JSON schema. Throws on failure.validateCFFFile(file)- Read a CFF file and validate it. Throws on failure.
Convert MyST frontmatter into CFF data:
mystFrontmatterToCFF(frontmatter, abstract?)- Convert MySTPageFrontmatterinto a complete CFF document.mystFrontmatterToCFFReference(frontmatter, abstract?)- Convert MySTPageFrontmatterinto a CFFReferenceentry.
The package exports TypeScript types for CFF, ReferenceCFF, PersonCFF, EntityCFF, and IdentifierCFF, along with the ReferenceType and ReferenceStatus enums.
- Reading, writing, and validating
CITATION.cfffiles - Conversion from MyST frontmatter to CFF
- CFF version 1.2.0 only
- Conversion to MyST frontmatter
- Support for other CFF versions
- Conversion to/from other formats (e.g. BibTeX)
- CLI
Made with love by
Continuous Science Foundation