@Morgul, Thanks for this report. I've got lots of markdown files in the docs of LeoJS, so I'll look into this shortly.
But I wonder: Are you using @clean or @auto? can you check if there's a difference with this behavior? Thanks again for your reports on this matter :) Félix On Sunday, February 22, 2026 at 8:18:27 AM UTC-5 Morgul wrote: > Markdown is a format designed to be human-readable as plain text, and I've > been keeping my Markdown documents clean and readable as plain text. And it > seems Leo editor by default messes up a little bit with that > human-readability in regards to blank lines between sections not being kept > when saving. > > When you're reading a plain text file in Markdown format, it makes a lot > of sense visually to have extra blank lines between sections or subsections > (at least between the higher level ones). > > For example: > > # Chapter 1: one > > This is the first chapter > > ## 1.1 Something > > This is something > > > # Chapter 2: two > > Welcome to chapter 2 > > With beefy documents specially, blank lines between sections bring a lot > of clarity (for example, to identify when the topics change, or to quickly > find where the next sections or chapters are), when skimming or paging > through them in text mode. > > Leo importer seems to love to add blank lines at the end of nodes, then > Leo happily ignores them when saving, leaving exactly one line of text > between sections. I can't guess how the importer decides how many blank > lines to add at the end of nodes, but it's not always the same amount and > it doesn't seem to match the number of blank lines between sections in the > original document. > > Does Leo have any @ settings for my expected behavior? I'd be happy if Leo > would simply write as many (extra) blank lines between sections as black > lines there are at end of nodes. So, if a node has zero blank lines at the > end, it should only leave one blank line between that node and next > section's node. > > Take into account also that the importer must be changed for that purpose, > as it will have to add exactly the required number of white lines and the > end of nodes as the original document has, for the saving operation to > result in the closest match possible of the original document. But if > there's a setting to choose how many blank lines to put between what kind > of sections, it's acceptable when saving to correct the document where it > used the wrong number of blank lines between their sections. > > I'd also love it if it was possible for Leo (at least with some setting) > to not need an empty blank line at the start of a node, and still when > saving it adding a blank line after the header of the section. That would > require the importer to do it that way as well, to not force me to have to > manually (or semi-automatically, as having to run some command is) remove > those initial blank lines on hundreds of nodes. > > By the way, how does Leo know which Markdown header format to use, is > there setting for that? Or does it always use leading #? Even when > importing a document that formatted them with - or = on the next line, > disregarding the user's choice? Some user might want to use different kind > of header formats for different levels. > > And please consider the ideal that Leo always tries by default to detect > and use the original document's format when importing without needing to do > anything special for it, so when saving it, it results in a file with > exactly the same content, at the very least for text files. > > Leo looks smart by for example detecting a Python file I'm importing uses > tabs as indentation, but if it then makes its own decisions to > intentionally change the format without even giving a warning or asking the > user, that will not be welcomed by all users. > > I understand you might sometimes want to prioritize some standards of > format, but please, don't impose them by default without warning the user, > specially when Leo can support either. > > The rationale for this can be this one: a project uses a specific > format, if I import files from its git repository without changes on the > working directory, and then I save, I should still be able to see on git > status that there's no changes on the working directory. Leo shouldn't > change the format to whatever you think is the "correct" or most common > one, as the project might reject changes made to the format. > -- You received this message because you are subscribed to the Google Groups "leo-editor" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion visit https://groups.google.com/d/msgid/leo-editor/9658e000-9c34-4bb2-85d9-aa5b6cb7c2c1n%40googlegroups.com.
