<div dir="ltr">Hi Vitek,<br><br>I am the author of this package,<br><br>  <a href="http://angg.twu.net/dednat6/tug-slides.pdf">http://angg.twu.net/dednat6/tug-slides.pdf</a><br>  <a href="http://angg.twu.net/dednat6/tugboat-rev2.pdf">http://angg.twu.net/dednat6/tugboat-rev2.pdf</a><br>  <a href="http://angg.twu.net/dednat6.html">http://angg.twu.net/dednat6.html</a><br><br>that uses Lua to read material from the _comments_ of the current .tex<br>file. I think that what you need can be implemented easily on top of<br>this single-file version of the core of dednat6,<br><br>  <a href="http://angg.twu.net/dednat6/dednat6/minimalcore.lua.html">http://angg.twu.net/dednat6/dednat6/minimalcore.lua.html</a><br>  <a href="http://angg.twu.net/dednat6/dednat6/minimalcore.lua">http://angg.twu.net/dednat6/dednat6/minimalcore.lua</a><br>  <a href="http://angg.twu.net/dednat6/demo-core.tex.html">http://angg.twu.net/dednat6/demo-core.tex.html</a><br>  <a href="http://angg.twu.net/dednat6/demo-core.tex">http://angg.twu.net/dednat6/demo-core.tex</a><br>  <a href="http://angg.twu.net/dednat6/demo-core.pdf">http://angg.twu.net/dednat6/demo-core.pdf</a><br><br>that only implements the code that interprets each block of lines<br>starting with "%L" as a chunk of Lua code...<br><br>If this looks interesting to you, please get in touch! I took a<br>quick look at your markdown.dtx and I got the impression that 1) it<br>would be trivial to make my minimalcore.lua read the markdown code in<br>fencedCode blocks and make TeX skip over it, and that 2) it would be<br>easy to port the ideas from the prototype made with minimalcore.lua to<br>your markdown package.<br><br>  Cheers,<br>    Eduardo Ochs<br>    <a href="http://angg.twu.net/contact.html">http://angg.twu.net/contact.html</a><br><div><br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, 28 Aug 2021 at 19:57, Vítek Novotný <<a href="mailto:witiko@mail.muni.cz">witiko@mail.muni.cz</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hello all,<br>
<br>
in Knuth's TeX, trailing spaces are removed very early on when a line is<br>
being put to the input buffer. [1]  According to Eijkhout's TeX by<br>
Topic, this is because "these spaces are hard to see in an editor" [2].<br>
<br>
 [1]: <a href="https://texdoc.org/serve/tex.pdf/0#page=15" rel="noreferrer" target="_blank">https://texdoc.org/serve/tex.pdf/0#page=15</a><br>
 [2]: <a href="http://mirrors.ctan.org/info/texbytopic/TeXbyTopic.pdf" rel="noreferrer" target="_blank">http://mirrors.ctan.org/info/texbytopic/TeXbyTopic.pdf</a><br>
<br>
I develop and maintain the Markdown package [3] for plain TeX, ConTeXt,<br>
and LaTeX. The package makes it possible to use the lightweight markup<br>
of markdown [4] in TeX documents. In markdown, a hard line break can be<br>
inserted by ending a line with two or more spaces. However, since<br>
trailing spaces are removed by TeX, hard breaks are only recognized when<br>
we' are inserting an external markdown file, not when markdown is typed<br>
in the top-level document. This deficiency is known and documented [5],<br>
but I am hoping we could resolve it with LuaTeX.<br>
<br>
 [3]: <a href="https://github.com/witiko/markdown" rel="noreferrer" target="_blank">https://github.com/witiko/markdown</a><br>
 [4]: <a href="https://daringfireball.net/projects/markdown" rel="noreferrer" target="_blank">https://daringfireball.net/projects/markdown</a><br>
 [5]: <a href="https://mirrors.ctan.org/macros/generic/markdown/markdown.pdf#page=20" rel="noreferrer" target="_blank">https://mirrors.ctan.org/macros/generic/markdown/markdown.pdf#page=20</a><br>
<br>
In LuaTeX, the `process_input_buffer` callback [6] can be used to<br>
intercept the text coming *out* of the input buffer. However, the<br>
trailing spaces have already been removed by this point.<br>
<br>
By adding a callback right after a line has entered the input buffer<br>
[1], we could either replace the trailing space characters with tabs,<br>
or place a character such as the zero-width non-joiner (U+200C) to the<br>
right of the trailing spaces.<br>
<br>
 [6]: <a href="https://www.pragma-ade.com/general/manuals/luatex.pdf#page=176" rel="noreferrer" target="_blank">https://www.pragma-ade.com/general/manuals/luatex.pdf#page=176</a><br>
<br>
Is this something you would consider---if not for LuaTeX then perhaps<br>
for LuaMetaTeX?<br>
<br>
Best regards,<br>
Vítek Novotný<br>
</blockquote></div>