-
-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Blank lines in comments #67
Comments
Agreed that blank lines in comments are reasonable to want. Actually I think the attribute parser will accept blanks; the problem is that by the time the (inline) attribute parser gets this, the content has already been split into paragraphs. (Block-level recognition is prior to inline-level.) So this one is a bit tricky. |
It's curious that this literal example can be seen as a block comment. That is, block parser can treat And it seems reasonable to say that only block comments can have blanks in them |
Block attributes must fit on one line. So you can't use
But that's not convenient or beautiful. It would be possible to introduce a block comment fenced syntax starting with |
Not sure if I'm missing something obvious, but the solution that comes to my mind here would be to use
|
I don't much like this style of fenced comments, since the open and close delimiters aren't marked as such; it makes it difficult to do things like comment out sections that already have comments. I'd prefer a line-mark syntax, which makes it evident to the eye what is commented out. |
Since djot already supports
and
(fixed typo) |
Also worth considering
Note that inline verbatim can't contain blank lines. If we did that we'd probably want to make the math syntax parallel, see #160 (comment) In general, though, I prefer a "line comment" style, like LaTeX
This is also easy for text editors to highlight, and highlighting comments is one of the basic things you want to be able to do even if you're not highlighting much else. |
Like the idea of {% and %} regardless of what the comment contains. I think it is important that Djot can be used by non programmers who just want some easy to follow syntax rules, and that is exactly why I like Djot so much as I do. I am trying to change all my daily work from Markdown to Djot, because of the syntax and given how easy it is to adapt. |
So the syntax is simply this?
Like in TeX but (at least) two |
Well, that's one idea anyway! |
I'm not sure how much of a factor syntax highlighting will be. However, using "line comment" style lets the reader know quickly whether or not a line is a comment, even when no syntax highlighting is present. Having the option to easily read a djot document without syntax highlighting is definitely handy. |
Just my 2 cents after finding this issue, but the current situation with this asymmetry is indeed not really friendly. There might be a good rationale for it, but it feels weird:
|
It was probably a mistake to rely on the attribute comment syntax for comments; as noted above, I think a proper line comment syntax like LaTeX's |
I prefer LaTeX's comment syntax as well. That being said, if someone writing prose in djot (which probably means paragraph/line) wants to include comments in the middle of their paragraph, they can't use LaTeX comment style, right? |
|
As I found for Pandoc Markdown you can already (ab)use raw block/inline syntax for persistent comments as long as the “format” doesn’t coincide with any format actually in use:
Perhaps since the “format” in raw block/inline syntax may be/begin with an underscore in both djot and Pandoc markdown: assuming no actual format name starts with an underscore names beginning with an underscore may by convention be used for application-specific raw-text based extensions which will degrade gracefully by being ignored, and by further convention the lone underscore as format could be for comments/always ignored stuff. An application or filter could do anything with these, for example parse the text with its own parser and construct elements to insert in its place.
Just my two small coins! |
The term is soft-wrapping. I forgot the word 🤦♂️ LaTeX comment style does not allow comments in the middle of a soft-wrapped paragraph, i.e. a single line. I think it would be good to have another comment option for those who use prefer having one line be a whole paragraph of text. |
I feel like this may already be implied by some of the comments but wanted to state it explicitly: If there were no comment syntax in attributes then the syntax for comments would not be tied to the syntax of attributes anymore and djot could support the following (reminiscent of how CommonMark handles comments).
Line comment syntax would be complementary (similar to
|
Yes, it is certainly tempting to remove the comment syntax from attributes and just assign |
Yes please make |
Actually, now that I think about it, it's not really straightforward to make
the parser will first identify two paragraphs (just based on the start of the lines) and the comment delimiters would only be seen at the inline parsing phase. But in that phase we're just looking at one paragraph, so we don't have the matched pair. Line comments are unproblematic, though. Q: Couldn't we just change the parser so that it scans each text line for A: It's not that simple. After all, the Indeed, even a line comment syntax is tricky to implement, for the same reason. We'd have to handle the comment syntax (say
and I don't know how we'd handle this, since here the line comments are not in an inline content context:
|
Couldn’t this be handled like CommonMark handles
|
I suppose we could have handlers for As for
comments out the whole section while
does not. |
@jgm that's why I think it is better to have |
It feels like blank lines in comments is a rather reasonable thing to want.
Note that we don't support blanks in general attribute syntax (ie, we allow newlines, but not blank lines) but that I think is reasonable.
The text was updated successfully, but these errors were encountered: