retypeset-odyssey 0.1.3 → 0.1.4

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "retypeset-odyssey",
3
3
  "type": "module",
4
- "version": "0.1.3",
4
+ "version": "0.1.4",
5
5
  "packageManager": "pnpm@10.26.0",
6
6
  "repository": "https://github.com/lifeodyssey/retypeset-odyssey",
7
7
  "exports": {
@@ -34,10 +34,19 @@ const htmlEntityMap: Record<string, string> = {
34
34
  '&nbsp;': ' ',
35
35
  }
36
36
 
37
- // Cleans text by removing HTML tags and normalizing whitespace
37
+ // Cleans text by removing HTML tags and normalizing whitespace.
38
+ // Before stripping tags, inserts a middle-dot separator between adjacent
39
+ // list items so excerpts of pre-`<!-- more -->` lists still read as a list
40
+ // once flattened to a single paragraph. Without this, `<li>A</li><li>B</li>`
41
+ // flattens to whitespace-joined `A B` and the excerpt loses its structure.
38
42
  function cleanTextContent(text: string): string {
39
- // Remove HTML tags
40
- let cleanText = text.replace(/<[^>]*>/g, '')
43
+ let cleanText = text
44
+ // Adjacent list items → middle-dot separator
45
+ .replace(/<\/li>\s*<li[^>]*>/gi, '</li> · <li>')
46
+ // <br /> behaves like a space
47
+ .replace(/<br\s*\/?>/gi, ' ')
48
+ // Remove HTML tags
49
+ .replace(/<[^>]*>/g, '')
41
50
 
42
51
  // Decode HTML entities
43
52
  Object.entries(htmlEntityMap).forEach(([entity, char]) => {