[luatex] Adding a callback before trailing spaces are removed from a line of input
witiko at mail.muni.cz
Sun Aug 29 00:43:23 CEST 2021
in Knuth's TeX, trailing spaces are removed very early on when a line is
being put to the input buffer.  According to Eijkhout's TeX by
Topic, this is because "these spaces are hard to see in an editor" .
I develop and maintain the Markdown package  for plain TeX, ConTeXt,
and LaTeX. The package makes it possible to use the lightweight markup
of markdown  in TeX documents. In markdown, a hard line break can be
inserted by ending a line with two or more spaces. However, since
trailing spaces are removed by TeX, hard breaks are only recognized when
we' are inserting an external markdown file, not when markdown is typed
in the top-level document. This deficiency is known and documented ,
but I am hoping we could resolve it with LuaTeX.
In LuaTeX, the `process_input_buffer` callback  can be used to
intercept the text coming *out* of the input buffer. However, the
trailing spaces have already been removed by this point.
By adding a callback right after a line has entered the input buffer
, we could either replace the trailing space characters with tabs,
or place a character such as the zero-width non-joiner (U+200C) to the
right of the trailing spaces.
Is this something you would consider---if not for LuaTeX then perhaps
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 833 bytes
Desc: not available
More information about the luatex