BookStack icon indicating copy to clipboard operation
BookStack copied to clipboard

Support tag classes on HTML Exports

Open Jakob-Espersen opened this issue 4 months ago • 5 comments

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

Jakob-Espersen avatar Sep 02 '25 14:09 Jakob-Espersen

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 avatar Sep 02 '25 15:09 ssddanbrown

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 avatar Oct 06 '25 13:10 seePyou

@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 avatar Oct 06 '25 16:10 ssddanbrown

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 avatar Oct 13 '25 08:10 seePyou

@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 avatar Oct 13 '25 11:10 ssddanbrown