Compare AsciiDoc and Markdown
docs.asciidoctor.org
docs.asciidoctor.org
Having said that, I'm not sure if there's really any alternative. If you need the extensibility and diff-ability of asciidoc, then you're probably going to have to use it. If you don't need it, stick with markdown.
EDIT: so that people get an idea, I use asciidoc because it provides callouts, sidebars, captions, figures, cross references, LaTeX (via hard-to-use plugins), themes, fonts, etc. when converting to pdf or epub, etc.
Why are you using asciidoc to write a book, instead of LaTeX ? I see the advantage of using this for documentation, but for an entire book ?
On the other hand, if you already know the gist of Markdown, then you could pick up reStructuredText or AsciiDoc in less than an hour. They're more feature-rich than markdown, without adding too much squeeze for the juice.
If needed, you can also sprinkle the Markdown with LaTeX, such as to enforce page breaks at specific points.
In a book one often needs to keep track of local references (to figures, tables, sections, etc). How this could be reasonably done in markdown flavors?
We need an open source alternative to https://www.princexml.com/samples/
Or at least one not that expensive.
TeXmacs: https://www.texmacs.org
As far as I know e.g. this book https://www.editions-ellipses.fr/accueil/4856-le-petit-pytho... has been written with TeXmacs, and antoher is in preparation by the same author. Also, Joris van der Hoeven has written a guide to TeXmacs ("The Jolly Writer") using TeXmacs
None of these are showstoppers, but quite a few paper cuts that leave me reaching for Latex only as a last resort. There are tooling and workflows one can adopt to minimize the pain, but it requires a lot of setup if I just want to get some text on a page.
I have stupidly optimistic hopes that something like [Skribilo](https://www.nongnu.org/skribilo/) would take over in this space, but I know that is foolhardy. Would require a generation of physicists and mathematicians to give up their hard-won Latex knowledge.
You use LaTeX when you have to for some specific thing, perhaps equations, but at other times, you can stick with the simpler syntax of (AsciiDoc|reStructuredText|Org-Mode).
That's what I do at least.
.. directive-name:: first-line-options
:subsequent-options: and their values
:and-more: if you want
Then the directive’s body.
And here’s a strawman fenced syntax: ```directive-name:: first-line-options
:subsequent-options: and their values
:and-more: if you want
Then the directive’s body.
```
Of course, once you’re touching something like that you’d want to touch more things to make it all consistent again, but it’d all be perfectly possible. (Would you use backtick? Dunno. I hear it’s hard to access on some keyboard layouts like German.)As it stands, reStructuredText is based around having visually-pretty source: monospacedly-aligned tables, indentation for hierarchy, that sort of thing. (Headings feel like the only major thing that doesn’t use very significant whitespace.) I almost always like this, but there are definitely some situations when it’d be nice not to work that way.
Would you go all-in on fenced things rather than indented things? I dunno. Probably.
It's fine, you have to press the key right next to the backspace key plus shift. Not exactly ergonomic, but easy to discover on basically any standard QWERTZ keyboard. I'd definitely like a fenced alternative. I'm okay with indentation-based code, but somehow I really dislike using it in my writing.
reStructuredText and AsciiDoc are already straddling the line between Markdown and full-featured markup languages. If you need more than this, then you should probably bite the bullet and just use LaTeX or some other markup.
The <textarea> we always have with us. Anything extensively indentation-based is doomed as a general-purpose web markup language (where you’re typing in that markup language—WYSIWYG/WYSIWYM editors are another matter), because all <textarea> “enhancements” will behave differently and will be at least a little painful.
> reStructuredText and AsciiDoc are already straddling the line between Markdown and full-featured markup languages.
I think that’s the wrong framing. All three have roughly the same goals, just Markdown is… worse. And yeah, I’m going to stick with that. Markdown is a low-quality hack that unfortunately (in my mind) gained popularity, a textbook case of “worse is better”, because its dodgy HTML foundation and simple processing model made it far easier to adopt (with many painful incompatibilities between implementations) than something like reStructuredText which is actually sound but takes a lot more effort to implement, so that there’s really only one implementation of it.
reStructuredText and AsciiDoc are full-featured presentation-agnostic markup languages. Markdown is itself fairly minimally-featured, which works out because it’s tied to HTML, which carries the burden of supporting more extensive functionality (though not very well).
LaTeX is a full-featured presentation-locked markup language. It is not at all suitable as an alternative for the likes of reStructuredText, as reStructuredText is much more flexible on presentation options. With something like Sphinx, you can target HTML, LaTeX, Windows’ old-style help, man pages, and more.
Using |foo|__.
.. |foo| replace:: substitution with the ``replace`` directive
__ https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#substitution-definitions
Funny thing is that, from what I recollect of investigating this matter a decade ago, there was never any fundamental objection to nested inline markup in reStructuredText, it just… hasn’t happened.The main implementation of reStructuredText is a custom parser, which might be a hassle to modify to accomodate all cases of nesting, including duplicate ones like: A B A text b a a.
But perhaps all the difficulty in this stems from making the symbols used for starting an inline markup the same as for ending it. Otherwise it would be trivial to count opening and closing "parentheses".
You might find MyST interesting! Personally I’m counting on it to succeed (after painfully realising reStructuredText never will )
- https://lwn.net/Articles/692704/
- https://www.kernel.org/doc/html/latest/#other-documentation
Back in 2016.There is a lot of comparison made in that decision.
https://hyperpolyglot.org/lightweight-markup
Aside, I still don't understand why restructuedText never took off. The language is so expressive and well-documented, there are anchored references and tables, you can write you academic papers in it and just generate PDFs from it afterwards. There are so many constructs that Markdown and friends don't have.
For basic use cases (sections, lists, text formatting), they're both similar in functionality, but Markdown has the advantage of having lightweight, memorable syntax. I would argue that Markdown's syntax is also aesthetically more pleasing (RsT uses a lot of punctuation).
For advanced use cases however (long docs, with math/code listings, complex cross refs, footnotes, callouts, etc.), RsT feels more powerful out of the box. I'm sure Markdown has extensions that can help it achieve similar functionality, but it almost feels like Markdown wasn't designed for advanced use cases.
To use a very imperfect analogy, Markdown to me feels like Microsoft Word (easy to get started on), whereas RsT feels like LaTeX (very code-centric). Although either can be used for any use case, Markdown seems like the right choice for most web-centric use cases, whereas RsT seems slightly more suitable to complex documentation.
[1]: https://github.com/breuleux/blog/blob/master/content/about.q [2]: https://github.com/breuleux/quaint-doc/blob/master/content/i... [3]: https://raw.githubusercontent.com/breuleux/earl-grey/master/...
[1] https://raw.githubusercontent.com/breuleux/blog/master/conte...
[2] https://raw.githubusercontent.com/breuleux/blog/master/conte...
In any case, it does appear the discoverability of straightforward examples leaves something to be desired, so thank you for making me realize that.
To me the advantages of Quaint is that I can easily define custom operators to do nonstandard things unobtrusively. For instance, if for some reason I want to emphasize some words in italic orange, I can easily set it up so that e.g. /xyz would highlight xyz in italic orange. Silly example, but there are a lot of valid use cases.
I very much despise the trend to write sharepoint or wiki/Confluence pages as a means for software documentation. I want my documentation to reside next to my source code, not at some obscure corporate URL.
The problem is simply that github, gitlab, and friends adopted Markdown and so it's got a heavy head start. Asciidoc is competing with small snippet documentation like README files written in Markdown and wiki pages in Confluence, Sharepoint, and the like. Asciidoc is pinched in the middle. I do hope it gets better adoption.
[1] https://docs.github.com/en/github/managing-files-in-a-reposi...
SourceHut unfortunately does not. You can go through the hoops of POSTing to its GraphQL API from CI a new README from any format to HTML.
https://docs.gitlab.com/ee/user/asciidoc.html#mermaid
Examples for Mermaid layouts in the GitLab handbook: https://about.gitlab.com/handbook/tools-and-tips/mermaid/
Github already supports AsciiDoc via AsciiDoctor.
There'd a middle-ish ground we're going with at work - you have the documentation alongside the code in git, and your CI/CD also uploads it to Confluence/whatever for less technical folks/searchability/etc.
( Tools used are Gitlab CI, mark and Confluence, but they don't really matter, the workflow does).
As you said having the dev doc on an external tool is really a plus. You can have comments, you can add tags, easier to search, and give access to non technical people
Anyone know if a tool like that already exists to turn README.md files into a website?
It wouldn't be so bad if Confluence/whatever could just render the Asciidoc from the source repository. But they are generally closed systems. There's no way in or out of Confluence without significant headaches.
I’ve had similar fun experience with Slack-ops when slack goes down.
Edit: Now that I think about it, the whole product palette of Atlassian seems to have issues making use of any decent markdown parser out of the myriads of parsers out there, that they could use. For example HTML in markdown on Bitbucket also does not properly work, so generating a table of contents is useless on Bitbucket as well.
Gruber then threatened them with legal action (since he holds the copyright on the word Markdown and for some reason hates proper specifications), so they had to rename their spec “CommonMark”.
Most of the big Markdown-using services (GitHub, GitLab, Reddit, Stack Overflow, etc.) implement this spec, so it is basically the Markdown spec, all but in name.
It can be found at https://spec.commonmark.org/
Github used to have its own "Github-flavored Markdown" before CommonMark came along.
Gruber wrote a tool that solved his own personal problem, shared it with the world because why not, and then made damn sure he wasn't going to have to deal with any fallout put on him for his sharing.
It would be a bit like Tim Berners-Lee trying to police how people use “WWW” today. He might theoretically be within his legal rights, but he’d still be a jerk for doing so.
And no, I do not think it fair or reasonable that whoever first coined a term gets to control its meaning forever. Especially when he just reused an existing dictionary word.
Basically, Gruber is asserting that because he came up with the concept, he gets to decide that no one can fix its flaws and clear up its ambiguities, and because the problems that stance causes to thousands of people do not affect him, we can all just kiss his self-righteous posterior.
Does that sound even remotely feasible? I think not.
For better or worse, we’re stuck with the name, because trying to change it and failing would just create more compatibility problems and confusion.
Much like the eternal GIF pronunciation controversy or tabs vs. spaces, we’ll all just have to grin and bear it, because Gruber is not likely to change his mind.
This is a bit of a trap when it comes to teams chasing the goal of modular documentation.
AsciiDoc let’s you include other AsciiDoc files, so teams modularize content with the idea that all these modules are potentially reusable.
But unlike code which, say, might use a method that is available bc another file has been included/imported, an AsciiDoc include doesn’t reveal any of its content. It’s just a file name that will be replaced with the content of that file upon render.
This means you literally cannot read modularized content from source - you need to open up every included file and read each out of context.
Available tooling also presents previewed/rendered includes as if they are part of the parent document, which removes the ability to identify modularized content from the output.
In my experience this results in documentation that is modularized by diktat - usually after being authored in a Google Doc. Reuse never happens, in fact nobody but the author really knows what content was modularized in the first place.
Which is 100% nuclear stupid, because, as you point out, you can't do component content without conditional content. And once you start doing conditional content, you need to have a damn good idea of what your whole product architecture looks like: what works with what, which packages are packages, obsolescence, blah blah blabbity blah. At industry conferences this makes me mad enough to spit, and all those goobers are suckering these writer teams into paying $7000 per person per (EDIT)month (!!) for a system that's going to be nothing but heartache in thirty six months.
Luckily, Asciidoc does have conditional directives, but the include directive is wayyyyy too primitive for what it's being used for right now (also as you point out). The `ainclude` directive is in extension right now, and it will probably be brought into core as a subdoc directive.
Having said that, it really is the best game in town, for generating both modern HTML alongside old-timey PDFs and DocBook XML, all from the same source.
Example:
.Lightweight Markup
NO THIS TEXT IS NOT LIGHT
Now, in fairness, Markdown doesn't have any methods to do that. But for quotes, Markdown gets it right: > this is a quote
> and that's obvious
While AsciiDoc uses a block that doesn't have any meaning for the casual reader: -----
Quote Quote
-----https://docs.asciidoctor.org/asciidoc/latest/blocks/blockquo...
AsciiDoctor is a great framework for writing documentation and manuals. And there is also markdown support, so you can reuse/embed your existing documenentation.
Having Markdown with more features is against what makes Markdown useful: minimalism.
This must be contributing a lot to the adoption difficulty (at least for resource-limited open-source projects). There's a good chance you will not find an AsciiDoc parser library for your favourite programming language.
My favourites are Rust and Haskell. Neither of them had a parcer until recently (even though the original implementation has been around for a few years now). Both are at early development stages at the moment.
[1]: https://github.com/bytesparadise/libasciidoc/blob/master/LIM...
If you are interested in an AsciiDoc processor in Haskell, you can read: https://www.tweag.io/blog/2021-06-15-asciidoc-haskell-pandoc...
We had Guillem Marpons at the last AsciiDoc WG meeting and he was willing to work toward a spec-compliant implementation and help us with the spec.
I'm very impressed with what asciidoc-hs plans to do! Especially looking forward to LSP support and stuff like incomplete/incremental parsing.
Take xrefs for instance. They say that the Markdown is:
See [Usage](#_usage).
<h2 id="_usage">Usage</h2>
and that the AsciiDoc is: See <<_usage>>.
== Usage
I mean, clear win for AsciiDoc, right? So I Google "cross reference" "markdown and get this SO post as the first hit: https://stackoverflow.com/questions/5319754/cross-reference-... – 802 point answer saying to do this: Take me to [pookie](#pookie)
<a name="pookie"></a>
I just switched my blog to Jekyll recently so I checked to see what Jekyll does to section headings under the hood (you most want to turn section headings into anchor points, no?) Turns out it automatically turns `<h2>Usage</h2>` into <h2 id="usage">Usage</h2>
So clearly Jekyll does the right thing out of the box. Then all you have to do is: See [Usage](#_usage).
somewhere else. What I'm getting at is this. Don't pretend your competitor is lamer than it is when doing comparison tables because it'll disincline people to check you out if they find out you've done that. You should steel-man your competitor and _still_ beat them. FWIW I think that Markdown (and its variants) always try to choose a syntax that aligns with how you'd write idiomatic non-HTML text-only styling. I mean compare the unordered and ordered list examples. Markdown chose right, AsciiDoc chose wrong. Objectively speaking, you'd choose the Markdown way naturally. I grant you, sometimes the choices are a little forced but what are you going to do, eh?Having said that, the fact remains that you don't have a standard syntax to add an id on a section title (without using HTML directly).
Jekyll might does the right thing but Jekyll is not Markdown. Does it work elsewhere? If not then your document is not really portable.
In a trivial example, Markdown's syntax looks more natural. It might well be the more appropriate syntax for a short README, which expects to be read as plain text at least as often as rendered to HTML.
In real use, i.e. when editing a non-trivial example, AsciiDoctor's multiple-star/dot syntax makes it easier to keep track of things.
You can also use the Markdown-style indentation instead anyway: https://docs.asciidoctor.org/asciidoc/latest/lists/ordered/#...
# Usage
See [Usage].
https://pandoc.org/MANUAL.html#extension-implicit_header_ref...Markdown was also an option but it was missing too many features for a documentation set of this size.
Specifically the two things that are really nice is:
A) You can write out a table row over multiple lines. Default syntax/mode makes it really easy to do a cell per line.
B) You can embed (more) complex formatting easily into the table. So stuff like lists, block quote/code block, whatever.
Have you written much using org-mode as a replacement for asciidoc/markdown etc? I should probably try to find some examples of longer-form org-mode docs and see if I can use those features.
To be sure, the Emacs dependency is something of an entry barrier for org-mode. It helps that I've been using Emacs and various text formatters — Scribe, Final Word, and now pandoc — going back some 40 years.
pandoc file1.md file2.md .... -o final.md
or pandoc file1.md file2.md .... -o final.pdf
[1] https://pandoc.org/Asciidoctor has very good support for `include`, so you can include a file in the middle of another file. Furthermore, you can even do partial include where you only include a section of another the file in the current file.
I have setups where each of my files can work as a standalone document with proper Title and Appendix. These files can be compiled into another file where all the individual title are change to sub-title, and all the appendices are group together into one section.
It sounds so archaic.
I would like to imagine that in this day and age that isn't the case, but the name works against it.
[0] https://docs.asciidoctor.org/asciidoc/latest/text/quotation-...
The lack of first-class support for balanced quotation marks seems to be a major problem for computers. I think a lot of computer code, particularly scripts, would be easier to read and less buggy if the languages had been designed by someone with balanced quotation marks on their keyboard.
As a thought experiment, imagine what Lisp would look like if '(' and ')' were the same character and you had to use the same work-arounds that shell scripts use for open quotation mark and close quotation mark being the same character. Instead of (a ((b c) d)) we'd write |a \|\\\|b c\\\| d\||. That's fine, right? We can live with that?
Perhaps we should think ourselves lucky that 0 and O are not the same character, and 1 and l, like they were on the first mechanical typewriters.
Mind you, there's one similar annoyance that predates typewriters and continues to plague us in Unicode: apostrophe and closing single quotation mark are logically quite different things, but they're the same character: ’
Why into .emacs and not into the global keyboard configuration? Don't you ever write text outside of emacs?
I have used xkbcomp to replace a character I don't need with one I do, but the recipe tends to require maintenance and I don't know how to program dead keys with that approach. Perhaps there's a better way nowadays.
For linux-portable keyboard configuration, you may find that an unholy mix of setxbmap (to set up the grand options) and xmodmap (to modify a few particular keys) is what works best for you. At least it does for me.
> sometimes I'm SSH-ing in from a machine that isn't even Linux.
ah! the horror!
If anyone else was a web dev in the 90s, you know what I’m talking about.
We've integrated it with PO4A[0] and CrowdIn.com to support a translation workflow, and so far have one document in Chinese: [1].
Another (tiny) example is [2] with an emoji star, you can "Edit this page" and see the Unicode source.
[1] https://docs.gbif.org/collections-idea-paper/zh/
[2] https://ipt.gbif.org/manual/en/ipt/2.5/data-hosting-centres#...
ASCII is so old that I picture ANSI colour blocks as it’s successor, and both of those are firmly in the “nightmarish text encoding days”
But I still go back to markdown because everyone (and almost every tool I use) will accept it.
It also doesn't help that Emacs seems to be the only complete and correct parser; I tried org files as Readme in git repos, and for example Gitlab really struggles. Pandoc isn't fully compatible either.
If I had to do something of similar scale and complexity from scratch today, I'd look for a better solution.
The thing that makes MarkDown documents less appealing is the inability to handle images seamlesslessly(drag and drop). Most of the time, our documents involve images to explain stuff. Uploading them somewhere, and then manually adding a tag and correctly copy/paste the url in MD makes it less appealing that just drag & drop an image in a WYSIWYG editor and spending the focus on _documentation_.
What I’d like is a MArkDown Editor that also simply allows me to drag and drop images and it should handle uploading and linking the images transparently.
Have a look at Typora [0]. It's my main Markdown editor for this reason (and others).
I wished we had that for ASCIIDoc because it looks more powerful than the half backed Markdown.
Most of the time, using backtic is enough: `text`.
I've seen this premise a lot (quoting from the article)
»The most compelling reason to choose a lightweight markup language for writing is to minimize the number of technical concepts an author must grasp in order to be immediately productive.«
What relevant documentation markup languages have this issue?
If we already agree that documentation should be written as code, let's embrace it and not be scared of showing syntax. It's our tools that matter here - syntax highlighting, previewing, CI feedback.
I see much more that people writing markup languages get extremely motivated from their first victories with coding something.
Don't be afraid of showing people syntax -- Wikipedia got pretty far with a less-than-optimal markup language!
I think the real issue with AsciiDoc is something more along these lines: https://xkcd.com/927/
I'm working in a large organization where we are failing to streamline and spread documentation practices because of many different standards and practices popping up everywhere.
I like a lot how the Python community has centered around Sphinx and Read the Docs. It's great that for instance Sphinx support both Markdown and reST in that regards -- but then when things like Hugo/Docsy, AsciiDoc, Github Wikis, groovydoc etc. starts popping up, the unification of documentation practices in a large organization becomes harder -- and also of course across the specter of Open Source projects.
But it's less supported, so I stopped using it.
*strong*
/italic/
_underline_
-strikeout-