glossarify-md
glossarify-md copied to clipboard
One empty heading breaks glossarify-md, doesn't render any terms, terminates
Describe the bug When you have a file with an empty H4 heading (####) somewhere in your source files, glossarify now runs forever, generates no links and then crashes with a terrible cryptic error message
It appears to have surfaced in the past weeks.
☛ Reading from: /home/christophc/learn_glossarify/docs
☛ Writing to: /home/christophc/learn_glossarify/docs-glossarified
glossary.md: no issues found
pages/page1.md: no issues found
pages/page2.md: no issues found
TypeError: Cannot read properties of undefined (reading 'localeCompare')
at file:///home/christophc/node_modules/glossarify-md/lib/exporter.js:60:42
at Array.sort (<anonymous>)
at exportGlossaries (file:///home/christophc/node_modules/glossarify-md/lib/exporter.js:60:10)
at Module.run (file:///home/christophc/node_modules/glossarify-md/lib/main.js:26:15)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async file:///home/christophc/node_modules/glossarify-md/bin/index.js:210:13
To Reproduce glossarify-631-empty-header-defect.zip
Steps to reproduce the behavior:
I created a mini project, after spending hours isolating where the problem in our overall source code base was.
- unzip the file
- run npm glossarify
- get the same terrible error message
Expected behavior A clear and concise error message about which file, term, etc. was processed that caused the "undefined" crash.
Screenshots

Desktop (please complete the following information):
- OS: Ubuntu 21.10
- glossarify-md version: 6.3.1