enkisoftware / imgui_markdown

Markdown for Dear ImGui
zlib License
1.03k stars 69 forks source link

Line returns forced on '\n' rather than " \n" #7

Closed handsomematt closed 3 years ago

handsomematt commented 4 years ago

In most Markdown implementations a line return isn't added unless there are two empty spaces at the end of a line. This lets you wrap your markdown file nicely in your editor whilst also allowing your end viewer to wrap it accordingly.

juliettef commented 4 years ago

Thanks for the suggestion, I'll take a look.

dougbinks commented 3 years ago

I've added support for this on the dev branch. To preserve behaviour this requires the ImGui::MarkdownConfigFlags_mdStyleHardLineBreak flag in MarkDownConfig flags.

dougbinks commented 3 years ago

I've removed this support - sadly it breaks too much of the rest of the code.

Our implementation doesn't allocate any memory and can't modify the contents of the string, so removing line returns is awkward requiring lots of preserved state.

We've decided this is simply a limitation you'll need to be aware of, and if required pre-process any standard markdown to remove line returns if they are not preceded by two spaces.