Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Sorry for taking so long to putting some thought into this.
Yes, at the moment "non-semantic" line breaks (that are not used to start a new Argdown block) are simply ignored by the parser (similar to comments). That also means that empty spaces added before non-semantic line breaks will be preserved. You should simply treat non-semantic line breaks as a purely "cosmetic" way to make your Argdown code look better without any effect on the real text data that will be parsed and exported. Normally, I first write each paragraph of text without any line break and then insert line breaks afterwards without deleting any whitespace to format my Argdown document.
In your example, you can insert a whitespace after the first line (
The alternative would be to parse non-semantic line breaks as "empty space"-tokens, but this would make the parser more complicated and might be annoying to other users that do not expect it. To make this less surprising the parser could check if there already is a preceding whitespace and only replace a linebreak with a new whitespace token if not. At the moment I am not convinced that such a complicated solution is really necessary, though. Maybe it would be enough to emphasize the cosmetic role of non-semantic line breaks in the documentation.
Thank you for your reply.
The current behaviour is clear, new lines in a paragraph are allowed for code readibility and are ignored in the rendering process.
There are a few points in there where I would like to share my thoughts. These are best seen as personal user feedback, I do not claim a general case here. My main assumption is your vision with respect to formatting to be along the lines that argdown should provide desired formatting with the least user effort, so that users can focus on their argumentation. The current behaviour is inconsistent with that vision.
I would argue that users get their expectation from markdown, which treats in-paragraph new lines as spaces, or from tinkering with the editor (and learn quick enough).
I can image this works for some users, however others (including me) like to have more overview. The current workflow introduces unnecessary manual labour in that case. By introducing this feature, both workflows can be used effectively.
This issue is related to #109 in the sense that in both cases argdown deviated from markdown. Would there be a simple way to support non-conflicting markdown syntax by default?
Thanks for your feedback. I had the behaviour of HTML code in mind, but you are right that line breaks are treated differently by Markdown parsers, so maybe Argdown should do so as well.
I will have to think this through before I make a decision, but I see your point.
There is no easy way to support non-conflicting Markdown syntax by default, it has to be implemented as part of the Argdown lexer/parser structure and in some cases this is more difficult than it might seem at first glance (for example look at #118), especially because Argdown is written as a LL(k) grammar parser and not (like most Markdown parsers) only based on regular expressions. I still think this was a good decision in general, but it makes it difficult to mimic Markdown parsers in every detail.
This took a lot longer than I hoped, as all the new Newline tokens invalidated a lot of my tests and I had to check which ones I could simply rewrite and which ones where pointing to real issues. It should work now as advertised, thanks again for bringing this up!