Skip to content

fix: fix hardcoded colors scheme for exported notes.html - #25033

Merged
antobinary merged 2 commits into
bigbluebutton:v3.0.x-developfrom
GuiLeme:fix-hardcoded-color
May 13, 2026
Merged

antobinary merged 2 commits into
bigbluebutton:v3.0.x-developfrom
GuiLeme:fix-hardcoded-color

Conversation

@GuiLeme

@GuiLeme GuiLeme commented May 7, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Previously, when exporting a notes.html, we had to deal with hardcoded colors within inline styles.

To resolve that, I put a color variables scheme based on the actual scheme used by BlockNote for light and dark themes.

Motivation

Other integrations might want to use the dark theme which ended up having low contrast between the text color and the highlighted background (as block-note's highlight colors are really desaturated).

How to test

One can test it by just exporting a BlockNote document in html, pdf, etc., and seeing how it looks (Ideally nothing should change). Moreover, one can also edit the html generated to add a class class="dark" to the html tag, and in this case achieve the dark theme

@coderabbitai

coderabbitai Bot commented May 7, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack
No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: a888c1b9-94fd-4172-9ae9-c529d5327578

📥 Commits

Reviewing files that changed from the base of the PR and between 8ae2590 and 39401c8.

📒 Files selected for processing (1)
  • bbb-shared-notes-server/src/express/handlers/exportDocumentToHtml.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • bbb-shared-notes-server/src/express/handlers/exportDocumentToHtml.ts

Walkthrough

The exportDocumentToHtml handler in the BigBlueButton shared notes server now post-processes generated HTML to normalize blank line representation, remove hardcoded inline styles from BlockNote-generated spans, and apply themeable CSS colors via CSS variables. Empty paragraph tags are replaced with <p><br></p> to preserve visual spacing. Inline style attributes are stripped from spans while retaining their data-style-type and data-value metadata. New CSS variables and selectors are added to support light and dark theme color customization for both text and background colors mapped to the data attributes.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: fixing hardcoded color schemes in exported notes.html to use CSS variables instead.
Description check ✅ Passed The description is well-related to the changeset, explaining the problem (hardcoded colors), solution (CSS variable scheme), and motivation (dark theme contrast issues).
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@bbb-shared-notes-server/src/express/handlers/exportDocumentToHtml.ts`:
- Around line 97-118: The dark-theme CSS only flips base body colors ('html.dark
body') but fails to override surface elements—specifically code/pre blocks,
table cells/headers and blockquotes—so they keep light backgrounds and hurt
contrast; update the stylesheet to add dark-mode overrides for those selectors
(e.g. 'html.dark code', 'html.dark pre', 'html.dark table td', 'html.dark table
th', 'html.dark blockquote') and set their background-color and color to the
dark-mode variables (use the darker --bn-bg-* vars for backgrounds and the
lighter --bn-text-* vars for text) so code/pre/table/blockquote surfaces match
the dark theme.
- Around line 37-42: The current span-attribute cleanup in exportDocumentToHtml
only removes style="..." with double quotes and fails for single quotes or extra
spacing; update the attribute-removal pattern used inside the
htmlContent.replace callback to match style attributes more robustly (e.g.,
handle optional whitespace around = and either single or double-quoted values)
so any style='...' or style = "..." is stripped; target the replacement logic
that currently uses attrs.replace(/\s*style="[^"]*"/, '') and broaden that regex
to something like /\s*style\s*=\s*(?:'[^']*'|"[^"]*")/ to reliably remove inline
style attributes from the captured attrs.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: d5cb959f-d2e3-4563-8884-f278f94cddb8

📥 Commits

Reviewing files that changed from the base of the PR and between 69dac62 and 8ae2590.

📒 Files selected for processing (1)
  • bbb-shared-notes-server/src/express/handlers/exportDocumentToHtml.ts

@sonarqubecloud

sonarqubecloud Bot commented May 8, 2026

Copy link
Copy Markdown

@antobinary
antobinary requested a review from ramonlsouza May 12, 2026 19:28
@github-actions

Copy link
Copy Markdown

✅ Automated tests have passed!

@ramonlsouza ramonlsouza left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, this is the result after adding class="dark" to exported html:

Image

@antobinary
antobinary merged commit caf9d05 into bigbluebutton:v3.0.x-develop May 13, 2026
58 of 59 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants