usfm2html 0.1.0 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,20 +1,20 @@
1
- # usfm2html-cli
1
+ # usfm2html
2
2
 
3
3
  Convert USFM to HTML using Proskomma and Sofria renderers.
4
4
 
5
- Repository: `https://github.com/unfoldingWord/node-usfm2html-cli`
5
+ Repository: `https://github.com/unfoldingWord/node-usfm2html`
6
6
 
7
7
  ## Install
8
8
 
9
9
  ```
10
10
  # npm
11
- npm install -g usfm2html-cli
11
+ npm install -g usfm2html
12
12
 
13
13
  # pnpm
14
- pnpm add -g usfm2html-cli
14
+ pnpm add -g usfm2html
15
15
 
16
16
  # yarn
17
- yarn global add usfm2html-cli
17
+ yarn global add usfm2html
18
18
  ```
19
19
 
20
20
  ## Usage
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "usfm2html",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "type": "module",
5
5
  "engines": {
6
6
  "node": ">=18",
package/src/index.js CHANGED
@@ -27,6 +27,7 @@ const renderFlags = {
27
27
  showCharacterMarkup: true,
28
28
  showParaStyles: true,
29
29
  selectedBcvNotes: [],
30
+ showFirstVerseLabel: true,
30
31
  };
31
32
 
32
33
  const extraCss = `
@@ -447,6 +448,10 @@ p.paras_usfm_q:has(> .marks_chapter_label) {
447
448
  .implied-word-end {
448
449
  display: none;
449
450
  }
451
+
452
+ section.chapters {
453
+ margin-left: 20px;
454
+ }
450
455
  `;
451
456
 
452
457
  const buildCss = () => {
@@ -469,16 +474,6 @@ const parseHtml = (html, book, titleText, showChapters = true) => {
469
474
  const safeTitle = escapeAttribute(rawTitle);
470
475
  let updated = html.replace(/<p /, `<p id="nav-${book}" `);
471
476
 
472
- updated = updated.replaceAll(
473
- /<span id="chapter-(\d+)-verse-(\d+)"([^>]*)>(\d+)<\/span>/g,
474
- `<span id="nav-${book}-$1-$2"$3><a href="#nav-${book}-$1-$2" class="header-link">$4</a></span>`
475
- );
476
-
477
- updated = updated.replaceAll(
478
- /<span id="chapter-(\d+)"([^>]+)>([\d]+)<\/span>/gi,
479
- `<span id="nav-${book}-$1"${showChapters && safeTitle ? ` data-toc-title="${safeTitle} $1"` : ''}$2><a href="#nav-${book}-$1-1" class="header-link">$3</a></span>`
480
- );
481
-
482
477
  updated = updated.replace(/<span([^>]+style="[^">]+#CCC[^">]+")/gi, '<span$1 class="footnote"');
483
478
  updated = updated.replace(/[\u00A0\u202F\u2009 ]+/g, ' ');
484
479
  updated = updated.replace(/(\d{1,3})(?:\s*,\s*\d{3})+\b/g, (m) => m.replace(/\s*,\s*/g, ','));
@@ -492,7 +487,7 @@ const parseHtml = (html, book, titleText, showChapters = true) => {
492
487
  });
493
488
  }
494
489
 
495
- return `\n<div class="section bible-book" id="nav-${book}"${safeTitle ? ` data-toc-title="${safeTitle}"` : ''}>\n${updated}\n</div>\n`;
490
+ return updated;
496
491
  };
497
492
 
498
493
  const normalizeUsfm = (usfm) => {