---
+### BookStack Hacks Directory
+
+This website has a directory of available hacks [which can be found here](/hacks/).
+These make use of the [Custom HTML Head Option](#custom-html-head-option), [Visual Theme System](#visual-theme-system) and [Logical Theme System](#logical-theme-system) options listed below.
+
+---
### BookStack API
**Reference Links**
- [API documentation of our demo instance](https://demo.bookstackapp.com/api/docs).
-- [Our "BookStack API Scripts" repo containing examples](https://github.com/BookStackApp/api-scripts).
+- [Our "BookStack API Scripts" repo containing examples](https://codeberg.org/bookstack/api-scripts).
---
### Custom HTML Head Option
-Within the settings area you'll find a 'Custom HTML head content' setting. You can use this to add in any custom JavaScript or CSS content which enables you to override default BookStack functionality and styles.
+Within the "Settings > Customization" view within BookStack you'll find a "Custom HTML Head Content" setting. You can use this to add in any custom JavaScript or CSS content which enables you to override default BookStack functionality and styles.
+You can find examples of custom HTML Head customizations on the [hacks part of this site](/hacks/).
---
_**Note: The files that can be override using the theme system are not deemed to be stable. BookStack core files may change on any release causing changes in behaviour to your overrides. Theme overrides are not officially supported in any way.**_
+You can find examples visual theme system customizations on the [hacks part of this site](/hacks/).
---
_**Note: Only the API described in the logical-theme-system document is considered stable & supported. Any usage of other application classes is regarded as unstable and unsupported.**_
+You can find examples of logical theme system customizations on the [hacks part of this site](/hacks/).
+
---
-### BookStack Editor Events
+<a id="bookstack-editor-events" data-info="Anchor here for backwards compatibility of existing links"></a>
-For the core underlying libraries, used in the BookStack page editors, we emit some custom events as part of their lifecycle.
-You can listen for these events to hook in and alter their configs or to gain a reference to the underlying editor instance.
-The below code sample shows the events available; Log out the `detail` property of events, as per the below example, to understand what is passed with the events:
+### BookStack JavaScript Public Events
-```html
-<script>
- // TinyMCE WYSIWYG editor events
- window.addEventListener('editor-tinymce::pre-init', event => console.log('TINYMCE-PRE_INIT', event.detail));
- window.addEventListener('editor-tinymce::setup', event => console.log('TINYMCE-SETUP', event.detail));
-
- // CodeMirror / Markdown-it Markdown editor events
- window.addEventListener('editor-markdown-cm::pre-init', event => console.log('MARKDOWN-CODEMIRROR-PRE_INIT', event.detail));
- window.addEventListener('editor-markdown::setup', event => console.log('MARKDOWN-EDITOR-SETUP', event.detail));
-
- // Diagrams.net configure event
- // Reference: https://www.diagrams.net/doc/faq/configure-diagram-editor
- // If using a custom diagrams.net instance, via the `DRAWIO` option, you will need to ensure
- // this your URL has the `configure=1` query parameter.
- window.addEventListener('editor-drawio::configure', event => console.log('DIAGRAMS.NET-CONFIGURE', event.detail));
-</script>
-```
+To allow customization of the JavaScript libraries & components used, BookStack emits events as part of their lifecycle
+so that you can define listeners to hook into these events. These can often be used by adding scripts to the
+[custom HTML head content option](#custom-html-head-option).
+
+You can find details and a listing of all events [within the project repo here](https://github.com/BookStackApp/BookStack/blob/development/dev/docs/javascript-public-events.md).
---
<style>
.tag-pair-priority-critical .page-content { color: red; }
</style>
+```
+
+---
+
+### Export Classes
+
+When PDF or HTML exports are performed in BookStack, the underlying templates define classes to allow customization of styling in specific scenarios.
+For context, PDF exports are rendered via a conversion from HTML to PDF, so CSS styling can be applied for these but support may depend on the underlying PDF conversion engine.
+The classes are applied to the `<body>` element, and are as follows:
+
+- `export` - All HTML/PDF exports
+- `export-format-pdf` - PDF exports
+- `export-format-html` - HTML exports
+- `export-engine-dompdf` - PDF exports using the default DomPDF rendering engine
+- `export-engine-wkhtml` - PDF exports using the default DomPDF rendering engine
+- `export-engine-command` - PDF exports using the command-based PDF rendering option
+
+As an example usage, you could define the following custom style code to make paragraph text red only in PDF exports created via the default DomPDF renderer:
+
+```html
+<style>
+.export-format-pdf.export-engine-dompdf p { color: red; }
+</style>
```
\ No newline at end of file