This library takes in USFM text, and outputs it into a JSON format. It also takes JSON formatted scripture and outputs it into USFM.
npm install usfm-js
var usfm = require('usfm-js');
//Convert from USFM to JSON
var toJSON = usfm.toJSON(/**USFM Text**/);
//JSON to USFM
var toUSFM = usfm.toUSFM(toJSON, {forcedNewLines: true}); // if forcedNewLines is true, then USFM word and alignment markers will start on new line (defaults to false)
- Expected format for usfm is standard \h \id \c \p \v
- More here: http://ubsicap.github.io/usfm/
- Expected format for JSON is the same as when exported from USFM
-
{ 1:{ 1: "This is the first verse", 2: "This is the second verse", ... }, 2:{ 1: "This is the first verse of the second chapter", 2: "This is the second verse of the second chapter", ... } }
-
-
Make sure unit tests pass:
npm i
npm test