Skip to content
This repository was archived by the owner on May 12, 2026. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/cloud/components/DocPage/DocContextMenuActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import {
exportAsMarkdownFile,
exportAsHtmlFile,
filenamifyTitle,
pdfExportTheme,
} from '../../lib/export'
import { downloadBlob } from '../../../design/lib/dom'
import { useNav } from '../../lib/stores/nav'
Expand Down Expand Up @@ -219,7 +220,7 @@ export function DocContextMenuActions({
await fetchDocPdf({
updatedDoc,
exportOptions: {
appTheme: settings['general.theme'],
appTheme: pdfExportTheme,
codeBlockTheme: settings['general.codeBlockTheme'],
},
token,
Expand Down
18 changes: 11 additions & 7 deletions src/cloud/lib/export.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ const remarkAdmonitionOptions = {
infima: false,
}

export const pdfExportTheme = 'light'

export const exportAsHtmlFile = async (
doc: SerializedDoc,
preferences: UserSettings,
Expand Down Expand Up @@ -122,7 +124,10 @@ const fetchCorrectMdThemeName = (theme: string, appTheme: string) => {
return theme
}

const getCssLinks = (settings: UserSettings) => {
const getCssLinks = (
settings: UserSettings,
appTheme = settings['general.theme']
) => {
const cssHrefs: string[] = []

cssHrefs.push(boostHubBaseUrl + '/app/codemirror/theme/codemirror.css')
Expand All @@ -131,7 +136,7 @@ const getCssLinks = (settings: UserSettings) => {

const editorTheme = fetchCorrectMdThemeName(
settings['general.editorTheme'],
settings['general.theme']
appTheme
)
if (editorTheme != null) {
const editorThemePath =
Expand All @@ -141,7 +146,7 @@ const getCssLinks = (settings: UserSettings) => {

const markdownCodeBlockTheme = fetchCorrectMdThemeName(
settings['general.codeBlockTheme'],
settings['general.theme']
appTheme
)
if (
markdownCodeBlockTheme != null &&
Expand All @@ -162,12 +167,11 @@ const generatePrintToPdfHTML = (
settings: UserSettings,
previewStyle?: string
) => {
const cssHrefs: string[] = getCssLinks(settings)
const generalThemeName = settings['general.theme']
const cssHrefs: string[] = getCssLinks(settings, pdfExportTheme)
const cssLinks = cssHrefs
.map((href) => cssStyleLinkGenerator(href))
.join('\n')
const themedGlobalCss = getGlobalCss(selectV2Theme(generalThemeName))
const themedGlobalCss = getGlobalCss(selectV2Theme(pdfExportTheme))
const previewStyleCssEl = previewStyle ? `` : ''

return `<!DOCTYPE html>
Expand All @@ -189,7 +193,7 @@ const generatePrintToPdfHTML = (
</style>
</head>
<body>
<div class="${generalThemeName}">
<div class="${pdfExportTheme}">
${markdownHTML}
</div>
</body>
Expand Down