Hacker News new | ask | show | jobs
by nerdponx 1811 days ago
rST doesn't support nesting markup (bold and italic? nope. code styling in a link? nope.). It's decent for writing software docs, but not good at all (in my opinion) for writing blog posts or other prose.
3 comments

Yeah, nesting inline markup is definitely something I’d want to add. Note that code styling in a link is actually possible, just convoluted:

  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.
I think it might be a complicated thing to add cleanly for all possible use-cases in the implementation. I remember, how knots in my head formed, when I thought about implementing nested inline markup in a markdown parser. For example if you have nestings like: A B C b c a (where the upper case letter marks the start and lower case letter the end of a markup)

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".

Code styling in a link sounds useful, but bold and italic generally shouldn't be combined[0].

[0]: https://practicaltypography.com/bold-or-italic.html

Bold and italic at the same time? What is the devils work?