HedgeDoc is a great tool, but for my specific workflow where I exclusively use it for drafting markdown documents before feeding them into other tools it comes with one really annoying quirk: Line breaks are preserved in HedgeDoc, but not in the other tools I use.
There’s an annoying workaround for this which is to prepend
---
breaks: false
---
to every note I make. But that’s tedious, easy to forget and looks ugly. You can put it in the default.md file so it’s always included when you make a new note, but then when you create a new note it takes you to an empty view note screen where you have to do an extra click to start editing. Which really breaks the smooth default experience of being dropped straight into the editor ready to type. And it still leaves me with an ugly looking frontmatter that I have to manually remove when passing on the markdown I’ve written to othe tools.
This is a big deal because on every document I’ve collaborated on using HedgeDoc so far (dozens!) both me and the people I’ve worked with have accidentally inserted line breaks that HedgeDoc rendered but the tool we fed the final document into didn’t. Which caused text that should have been rendered on separate lines to get jammed into the same line.
I just want the whole line breaks thing gone, it has done me nothing but greif!
So, after digging around in the code for a bit I came up with the following hack in the config:
{
"production": {
"dropbox": {
"appKey": "';Object.defineProperty(window,'md',{get:()=>window._md,set:(md)=>{window._md=md;Object.defineProperty(md.options,'breaks',{get:()=>false,set:()=>{}})}});'"
}
}
}
If you put this into your HedgeDoc config.json file the line breaks will be fully disabled globally on the instance, making HedgeDoc consistent with other markdown tools. It will stay disabled even if you put breaks: true in the frontmatter of the document, so it’s a sledgehammer that will break existing notes depending on those linefeeds. And obviously since it uses the dropbox appKey to accomplish this you can’t have the dropbox integration working while using this hack.
That’s not any issue for me, because I don’t use dropbox and removing the oddball line breaking behaviour makes HedgeDoc feels like a tool that does what I need and want, rather than what some committee on linefeed behaviour and user expectations decided it to do.
Stay awesome.