Possible Solution to Newline Problem and Other Enhancements #173
Replies: 3 comments
|
Metadata is definitely on the table for consideration; I haven't gotten around to that yet. I'm not too enthusiastic about the metadata including parsing directives; I'd rather have the metadata be, well, metadata. I just want to make one point about the phrasing of the argument:
Sure, I agree that there are use cases where hard-wrapping is undesirable. But djot doesn't require hard-wrapping, it only allows it. It's perfectly possible to write djot in its current form without hard-wrapping. You just need to include those blank lines. |
Yes, my phrasing was too harsh. More specifically, when a person is writing a comment, it should be less strict. This is because anything that the format requires of the commenter slows them down. This cost is okay in documents because documents are usually crafted, where being slow is a virtue, but comments are quick, one-and-done. It's two different styles of writing: scratch vs crafted. djot is just about perfect for crafted writing (it just needs metadata, IMO), but for scratch writing, it's not ideal. Whether that matters to you as the author is your choice, though. Regardless, I'm still happy with djot and will continue the work to adopt it. |
I think what distinguishes djot from Markdown is that the former aims to have simpler, coherent rules and the latter aims to let humans do whatever comes naturally (what I think you mean by "scratch writing") as much as possible and have whatever parsing rules are necessary to handle that. Compare the length of the djot specification to that of CommonMark's. See my comment here and John's reply.
Whether or not your statements are true, I think we want a world with different philosophical, utilitarian and aesthetic choices. The value of djot is that it presents a new option with clear principles and goals. It's good that we have HTML, Markdown, Asciidoc, Org mode and now djot, just as it's good we have C, Haskell, Go and Rust. The right answer to many of the feature requests expressed on the CommonMark forum is "That's what HTML is for; let's not turn Markdown into HTML". |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Not the author, just a user and future implementer.
In this post, I will attempt to solve the newline problem while enhancing djot according to its design rationale.
It should be obvious now that the biggest problem people have with djot is the requirement for extra newlines when hard-wrapping.
As someone who prefers more whitespace than not (see this code), I personally don't have much problem with this. But it is a sticking point, apparently.
And this comment does have a good point: there are use cases where hard-wrapping is just bad. I'm interested in those use cases too, especially for comment systems. (I am making an all-in-one VCS that includes a bug tracker, and that will have a comment system. I want to use djot for that.)
This comment also has a good point that creating a new language may not be the best idea.
In addition, there is some discussion about adding document-wide metadata. I agree with this because of djot's rationale number 9:
Currently, it's not possible to attach arbitrary attributes to the entire document, which is an element. I also use Pandoc to generate manpages, and Pandoc uses document-wide metadata to do this. If djot is to be useful for that purpose, and it should be, there must be some way of having such document-wide metadata.
So I solved two birds with one stone: djot should have document-wide metadata, and that metadata should be able to describe how to parse the rest of the document as well.
Here's how it will work:
hard_wrapshould be set totruein the metadata.The reason that hard-wrapping defaults to off is for
twothree reasons:This design has a few advantages beyond just solving the biggest gripe with djot:
There is one big problem: the format of the metadata. People have suggested YAML and TOML, but there doesn't seem to be any consensus.
Shameless plug: I suggest a format I came up with, called GAML (Gavin's Accessible Markup Language). It looks like this:
Think of it like JSON with the following changes:
It can be parsed in about 1710 lines of portable C, (not including an insertion-ordered map), and Lua should require much less. It could also be used as an AST format.
I am willing to make the changes to the current implementation to parse metadata and to parse GAML, including adding the hard-wrap-disabled mode, even if just as an experiment. Please let me know if there is interest. I'm also working on my own implementation in C.
Edited to Add: While there is no specification for GAML as of yet, I'm willing to write one right away should this community want one before adopting it.
All reactions