On Sun, Dec 22, 2024 at 12:38:46PM +0000, Frederico Muñoz wrote: > Hello, > > I've been reading the texi2any output configuration and have > successfully used the ability to change how @ commands are output in > HTML mode; the introduction makes it clear that the facility is focused > on HTML, and that it might not work anywhere else.
Indeed, it is quite focused on HTML. > My question: I want to make slight adjustments to the output of > '--plaintext', like change the way @url is parsed (as an example, this > would allow me to change @url{This is foo, http://foo.bar} to [This is > foo](http://foo.bar), essentially creating a "markdown" document). Am I > correct in that this isn't possible using the output configuration > approach? And if so, is there any alternative? Indeed, it is not possible, and I do not think that it is worth having something similar, in particular because plaintext formatting is difficult to get right because it is about organizing the text output, not just adding markup as in the HTML case. There is @definfoenclose that can be used in some cases, although it is deprecated. My feeling is that the best approach would be some use of @macro, something like @ifplaintext @macro myurl {text, url} [\text\](\url\) @end macro @end ifplaintext @ifnotplaintext @macro myurl {text, url} @url{\text\, \url\} @end macro @end ifnotplaintext and then you would use, @myurl{This is foo, http://foo.bar} instead of @url in your case. Another possibility would be to do a true converter to markdown. If markdown is like HTML in that the presentation is done by the processor, it could be easier than plaintext. I had a look in the past, and the issue I saw with markdown was that it lacked a lot of features of Texinfo, such as footnotes or indices. It could still be possible to do more formatting, but it requires more work. Another issue with markdown seems to be its underspecification, but maybe this could be worked around. -- Pat