Don't write documentation in Markdown
buttondown.email
buttondown.email
Follow-up supporting thread with older article: https://news.ycombinator.com/item?id=22677161
Where does that leave us on any of this article's concerns about extensibility and cross-reference? I'm persuaded by the need for a richer set of tags and non-local references for writing code documentation on most of my projects.
For most documentation, though, the basics are good enough. For some projects, yes you may need more structure, and either building a custom docs site or more heavily customized documentation is a good idea.
But even for medium-sized doc sets, Markdown still works great (I maintain a Docs site for Drupal VM[1] using Markdown with Read the Docs).
The arguments are weak to mind boggling, and the technical nit-picking would better addressed by suggestions on how to support those minor features in markdown.
It makes absolutely no sense to complain about the document format when commenting on documentation.
Why not? When aren't formats important? Or is it the fact that it's documentation that makes it not worthwhile to comment on?
"As far as I'm concerned the best tool for writing documentation is the one that anyone can actually be bothered to use. Markdown might not be perfect but at least it's simple and commonly understood so there isn't much barrier to writing/updating documentation." - warmans
[1] https://www.reddit.com/r/programming/comments/4ck2lu/why_you...
If you have such a person anyway, you can just let other contributors write simple text without any styling to begin with.
2) If people do need to convert it, at least it’s a simple enough spec that conversion shouldn’t require a Herculean amount of effort (I bet there already exist converters that others have written)
Granted, that's only a weak argument against Markdown. I rarely encountered converters that would work 100% correct for any given textual format.
If it was like plain text, with a few ascii symbols used for formatting (like *, _, ...), it'd have been more fantastic than now.
BBCode is better imho.
The only two markdown features afaik that work on HN are italics with asterisks and code blocks with 4 spaces.
That's it.
I prefer just plain "<br/>" because it does not mess with my editor configuration, which otherwise I have to constantly tweak between "strip all whitespace at the end of line" and back.
The goal is "please write your documentation." What solution has the least friction around that for engineers? Right now, it's overwhelmingly Markdown.
It's not perfect, and often doesn't provide the features a technical writer or other content specialist might want, but it handles most use cases and is something developers are willing to write in.
So please, write your documentation in whatever you feel like. As long as it gets written.
Of course you could write docs in HTML with CSS if you wanted perfectly expressive syntax highlighting and context demarcation. And the opposite end of this would be arguing to use raw plaintext like an IETF specification.
But really Markdown is ubiquitous and represents a usable compromise between being readable as plaintext while enabling the 'progressive enhancement' of being converted to HTML.
I apologise to anyone who ever has to read my documentation. I'm really, truly, sorry. I have excuses but no reasons.
I write most of my documentation in Markdown or just plain text files. The reason is simple, I want the same focus that I had when writing the code. Doing a context switch from code/IDE to html/Web is a nightmare for me. If that would be mandatory for some reason, my documentation would suffer from more bitrot then it does now.
> So please, write your documentation in whatever you feel like. As long as it gets written.
Just so long as you remember who is supposed to be reading it, and ensure that they can. What language you use to structure it is more a question for you (and your team), and matters much less.
What processes or tools do you know of to keep documentation up to date as code and environment change underneath it?
Low level docs such as foo() does x and raises error when y should be expressed as unit tests.
External to code docs should be limited to things like deployment process.design docs (part of point of which is their history should be versioned not changed.
I very much agree with expressing assertions as tests. Doctest is an interesting point in the space, here. An idea I've had (and prototyped, but never quite got where I wanted) is a system where I can add references to tests as citations supporting claims in documentation, such that when the test fails the assertions it supports can be surfaced.
Also, documentation that is frequently used is typically thereby checked against reality, and necessary updates found quickly. But much documentation won't be sufficiently frequently used to rely on that.
There are many things that help. I'm always looking for more. Thanks for your input :)
There are 4 states for any page:
- Maintained: "We are maintain this and aim to keep up to date. Message #slack-channel with any questions."
- Stale: "Oops... we didn't."
- News: "This represents our current thinking as of 23-Mar-2020"
- Record: "This is a historical record of our intended system design, produced on 4-Aug-2018."
When you write docs, be very clear whether you are writing a new report or something you intend to maintain. Reports become historical records after 1-3 months. Default to a report.
Why? To keep small the number of docs which are "Maintained". Every maintained page is owned by a team of 2-10 people and the channel to contact them is visible on the page. Ideally, there would be a tool which attaches to every "Maintained" page and does 3 things.
1) Let the reader mark it as possibly stale or ask a question, then messages the page owners about that. Marks the page as stale within a week of non-response.
2) Mark the page as stale if the text isn't updated at least every 3 months.
3) Mark the page as stale if it doesn't get at least N page-views in 3 months.
I'm serious about point #3. If a page is rarely-read by others, then the team which owns it is not pointing people to it or using it for training. If that is the case, then why should they spend time and attention to keep it up-to-date?
Is it an emergency runbook? Well then either that info is important enough to walk through it periodically, or you should be honest with yourself that what that doc really says is, "This was the suggested runbook we came up with after a post-mortem 2 years ago. It might be very useful for understanding the system. Maybe it even still works."
If someone wants to make it perfect so be it, let that person do it all. Then every change is left to such individual to be done and then guess what what happens when he is the person that has to do ALL the changes for documentation. Probably he won't have time to do more interesting things :)
You should be able to hide all the definitions if you want or show only the definitions. You should be able to mark several code samples as doing the same thing in different languages. You should be able to generate the documentation with and without “TODO” sections, so you can share separate versions internally and externally
When I read that I was like 'wtf is this about'. For someone who barely has any documentation at all usually (me) this seems next level. But thinking of it this actually makes sense and I totally understand that if you're at the point where you want to apply those things you likely have a ton of ducumentation and perhaps don't need being pointed out that the main goal is writing it and you're most likely right in saying that markdwon is not the correct tool for that job.
A lot of programmers argue the code is the best documentation. No it's not. Source code answers the how and what but it doesn't provide any answer to the most important question of all - why?
Software embodies several architectural and design decisions. What decisions were explicitly made and why were they made? All too often when looking at code I can certainly understand what was done, but it's not at all immediately clear as to why.
On the teams I've been working with I've gotten them to capture these decisions. It's been a great help - sometimes the original implementors can't remember why something was done the way it was done - especially when asked three or more years later.
Admonishing people to write documentation in Markdown would be a nice problem for me to have. Meanwhile I'd just like some documentation at all. Please?!
The vast majority of technical documentation I read doesn't answer why, either. The closest examples I see these days are tech talks (e.g., videos of Rich Hickey talks) and FAQs (e.g., the Python FAQ has a number of "why" questions). Sometimes also source code comments (e.g., the Swift stdlib actually has fairly informative comments).
For some reason, even though there is clearly demand for the why, and programmers are happy to supply it, nobody ever wants to provide it inline, in the documentation proper.
It's a rare, rare piece of software that doesn't at some point make me tear my hair out and ask "why?!" upon discovering some behavior which is working exactly as documented.
Currently having this fight - "The code is the best documentation!" has been the answer to my "where is all the documentation?" question. Sure, except there's 2100+ source files spread over 120+ Go packages encompassing 4+ years of development before I arrived. I'll be right back and productive after 2 years of wading through this, ok?
https://sphinxcontrib-napoleon.readthedocs.io/en/latest/exam...
Markdown has a lot of implementations (with some fragmentation, granted) and is adopted by many diverse projects outside the python sphere.
Pandoc supports rST.
I write Elixir docs on my projects because it's easy pretty and obsessively making my docs prettier hits that spot in my brain.
Extreme example:
https://hexdocs.pm/zigler/Zigler.html
Where I've automatically marshalled zig code into the elixir documentation (https://hexdocs.pm/zigler/beam.html#get_f32/2) and you can click the slash in the upper right of the function header to link to the code on Github.
As a bonus, check it out on mobile and compare it to this on mobile:
I still use md for READMEs and gists and whatnot, I guess my point is, different tools for different jobs, if you have to pull weeds in your garden use a spade, if you have to do it for a field use a machine, or something.
Hint: This is rhetorical. https://docutils.sourceforge.io/FAQ.html#is-nested-inline-ma...
> Not currently, no. It's on the to-do list (details here), and hopefully will be part of the reStructuredText parser soon. At that time, markup like this will become possible:
Here is some *emphasized text containing a `hyperlink`_ and
``inline literals``*.
So absolutely valid syntax just doesn’t work. Aaaand that todo list entry dates back to 2001.(I know, I know, instead of complaining I should submit a fucking patch. Unfortunately fixing reST is one of the least urgent things on my should-submit-a-patch list.)
You can't make section headers with ##, no?
More importantly in RST you can't easily manage several levels of headings. You're limited to 2 or 3, and have to remember which underline character you used for that level.
= - ^ ~
There's not a suggested or standard order, so yes there's some mental overhead in deciding which header styles you want to be which level, but a lot of projects tend to have a "lint" guide for that at this point. For instance a lot of projects (and Sphinx recommends) follow the Python Style Guide:
# with overline, for parts
* with overline, for chapters
=, for sections
-, for subsections
^, for subsubsections
", for paragraphs
(You may be confusing Markdown's/CommonMark's own less popular Setext-style headers which only support underline and = for first level and - for second level header.)ReST for life!
Markdown is used everywhere, so it "won". Better doc in a "worse" format than no doc at all.
Another important human aspect of documentation is docs are often written by people joining a project late who may already be knees deep trying to understand the projects APIs. Burdening them with learning a documentation system on top of that can definitely a tipping point between "I should document this" to "ah whatever, I'll just slog through the code".
> Researchers: .rst and .md are poor with math symbols, please write the technical documentation in beautiful LaTeX with rendered symbols.
> Managers: If I can't read or edit it easily, I'll hire someone to rewrite it using Word or Google Docs.
> Everyone: Here's the Word document...
> Scribe: 𝔜𝔢 𝔬𝔣𝔣𝔦𝔠𝔦𝔞𝔩 𝔡𝔬𝔠𝔲𝔪𝔢𝔫𝔱𝔞𝔱𝔦𝔬𝔫 𝔰𝔥𝔬𝔲𝔩𝔡 𝔟𝔢 𝔴𝔯𝔦𝔱𝔱𝔢𝔫 𝔟𝔶 𝔥𝔞𝔫𝔡 𝔞𝔫𝔡 𝔰𝔢𝔱 𝔦𝔫 𝔰𝔱𝔬𝔫𝔢 𝔴𝔦𝔱𝔥 𝔭𝔢𝔫 𝔞𝔫𝔡 𝔭𝔞𝔭𝔢𝔯.
> Me: Meh. if everyone can't read or edit it quick enough towards the deadline, then I'll stick to Google Docs.
The most important property of documentation is existence. Markdown has a low barrier to entry and the markup can later be upgraded to Asciidoc.
In other words, upgrading to py3 was such a pain, they rewrote it in Ruby instead. Ouch! This has got to be the worst example (among more than a few) of py3 pain I've seen yet!
`link text <https://news.ycombinator.com>`_
Obscure, but OK. This is how you put something in monospace: ``monospace``
So then how do you make the link text contain monospace formatting? Last I checked, there was no clean way. Using non-matching bracketing characters is a terrible idea because it inhibits nesting, which has been known at least since POSIX shell introduced $(). There is really no excuse for the way RST uses backticks. This is a major reason why I prefer Markdown.E.g. here [1] I'm reusing the argparse help string in the readme. That makes the source code the primary source of truth.
Another experiment I did was writing readme as an Ipython notebook [2], and then compiling the output to markdown. That allowed me to link bits of readme straight to the code. E.g. as an example, each of the 'Features' [3] links straight to the unit test for that specific feature. The downside is that you need to remember to refresh the readme after code changes, otherwise the line numbers break. Perhaps that can be set up automatically as a CI job.
In hindsight through, would have been easier to use org-mode as well to avoid keeping two separate files for the readme.
- [0] https://orgmode.org/worg/org-contrib/babel/intro.html
- [1] https://github.com/karlicoss/rexport/blame/master/README.org...
- [2] https://github.com/karlicoss/cachew/blob/master/README.ipynb
I'm using org-mode profoundly since 2015 for a lot of my daily note taking routines. Additionally, I've started two years ago to work some of my readmes/tutorials with org-mode. It provides a fantastic way of helping to write, where I find it much more graceful than RST (or Markdown at all).
One of the reason of change to org-mode, however, was its excellent code blocks and noweb-like feature - as you told residing in org-babel. However, that is not what org-mode was buying for me, but the sheer extensibility and that you can use it now everywhere (e.g. for static page builder like Jekyll or wiki-pages based on Gollum).
I recommend everyone to peek at the excellent Spacemacs project, https://www.spacemacs.org, for an org-mode experience out-of-the-box.
The downside of reStructuredText is, that there are almost no libraries in other languages than Python, which can transform it into HTML for the web. The canonical parser is a custom parser, without grammar and lots of states, which is unfortunate, because if there was a grammar, it could easily be implemented in other languages and the format might be much more used. But perhaps it would not be as extensible then?
Another, but quite minor, downside is, that it is a little bit harder to learn than Markdown.
Perhaps I can suggest Emacs Org-mode? The downside is, that it's only available to the extend in Emacs and other implementations are lacking many things.
Anyway, I wrote a thesis in reStructuredText and used Pandoc + custom preprocessing for document internal linking to generate the final PDF version and once I had it set up, it worked great.
As a Python developer I’m no stranger to reST, and problems like the inability to nest inline constructs (e.g. [`code`](https://example.com) is impossible in reST) are simply ridiculous. (Talking about docutils here. Maybe there are other unofficial implementations that fix some of the problems, but anything not used by Sphinx is rather useless.)
I used to have READMEs of Python projects in reST because of PyPI long_description; those were converted to Markdown soon after PyPI started supporting Markdown. Now I write reST exclusively for Sphinx (mostly in the form of autodoc), but need to check documentation all the time.
For the language that focuses on readability Python has completely missed the boat here.
My thought is that RST is probably closer on the spectrum to LaTeX (despite still being far away) as it’s a more powerful syntax with a more esoteric format.
If you’re a sole contributor or want to limit your contributors to those who know or have the patience to learn this, then sure, use RST.
Otherwise, documentation is a team sport. Write in whichever format will let people get ideas down fastest and can most easily be coerced it formatted text. Right now, the best option for that is MD.
These aren’t algorithms, so trade power for participation.
[0] https://github.com/dfee/forge/tree/master/docs
[1] http://python-forge.rtfd.io/
I previously used Microsoft Word for all documentation, but the lack of human-readable diffs in source control was a PITA, and some features are just much better in IDEs that Word (e.g. search and replace with regex).
## CHAPTER IV.
#The <white>Rabbit</white> Sends in a Little Bill
It was the <white>White Rabbit</white>, trotting slowly back again, and looking anxiously about as it went, as if it had lost something; and she heard it muttering to itself *“<red>The Duchess</red>! <red>The Duchess</red>! Oh my dear paws! Oh my fur and whiskers! She’ll get me executed, as sure as ferrets are ferrets! Where can I have dropped them, I wonder?”* <gold>Alice</gold> guessed in a moment that it was looking for the fan and the pair of white kid gloves, and she very good-naturedly began hunting about for them, but they were nowhere to be seen—everything seemed to have changed since her swim in the pool, and the great hall, with the glass table and the little door, had vanished completely.
Just write the two lines of CSS required for those elements, and bam! You're all good!They criticize this within, but their criticism isn't particularly strong: sure, the point of Markdown is to write less HTML, but in this instance, the HTML is about as semantically concise as you can get: the quickest solution in any system. Their comment on hybrid documents also doesn't really work in the context of most parsers.
It emerged at the time when HTML was the lingua franca of the Web. Nowadays with so many new ways to create web pages you can't count on it, so contributors who aren't familiar with it will spend unnecessary time on fixing HTML and CSS instead of fixing the docs.
For example, Stripe (the workplace of the author) has incredible documentation that single-handedly enabled me to build with it, despite my being a wretched server-side developer.
That the documentation alone doubled the potential user-base, thus fostering growth and engagement with the product, is a testament to the power of great document versus just documentation.
V1 docs in markdown - fine. But V2 for an ambitious tool should probably start approaching what Stripe is accomplishing.
Consider this simple fail of nested styling:
*I am italic but also **bold**.*.
This produces (all in italics but lacking any bold text): I am italic but also **bold*.*
If you assumed asterisks could be stacked; nope: *I am italic but also *bold*.*.
Produces (all in italics but lacking any bold text): I am italic but also *bold.*
ReST/Sphinx can't do this. Doh!
Because of this you can also not have styling in e.g. link texts etc.These limitations seem unnecessary and random. For example, when the parser handles a table, which is also just marker symbols for cells, you can have styled text or links in the cell's text. Why this works but nesting styles doesn't is completely beyond me.
```code <example> ```
Also I don't agree with the author's points about links in Markdown whatsoever.
Also silly is to complain about stuff that everyone uses, like tables, not being part of the markdown spec. We have amazing tooling around markdown, like pandoc, who cares whether it's part of the spec?
https://h3rald.com/hastyscribe/HastyScribe_UserGuide.htm
OK, you are right that ordinary markdown is insufficient because a lot of functionalities are missing for proper technical writing and above all proper content reuse...
That's why in my tool I started from an already fairly-advanced Markdown flavor (Discount) which already comes with a bunch of proprietary extension... then on top of that I added things like snippets, transclusions, fields, and even simple macros.
https://dave.autonoma.ca/blog/
Part 8 (coming soon!) uses annotated Markdown to reproduce a famous poem (original is on the left):
https://i.imgur.com/idV1mTM.png
The text of the poem is written in Pandoc-flavoured Markdown:
::: poem
Some say the world will end in fire,
Some say in ice.
From what I’ve tasted of desire
I hold with those who favor fire.
But if it had to perish twice,
I think I know enough of hate
To say that for destruction ice
Is also great,
And would suffice.
:::
> Markdown is good for generating HTML and terrible for making PDFs.²Yes, Pandoc is essential for transforming Markdown into beautiful PDF files. Tooting my own horn a little more, my illustrated photobook, Impacts, is written almost entirely in pure Markdown, with a few annotations for plots and spectra:
https://impacts.to/preview.html
Tangentially related, what would be amazing is a robust text editor that allows injection of interpolated string variables from various data sources and structured data formats. Here's an architecture diagram to clarify:
https://i.imgur.com/8IMpAkN.png
My open-source editor, Scrivenvar (https://github.com/DaveJarvis/scrivenvar), implements that architecture to some extent.
Coming from Python I was a big fan of sphinx. With Graphviz we were able to embed flow charts of micro services. It worked very well. There are a number of extensions made it very powerful.
I switched because it felt close to markdown but not markdown. I now use docsify[0].js. There are a few things I miss. But it's an easier transition as my docstrings are also markdown. So no context switching.
Markdown is very bare. But that I feel keeps the documentation simple. With less knobs to twist, the documentation has less accents to it. With that limited range I feel it's more important to have a style guide.
In CommonMark (and thus most modern Markdown implementations) you can embed Markdown in HTML like this:
<table><tr><td>
*This is markdown*
</td></tr></table>
You need blank lines before and after the tags.I think you could do this in markdown.pl but there were some quirks/limitations.
----
Related: CommonMark is a Useful, High-Quality Project
Appeal to Mundanity: I've supported dozens of systems over the last 15 years, here are my opinions:
The best documentation is the implementation.
The second best documentation is any documentation at all.
The better you reveal your implementation, the better your documentation.
If you want to improve your second best documentation, knock yourself out. Concentrate on documenting interfaces and the location of your primary documentation (the source code, settings, etc)
If you want to bikeshed your second best documentation, I'm afraid I'm just going to laugh at you.
you can use any programming language to work with it, and using scheme and SSAX makes even XSLT a breeze.
In the 70's and 80's we used ASCII terminals to edit documentation, and only some terminals supported attributes like bold, italic, and underline. But you needed to be able to read it in its "raw" form.
So there were many systems developed that let you put the "markup" inside the document and keep it as reasonable as possible. The one I wrote a number of term papers in was SCRIBE that ran on the TENEX later TOPS20 machine and put the "final" output to a Diablo Hytype printer.
Consider that you had a team of 20 software developers working to build a software package for writing text documents that could both be read when being created/edited and later processed into beautifully typeset documents using a film typesetter.
This in contrast to a developer saying "hmm I'm putting up all this stuff in HTML and typing too much, I'll add a few shortcuts here, here, and here. Ta da! It works for me."
The availability of cheap dot matrix displays and "desktop publishing" set aside all those goals of editing with a text editor and instead using "WYSIWYG" environments of increasing complexity and bloat.
I applaud the reStructuredText people for wanting to attack the problem but I really wish they could look at what has already been done in this space to avoid the mistakes of the past. A version of SCRIBE that was UTF-8 clean would be pretty awesome as a starting point.
In my own workflow I find working in text faster because if I use a WYSIWYG editor I get so distracted by it looking "wrong" that I can't focus on the text itself. I would truly love something that was TMWYW (tell me what you want) rather than something that keeps trying to show me what it thinks I want.
To me the two most important things are:
1. Docs are tracked with software updates (track in VCS)
2. Enable me to spend less time writing docs and more time writing code
Google documented their experiments with markdown documentation here: https://www.usenix.org/sites/default/files/conference/protec...
Please learn to use and love pandoc
My experience suggests unambiguously that engineers will not take the time to learn a different markup format. They will spend hours or days or weeks learning a new language, deployment tool, protocol, library, etc. But in most cases they will simply refuse to spend one iota of time learning documentation tools. If you think I'm wrong, try making it your day job to get engineers to write rST (or Asciidoc or anything they don't already know).
Maybe that's good, though. "Blue" isn't semantic, either.
We switched to restructured text for fish, and I remember the insane loopholes I had to jump through to render the markdown equivalent of `followed by a trailing space ` because Sphinx absolutely insisted on eating that trailing space.. and there’s no way to actually explicitly define an inline code block so I could bypass the abstraction (whereas with Markdown I could always just insert a code element).
And don’t get me started on the inability to nest markup. What a joke. You can’t bill something as a “more legitimate documentation language” when you’re not even at feature parity with Markdown.
One thing that turned me off of Asciidoc was the dated smart quotes syntax. I actually wrote my own Markdown preprocessor for LATeX that takes care of smart quotes, links, bold, and italic and have been using that for now.
So it follows that you should reduce the critical path to documentation down to the path of least resistance. Markdown tools are plentiful. If you use GitHub, it is the core of their project management tools.
Also, you want documentation to be a "living & breathing document" - in the sense that it should be updated and modifiable by everyone. A LaTeX-like solution doesn't lend itself easily to collaborative work.
Markdown is a great tool for documentation, especially using tools like RStudio and Rmarkdown. These tools typically use pandoc under the hood to let an author generate whatever they need - HTML, PDF, Word documents, Power Point slides...
Because Markdown (and the tools mentioned above) produces a text document, this plays well with version control using git and github. Indeed github renders markdown files in the browser. These tools have been embraced by scientists who want to generate reproducible documents.
What I struggle with is documentations that are incomplete (e.g. miss crucial, "obvious" installing steps), out-of-date, or incomprehensible. Often external contributors help (especially newbies), as they look at your project with a fresh eye, taking nothing for granted.
If for a given project .rst is better than .md, cool. And if you generate HTML from it, end-users won't care what was your base format.
Use AsciiDoc. It scales up to entire books. It's extendable by design.
It supports embedding diagrams, maths & so on.
Figure out how to parse .md (or whatever is the standard) instead of pretending others switch to your standard.
A while later, during a significant recode exercise, I tried a different solution. Inline code documentation with YUIDoc - which was much better. Except YUIDoc assumes people are writing their Javascript in an Object Oriented way. My library thing didn't have a single class in it. The generated documentation just didn't make sense ... but by the time I realised this I had almost completed the documentation exercise and wasn't going to waste the work. So I also updated the static web pages too (finally!) and presented both sets of documentation on the Javascript library thing's website.
The thought of having to document changes and updates in two sets of documentation stopped me working on my Javascript library thing for over TWO years.
Last year, when I made the decision to rewrite my Javascript library thing from scratch, I also made the decision to dump all the documentation. Instead I wrote it as inline comments in simple Markdown - the most basic flavour available - and used a tool to auto-generate documentation from that (I've ended up using docco - it does the job).
Dumping all the documentation baggage has made me massively happier, and given me renewed love for working on my Javascript library thing.
... As for project runbooks? I write them in Google docs. If a client ever demands to see their project's runbook (please God no!), I can create a PDF of the latest version and email it to them.
I would enjoy those two features, can we add 'em? MD files would basically be able to replace RTFs in all but the older OLE stuff in the latter.
But...even though I wish for those two, I have some sense that these things would start us down the slippery slope of bloating markdown to be HTML 2020(TM)
That's already possible with data URL. You can easily do ``.
Now, this won't work on GitHub due to security restrictions (you could embed an SVG that contains a script). But Markdown/CommonMark supports it just fine.
htlatex: "Am I a joke to you?"
----
I can't really speak to either rST or AsciiDoc (since I don't use either of them nearly enough to be comfortable with their pros and cons), but aside from LaTeX (via htlatex or Pandoc or some similarly-useful way to export to HTML for online use), I've also seen POD ("Plain Ol' Documentation") and outright manpages as effective choices here. Both are designed specifically for documentation (in the case of POD, inline documentation), and both are demonstrably able to produce a variety of output formats, including HTML for online use.
That said, I also don't see why Markdown (or a more robustly-defined version thereof) couldn't be used to do the things rST can apparently do, especially when combined with a preprocessor (like what you'd almost certainly be using when generating documentation from e.g. source code comments like what quite a few modern programming languages support; on that note, quite a few of those languages do use Markdown for inline docs).
That said, FWIW, using markdown vs highly "semantically" structured text doesn't need to be an exclusive-or choice. Citing from sgmljs.net markdown (markdown-in-SGML):
> sgmljs.net Markdown is presented as an application of the SGML SHORTREF feature, which is an SGML mechanism to describe custom Wiki or other domain-specific syntax. Whereas in regular markdown it's possible to use HTML markup, in sgmljs.net Markdown it's also possible to use SGML markup and other constructs, bringing SGML's vast facilities for text organization and processing to markdown in a natural way. [1]
For example, to annotate HTML's text spans semantically with RDFa or whatever, add context-dependent CSS classes, perform transformations, define custom syntax on top of markdown, customize markdown flavours such as github's, use text macros, add page boilerplate, etc.
[1]: http://sgmljs.net/docs/markdown.html (my site)
I'm sorry, but "no color support" is not a compelling reason to switch to something more complicated. Define your own color meta-tag and generate a PDF from the markdown with colors if you care that much.
Then I tried using it. For a few years. To be honest, while certainly better than LaTeX and HTML in terms of ease of typing it still felt like typing with road bumps.
These days I just use orgmode and then use pandoc to convert to rst for my Pelican blog. It's not as powerful as rst but at least it's not markdown.
https://github.com/bobertlo/vmd
I've not tried it, but it sounds interesting.
> Good documentation is all about the semantic markup. A “definition” is not just a different formatting or like. It means there’s actually a concept of a “definition” as a discrete concept in your documentation.
The company I work for has a wiki that most teams use for documentation, and that generally works pretty well - for most uses, you can use the WYSIWYG editor, and if you need something more precise you can use the wiki text editor.
If you need to make some scribbles to describe a project, markdown will do. All of the things in this article are valid, but they're really don't apply to barebones documentation.
If you need some more formatting and bells and whistles, then you graduate to something that supports macros and a is a more fully fledged tool (eg. Hugo). These tools solve these problems, while (generally) keeping the user-friendliness of markdown. At least if you build some sort of complex behemoth of a publishing system with macros and custom styling and all sorts of things, if somebody needs to make a small content change, you using markdown will be a saving grace.
Most projects don't need anything more than the headings, lists, paragraphs, and code-blocks anyway.
But "my markup language is better than your markup language" is not very productive IMO. The fact that markdown lacks some advanced formatting tools might even be considered a feature, it means that it will render correctly when converted to monochrome output for instance.
Sometimes I go into a tool like Airtable to define content pieces, but there are a lot of pieces.
What I'm looking for is a way to define a chapter/sub-chapter recipe and work on iterative changes to content even as I refine the recipe definitions.
However, it can sometimes be very frustrating to get something exactly how you want it. You move this \mbox and it bumps something else, which gets moved into something else, and so on until your desk has an imprint of your head.
I have been using it with SSAX (XML and the scheme programming language, married in harmony) since 2005. It allows for structured documents that can be validated against a doctype in milliseconds and you can output whatever formats you wish.
I made a "documentation" doctype in 2005 and has used that to output documentation in whatever format I wanted (html, plain text, latex, markdown). Sure, it requires you to write XSLT or scheme using SSAX, but at least it will be your own fault whenever the tooling falls short.
my personal website is written XML, and generated server side using guile scheme and SSAX. I have been laughing quietly to myself every time people complain about the shortcomings of whatever markup their static site generator uses. Whenever I have had a need for something else, I can quickly edit my DTD in a backwards compatible way and add whatever sxslt transformations I need.
All that editing of HTML3.2 in notepad.exe made me immune to the ugliness of a light XML markup.
I've been using XSLT3 with Saxon-HE [2] + Clojure these days and I'm quite enjoying it. I use RelaxNG for validation (may sprinkle a bit of Schematron in the future).
Another pairing of XML and Lisp that I remember is Qexo [3].
1: https://en.wikipedia.org/wiki/Document_Style_Semantics_and_S...
External hyperlinks, like `Python <http://www.python.org/>`_.
Look at how many special characters it needs and how interferes with reading.I found it annoying and tiring to write and to read. It is the main reason I went with Markdown.
RST may be superior technology-wise but it inferior when it comes to usability
When I read that AsciiDoc is a Markdown-like syntax for DocBook, I was instantly sold.
I prefer knowing where to look for documentation in any project, rather than having to guess where some Markdown or HTML or RST files might be, separated from code.
So something with runnable (singleton) entry points and some english sentences giving context.
This is what I typically do for small experiments that I will completely forget about.
Too many IT folks do work and leave the running-entry-point and build-dev-loop as secret shadow workflows. It is basically fraud or stealing if you are an employee.
BTW I think Typora is a nice MD tool as it supports copy-paste of screenshots, extremely useful when writing tech documents.
I like to think that its simplicity (or lack of features) forces me to just focus on simple text to write easy to understand documentation.
But I'll still write markdown since its easy to generate and relatively easy to transform into a lot of something else.
e.g. Bob Martin (Clean Code) wrote: > A comment is a failure to express yourself in code. If you fail, then write a comment; but try not to fail. > https://mobile.twitter.com/unclebobmartin/status/87031189854...
I use to be proponent of comments throughout the code. But lately, am leaning more and more towards minimization through proper naming, annotation, function design (e.g. no side effects, single functionality).
Here are some related materials:
A more complete quote from `Clean Code` > Nothing can be quite so helpful as a well-placed comment. Nothing can clutter up a module more than frivolous dogmatic comments. Nothing can be quite so damaging as an old crufty comment that propagates lies and misinformation. > > Comments are not like Schindler's List. They are not "pure good." Indeed, comments are, at best, a necessary evil. If our programming languages were expressive enough, or if we had the talent to subtly wield those languages to express our intent, we would not need comments very much -- perhaps not at all. > > The proper use of comments is to compensate for our failure to express ourself in code. Note that I used the word failure. I meant it. Comments are always failures. We must have them because we cannot always figure out how to express ourselves without them, but their use is not a cause for celebration. > > So when you find yourself in a position where you need to write a comment, think it through and see whether there isn't some way to turn the tables and express yourself in code. Every time you express yourself in code, you should pat yourself on the back. Every time you write a comment, you should grimace and feel the failure of your ability of expression.
Previous related Discussions on NH: https://news.ycombinator.com/item?id=8073230 https://news.ycombinator.com/item?id=8073620
https://softwareengineering.stackexchange.com/questions/2857...
Nothing can be quite so helpful as a well-placed comment. Nothing can clutter up a module more than frivolous dogmatic comments. Nothing can be quite so damaging as an old crufty comment that propagates lies and misinformation.
Comments are not like Schindler's List. They are not "pure good." Indeed, comments are, at best, a necessary evil. If our programming languages were expressive enough, or if we had the talent to subtly wield those languages to express our intent, we would not need comments very much -- perhaps not at all.
The proper use of comments is to compensate for our failure to express ourself in code. Note that I used the word failure. I meant it. Comments are always failures. We must have them because we cannot always figure out how to express ourselves without them, but their use is not a cause for celebration.
So when you find yourself in a position where you need to write a comment, think it through and see whether there isn't some way to turn the tables and express yourself in code. Every time you express yourself in code, you should pat yourself on the back. Every time you write a comment, you should grimace and feel the failure of your ability of expression.
If the extensions are part of the build script for processing the documentation then ultimately the user and consuming developers won't notice the difference between this and using another markup language.
Hell one of the documentation pipelines I see quite often is the Doxygen + Breathe + Sphynx pipeline. This handles the markdown and offers most of those extensions mentioned by the author out of the box.
If your documentation pipeline works well and the user can't tell the difference, there's no reason to switch. Markdown works and is more elegant to write in than LaTeX and rST by just about every measure in my eyes.
One last note is that every markup language has it's own special blemishes and issues. LaTeX and rST are very much not immune to this and when it comes down to it, a properly built doc pipeline will cover these up no matter the language.
TL;DR: If Markdown is making your life difficult it's probably not Markdown that's broken, it's probably your documentation pipeline.
Just write a text file.
Pretty it up when you’re trying not to think about a problem that you’re stuck on.
Many tools that support markdown actually also support rst. For example, write a README.rst on github instead of a README.md.
By that logic I’d recommend writing your documentation in groff or mandoc.
Whatever you use, document!
XML is a great way to write structured documentation. It is the best option for "mixed content", that is, content that has character data, optionally interspersed with structured elements. The problem is that most standard XML documentation formats (docbook, dita, etc.) are heavy and most times overkill. I'm using RelaxNG [2] to create a schema of my custom format document [2], and a bit of XSLT3 [3] to generate HTML5.
RelaxNG is great, and pretty easy to use. You can think of it as a "regular expression over trees". The syntax is pretty intuitive, specially the compact form (there's an XML form too). For instance:
start = element doc {
attribute title { text } ?,
element p { text } *
}
... defines the schema for a document that should have a "doc" root tag, an optional title attribute, and 0 or more "p" elements, that should contain only text.The way I went about it, I'm just inspiring my format in a small subset of HTML5, plus some tags that I want to use to provide more structured information.
XSLT 3.0 came a long way since the version 1.0 that everybody remembers and loathes. Now, XSLT3 has maps, arrays, functions, higher order functions, and all sort of other goodies that people have come to expect from a modern programming language. Yeah, you still need to get pass the XML syntax, but it is not a big deal once you get the hang of it.
Finally, writing XML "by hand" is not a big deal neither. I'm using Emacs with the nxml and emmet [4] package, and I just needed to learn a few keystrokes for doing things like automatically closing tags. Emmet is amazing and fun to use to create small chunks of content at a time.
1: https://en.wikipedia.org/wiki/RELAX_NG
2: https://gist.github.com/EmmanuelOga/39ddb345c2a499690e728e59...
A parody is an imitation of the style of a particular writer, artist, or genre with deliberate exaggeration for comic effect.
A meme is an image, video, piece of text, etc., typically humorous in nature, that is copied and spread rapidly by Internet users, often with slight variations.
(;-))
http://github.com/samsquire/flat-html
Could be an alternative to HTML and Markdown
It's simultaneously the best and worst tool we have for structured semantically rich information. And unfortunately probably the only one.
Thanks to MkDocs and the Material theme, as well as plugins and extension, this whole setup looks great and scales really well to any device.
I think the author’s article speaks purely to documenting code. I’d say code is much harder to document and I think I’d agree even MkDocs (and the setup I’m using) wouldn’t be good for pure code documentation. But documentation for a project?
Nah. You’re completely wrong on this one.
Edit: down voting without providing as rebuttal is childish, at best.
Sure, it could use some features.
Does anyone know how a developer could contribute to the markdown standard and code up some desired markdown features?
> Not extendable
> Local processing only
> HTML Only
I don't get it. These are all extraordinary virtues of Markdown, not negatives.
Write it in whatever you want to write it in, just write it.
My take: meh.
RST is very comparable to Markdown, and the article makes almost no mention of why it is better. There is a downside, that it has a learning curve because most people are not familiar with it, whereas almost everyone has already used markdown.
Markdown is supported everywhere.
Especially please don’t tell me to ignore an industry standard only to offer some bespoke solution as an alternative.
RST and Sphinx are "industry standard". Markdown isn't really a standard at all, nobody uses the plain version, everybody uses informal extensions.
I think starting out with Markdown is fine and if it becomes unmanageable, one can still migrate to RST.
Well, ok, I'll buy that.
"What to use instead: LaTeX. [Just kidding.] A better answer is reStructuredText or RST. [Or AsciiDoc.]"
Er, well, ... RST does have extension syntax that allows you some flexibility to use semantic markup, but then the tools all have to understand the extensions you use. LaTeX at least has the ability to define the meaning of your extensions in its own syntax, but that is not all that much fun.
Conclusion: Everything sucks. Sorry.