Markdown - Linebreaks #750

Closed
opened 2026-02-04 22:09:29 +03:00 by OVERLORD · 4 comments
Owner

Originally created by @david-jointech on GitHub (Jul 17, 2018).

Currently the Markdown-Editor only inserts a line break (with a certain spacing) if I have an empty line (aka two linebreaks) between the lines.
I am generally used to a single linbreak making a simple linebreak and a second linebreak leaving an empty line. (I think this is a difference between github-style markdown and plain-markdown). Would it be possible to maybe choose another style of markdown or generally adopt github-style-markdown?

Originally created by @david-jointech on GitHub (Jul 17, 2018). Currently the Markdown-Editor only inserts a line break (with a certain spacing) if I have an empty line (aka two linebreaks) between the lines. I am generally used to a single linbreak making a simple linebreak and a second linebreak leaving an empty line. (I think this is a difference between github-style markdown and plain-markdown). Would it be possible to maybe choose another style of markdown or generally adopt github-style-markdown?
OVERLORD added the > Markdown Editor label 2026-02-04 22:09:29 +03:00
Author
Owner

@fbatiga commented on GitHub (Dec 30, 2018):

up on this one. I'm also very interested in this feature.

@fbatiga commented on GitHub (Dec 30, 2018): up on this one. I'm also very interested in this feature.
Author
Owner

@tsacks commented on GitHub (Dec 12, 2019):

This is a bit old of a bug to resurrect, but I was able to fix this on my local install by modifying one line of code. I'll try to submit a PR here soon.

But, until then, you can edit the file resources/js/components/markdown-editor.js and change line 17 from this.markdown = new MarkdownIt({html: true}); to this.markdown = new MarkdownIt({html: true, breaks: true});, then just run npm run production and it'll have webpack rebuild the js files.

@tsacks commented on GitHub (Dec 12, 2019): This is a bit old of a bug to resurrect, but I was able to fix this on my local install by modifying one line of code. I'll try to submit a PR here soon. But, until then, you can edit the file resources/js/components/markdown-editor.js and change line 17 from ```this.markdown = new MarkdownIt({html: true});``` to ```this.markdown = new MarkdownIt({html: true, breaks: true});```, then just run ```npm run production``` and it'll have webpack rebuild the js files.
Author
Owner

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

With the events in the custom HTML head option, you can now add the following to your Custom HTML head content setting to do the same thing, and you don't have to recompile BookStack every update.

<script>
  window.addEventListener('editor-markdown::setup', event => {
    event.detail.markdownIt.set({breaks: true});
  });
</script>
@tsacks commented on GitHub (Mar 16, 2020): With the events in the custom HTML head option, you can now add the following to your Custom HTML head content setting to do the same thing, and you don't have to recompile BookStack every update. ``` <script> window.addEventListener('editor-markdown::setup', event => { event.detail.markdownIt.set({breaks: true}); }); </script> ```
Author
Owner

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

Thank you @tsacks for providing an easy-to-use solution via our editor hooks.

In the core project we generally align with the commonmark standard but the editor events were implemented for exactly this kind of customisation. Therefore I'll close this off.

@ssddanbrown commented on GitHub (Mar 17, 2020): Thank you @tsacks for providing an easy-to-use solution via our editor hooks. In the core project we generally align with the commonmark standard but the editor events were implemented for exactly this kind of customisation. Therefore 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#750