[FEATURE REQUEST] allow text formatting in code blocks #410

Closed
opened 2026-02-04 19:41:28 +03:00 by OVERLORD · 8 comments
Owner

Originally created by @uchytma on GitHub (Aug 22, 2017).

It would be great to implement text formatting in Code Blocks.
Now there is no way how to highlight parts of code.

Originally created by @uchytma on GitHub (Aug 22, 2017). It would be great to implement text formatting in Code Blocks. Now there is no way how to highlight parts of code.
OVERLORD added the Open to discussion label 2026-02-04 19:41:28 +03:00
Author
Owner

@ssddanbrown commented on GitHub (Sep 9, 2017):

Think this will be quite difficult to implement since formatting is done dynamically via codemirror. Will interfere with the nice code formatting.

@ssddanbrown commented on GitHub (Sep 9, 2017): Think this will be quite difficult to implement since formatting is done dynamically via codemirror. Will interfere with the nice code formatting.
Author
Owner

@jarensWizmo commented on GitHub (Dec 20, 2017):

We also desire the ability to either highlight or bold text within a code block. We are currently using inline code as a workaround but we prefer to use code blocks in our documentation.

@jarensWizmo commented on GitHub (Dec 20, 2017): We also desire the ability to either highlight or bold text within a code block. We are currently using inline code as a workaround but we prefer to use code blocks in our documentation.
Author
Owner

@jarensWizmo commented on GitHub (Dec 21, 2017):

It appears that codemirror does support this feature, but I obviously do not know what complications would be faced with implementing this into BookStack editor.

https://codemirror.net/demo/variableheight.html

@jarensWizmo commented on GitHub (Dec 21, 2017): It appears that codemirror does support this feature, but I obviously do not know what complications would be faced with implementing this into BookStack editor. https://codemirror.net/demo/variableheight.html
Author
Owner

@ssddanbrown commented on GitHub (Dec 21, 2017):

The above demo is simply showing variable height text. The formatting in that demo, As per all regular codemirror use cases, is dependant on the language syntax highlighting. To implement this with codemirror we'd be fighting the syntax highlighting system. We'd probably have to look at implementing an alternative alongside proper codeblock support.

@ssddanbrown commented on GitHub (Dec 21, 2017): The above demo is simply showing variable height text. The formatting in that demo, As per all regular codemirror use cases, is dependant on the language syntax highlighting. To implement this with codemirror we'd be fighting the syntax highlighting system. We'd probably have to look at implementing an alternative alongside proper codeblock support.
Author
Owner

@jarensWizmo commented on GitHub (Dec 27, 2017):

I see, hrmm... not sure if it makes any difference or not, but we often don't select a language in the editor, the source code doesn't show it having a defined language.

<pre><code class="language-">this is a test... I want this to be BOLD</code></pre>

Do you think it is possible that not choosing a language could allow for other more basic formatting features?

I have tried to input <b></b> & <strong></strong> into the source code but it gets removed right away :(

@jarensWizmo commented on GitHub (Dec 27, 2017): I see, hrmm... not sure if it makes any difference or not, but we often don't select a language in the editor, the source code doesn't show it having a defined language. `<pre><code class="language-">this is a test... I want this to be BOLD</code></pre>` Do you think it is possible that not choosing a language could allow for other more basic formatting features? I have tried to input `<b></b>` & `<strong></strong>` into the source code but it gets removed right away :(
Author
Owner

@kawawa commented on GitHub (Apr 9, 2019):

I hope this has not previously been suggested, if so please ignore this comment.

What if, instead of trying to modify the codeblock, one of the two is added:

  1. A block editing option that behaves similar to the inline code option but results in an instant look to the code block option
  2. Add support for monospaced fonts like courier new, san serif

I particular would be interested in this because I predominantly work with outputs from network device command lines and would like to have control what aspects of the output I can emphasize

@kawawa commented on GitHub (Apr 9, 2019): I hope this has not previously been suggested, if so please ignore this comment. What if, instead of trying to modify the codeblock, one of the two is added: 1. A block editing option that behaves similar to the **inline code** option but results in an instant look to the **code block** option 2. Add support for monospaced fonts like courier new, san serif I particular would be interested in this because I predominantly work with outputs from network device command lines and would like to have control what aspects of the output I can emphasize
Author
Owner

@ssddanbrown commented on GitHub (Nov 8, 2022):

I'm going to go ahead and close this off since there's been relatively little demand for this since the original issue was opened.

@ssddanbrown commented on GitHub (Nov 8, 2022): I'm going to go ahead and close this off since there's been relatively little demand for this since the original issue was opened.
Author
Owner

@carlossierra311 commented on GitHub (Jan 13, 2023):

Too bad this was closed, as I too need something similar. In our documentation, it's important to show which lines of code changed at some version, or to highlight parts of code up for discussion/review. Text coloring/formatting would help us achieve that.

@carlossierra311 commented on GitHub (Jan 13, 2023): Too bad this was closed, as I too need something similar. In our documentation, it's important to show which lines of code changed at some version, or to highlight parts of code up for discussion/review. Text coloring/formatting would help us achieve that.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#410