They can cause instability, introduce issues and may conflict with future updates. Apply at your own risk!
Dynamic Glossary
This hack adds the ability to write global and book-level glossaries, which will then be utilised when viewing pages by marking those words in page content with a dashed underline. On hover, the set definitions will show in a popup below the word.
Considerations
- This will only work for single-word terms (terms without a space). Multi-word terms would require more complex and computationally costly logic.
- The term matching is quite simplistic and case-insensitive, with words/terms trimmed, lower-cased, and with common punctuation trimmed before matching.
- This runs in the browser after a page has loaded, so the term highlighting may seem to pop-in just after page load.
- This will perform requests in the background to load in the definitions from other pages.
- The glossary terms are stored after the first fetch, so changes to the glossary may not be represented. You can force a refresh of this by opening a relevant “glossary page”.
- Accessibility has not been considered in this implementation.
- This will only work for standard page viewing, not for exports and other page viewing options.
Usage
“Glossary pages” are just normal BookStack pages, but with their content in the format:
|
|
For example:
Create a page somewhere in your instance to act as the global glossary.
With the hack code added to the “Custom HTML Head Content”, find the defaultGlossaryPage
and tweak the path to match that of your created global glossary page. You should only need to change the my-book
and main-glossary
parts of the text, don’t change the format or other parts of that. Then save your changes.
That’s the global glossary configured. Any matching terms in page content will then be converted to a highlighted term on page view. The hack will also look-up a book-level glossary page at the <book-url>/pages/glossary
URL. The terms in this book-level glossary page will override those in the global glossary. You can create this in the same manner as the global glossary, but it just needs to be part of the intended book, and named “Glossary”, so that it’s available on the expected path within the book.
Glossary terms are stored after being loaded, to avoid extra requests and loading time. You can view a glossary page to force the terms to be re-loaded and re-stored from that glossary page.
Code
head.html
|
|
Request an Update
Hack not working on the latest version of BookStack?
You can request this hack to be updated & tested for a small one-time fee.
This helps keeps these hacks updated & maintained in a sustainable manner.
Latest Hacks
Dynamic Glossary
This hack adds the ability to write global and book-level glossaries, which will then be utilised when viewing pages by marking those words in page content with a dashed underline. »
Prune Revisions Command
This hack registers a custom command using the logical theme system, which will prune the revisions of a specific page to just those with a changelog provided (in addition to the current revision), before resetting the revision numbers across the remaining versions to be sequential without gaps. »
Format Webhooks for Pushover
This is a hack to adapt outgoing webhooks from BookStack so that they are directly compatible with the pushover message API. »
WYSIWYG Docx Import
This hack adds the ability to import “.docx” files into the WYSIWYG editor, by dragging and dropping a “docx” file into the editor area. »