Code highlight themes also affect markdown editor #1584

Closed
opened 2026-02-05 01:19:43 +03:00 by OVERLORD · 3 comments
Owner

Originally created by @leoniscsem on GitHub (Mar 12, 2020).

PHP: 7.3
Bookstack: v0.28.2

When using a codeblock syntax highlight theme as instructed in the documentation, the highlight not only gets injected in the codeblocks, but also in the whole markdown editor page.

expected result
Bildschirmfoto von 2020-03-12 20-46-35

This is the MD editor view without adding the html annotation in the custom html section of the adminstration view.

actual result
Bildschirmfoto von 2020-03-12 20-47-18

Here is the MD editor after adding the CSS reference as instructed using the ambiance theme.

Originally created by @leoniscsem on GitHub (Mar 12, 2020). **PHP**: 7.3 **Bookstack**: v0.28.2 When using a codeblock syntax highlight theme as instructed in [the documentation](https://www.bookstackapp.com/docs/admin/visual-customisation/), the highlight not only gets injected in the codeblocks, but also in the whole markdown editor page. **expected result** ![Bildschirmfoto von 2020-03-12 20-46-35](https://user-images.githubusercontent.com/6514726/76523493-7c88ac00-64a3-11ea-800a-17d9dd105c6e.png) This is the MD editor view without adding the html annotation in the custom html section of the adminstration view. **actual result** ![Bildschirmfoto von 2020-03-12 20-47-18](https://user-images.githubusercontent.com/6514726/76523517-84e0e700-64a3-11ea-9b08-e4eded0186d4.png) Here is the MD editor after adding the CSS reference as instructed using the _ambiance_ theme.
OVERLORD added the > Markdown Editor label 2026-02-05 01:19:43 +03:00
Author
Owner

@ssddanbrown commented on GitHub (Mar 13, 2020):

Hi @leoniscsem,

Yeah, The rendering system is the same for codeblocks and the editor so theme changes affect all rendered code sections.

If you'd instead prefer to remain using the default theme for the Markdown editor, the theme can be altered by listening to an editor event we emit then overriding the config. It would be a case of adding the following to the "Custom HTML Head Content" setting:

<script>
	window.addEventListener('editor-markdown-cm::pre-init', event => {
		const config = event.detail.config;
		config.theme = 'default';
	});
</script>
@ssddanbrown commented on GitHub (Mar 13, 2020): Hi @leoniscsem, Yeah, The rendering system is the same for codeblocks and the editor so theme changes affect all rendered code sections. If you'd instead prefer to remain using the default theme for the Markdown editor, the theme can be altered by listening to an editor event we emit then overriding the config. It would be a case of adding the following to the "Custom HTML Head Content" setting: ```html <script> window.addEventListener('editor-markdown-cm::pre-init', event => { const config = event.detail.config; config.theme = 'default'; }); </script> ```
Author
Owner

@leoniscsem commented on GitHub (Mar 16, 2020):

Fantastic! Works like a charm. Shall I add that to the documentation? Then you could mark the issue as closed.

@leoniscsem commented on GitHub (Mar 16, 2020): Fantastic! Works like a charm. Shall I add that to the documentation? Then you could mark the issue as closed.
Author
Owner

@ssddanbrown commented on GitHub (Mar 17, 2020):

@leoniscsem Great! Don't really want to extend the documentation with loads of customisations, unless it was to become a highly raised request. Since this solved your specific case I'll close this off.

@ssddanbrown commented on GitHub (Mar 17, 2020): @leoniscsem Great! Don't really want to extend the documentation with loads of customisations, unless it was to become a highly raised request. Since this solved your specific case I'll close this off.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#1584