Support tag classes on HTML Exports #5420

Open
opened 2026-02-05 10:03:17 +03:00 by OVERLORD · 5 comments
Owner

Originally created by @Jakob-Espersen on GitHub (Sep 2, 2025).

Describe the Bug

We have some custom css that uses the tags applied on the page via classes in

body:not(.tag-pair-contenttype-policy) ol li::before { //styles }

This will work in bookstack where the body looks like

<body class="tag-name-contenttype tag-value-policy tag-pair-contenttype-policy tri-layout " />

But on exported content it doesn't work because the body looks like this

<body class="export export-format-html export-engine-none">

Steps to Reproduce

  1. Add tag class specific styling in Custom HTML Head Content
  2. See that it works on page
  3. export to html
  4. now style wont work since tag classes are missing from body

Expected Behaviour

I would like the same tag classed to be applied on the exported body

Screenshots or Additional Context

No response

Browser Details

No response

Exact BookStack Version

v25.05.1

Originally created by @Jakob-Espersen on GitHub (Sep 2, 2025). ### Describe the Bug We have some custom css that uses the tags applied on the page via classes in <body> `body:not(.tag-pair-contenttype-policy) ol li::before { //styles }` This will work in bookstack where the body looks like `<body class="tag-name-contenttype tag-value-policy tag-pair-contenttype-policy tri-layout " />` But on exported content it doesn't work because the body looks like this `<body class="export export-format-html export-engine-none">` ### Steps to Reproduce 1. Add tag class specific styling in Custom HTML Head Content 2. See that it works on page 3. export to html 4. now style wont work since tag classes are missing from body ### Expected Behaviour I would like the same tag classed to be applied on the exported body ### Screenshots or Additional Context _No response_ ### Browser Details _No response_ ### Exact BookStack Version v25.05.1
OVERLORD added the 🔨 Feature Request🚚 Export System labels 2026-02-05 10:03:17 +03:00
Author
Owner

@ssddanbrown commented on GitHub (Sep 2, 2025):

Thanks @Jakob-Espersen, I've recategorised this as a feature request since it's not a bug in something which has been supported before.

We could set the tags for the exported item, but I'm not sure on the correct approach for the child items.
We could maybe wrap them up in a container to add tag classes to.
Or maybe we should ignore child items for this scenario, to re-affirm that tag classes are scoped to the body.

@ssddanbrown commented on GitHub (Sep 2, 2025): Thanks @Jakob-Espersen, I've recategorised this as a feature request since it's not a bug in something which has been supported before. We could set the tags for the exported item, but I'm not sure on the correct approach for the child items. We could maybe wrap them up in a container to add tag classes to. Or maybe we should ignore child items for this scenario, to re-affirm that tag classes are scoped to the body.
Author
Owner

@seePyou commented on GitHub (Oct 6, 2025):

I would like to support this idea for reasons of working on the documentation with AI. Tags link things together nicely and offer a combined search for closely related items, so I'd like to be able to have an "editor" that already knows what tags exist, so that I don't make tags that are too close to double up. No "network" vs "networks" etc.
Being able to show the AI the export with the tag would be amazing.
If I may, my suggestion for tag export would be
title of thing (book or chapter or page)
tags
content of thing (description for books or chapter, body for pages).

For my use case I don't need the html to have the tags, but I would like to see that in the .md export, or the plain txt export, in the format I described.

@seePyou commented on GitHub (Oct 6, 2025): I would like to support this idea for reasons of working on the documentation with AI. Tags link things together nicely and offer a combined search for closely related items, so I'd like to be able to have an "editor" that already knows what tags exist, so that I don't make tags that are too close to double up. No "network" vs "networks" etc. Being able to show the AI the export with the tag would be amazing. If I may, my suggestion for tag export would be title of thing (book or chapter or page) tags content of thing (description for books or chapter, body for pages). For my use case I don't need the html to have the tags, but I would like to see that in the .md export, or the plain txt export, in the format I described.
Author
Owner

@ssddanbrown commented on GitHub (Oct 6, 2025):

@seePyou If you're already automating with AI, your process may be better suited to using the BookStack REST API which can provide responses in a more detailed & structured format, including tags, which could then be used in ways customized to your needs.

@ssddanbrown commented on GitHub (Oct 6, 2025): @seePyou If you're already automating with AI, your process may be better suited to using the BookStack REST API which can provide responses in a more detailed & structured format, including tags, which could then be used in ways customized to your needs.
Author
Owner

@seePyou commented on GitHub (Oct 13, 2025):

I could be blind, but I cannot find an API call to get a list of all TAGS in my database. I see that I can export pages with their tags and then use:

TAGS_ARRAY=$(echo "$API_RESPONSE" | jq -r '[.tags[].name] | join(", ")')

to get a list of the tags in the page, but I don't see how I can just get all the tags I currently have. Am I just not reading well?

@seePyou commented on GitHub (Oct 13, 2025): I could be blind, but I cannot find an API call to get a list of all TAGS in my database. I see that I can export pages with their tags and then use: TAGS_ARRAY=$(echo "$API_RESPONSE" | jq -r '[.tags[].name] | join(", ")') to get a list of the tags in the page, but I don't see how I can just get all the tags I currently have. Am I just not reading well?
Author
Owner

@ssddanbrown commented on GitHub (Oct 13, 2025):

@seePyou That's correct, there currently is no specific API endpoint/method to get all tags in the system (without paging through many items).

@ssddanbrown commented on GitHub (Oct 13, 2025): @seePyou That's correct, there currently is no specific API endpoint/method to get all tags in the system (without paging through many items).
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#5420