Grrrrr -- I give up, but the .DS/.DI should be on separate lines... On Sunday, September 5, 2021, 2:31:21 AM PDT, Meg McRoberts via <groff@gnu.org> wrote: Shoot! This mail doesn't look like what I typed! Let me try the formatting of the code snippet again...
On Sunday, September 5, 2021, 1:56:32 AM PDT, Meg McRoberts via <groff@gnu.org> wrote: Which macro set are you using? For mm, I think .DS/.DE used to do thisbut it's been a while and things may have changed. Try the following: .DS<pre><code>fun() { echo "hello" > /dev/null 2>&1; } </code></pre>.DE I added some additional spaces in front of the echo line -- I think the norm is to use 8 spaces or a tab for indented lines but maybe that's just me. You could use .DS I to indent the entire display if you like. On Saturday, September 4, 2021, 6:10:37 PM PDT, NRK <n...@disroot.org> wrote: Hi, Recently I've thought about using groff for writing static website. One problem I've ran into is doing codeblocks. What I'm trying to do is this: .HTML <pre><code> fun() { echo "hello" > /dev/null 2>&1; } .HTML </code></pre> However this doesn't preserve the indendation and newlines are not properly preserved either. The output I'm trying to achieve is _exactly_ the following: <pre><code> fun() { echo "hello" > /dev/null 2>&1; } </code></pre> It should escape anything that needs escaping but preserve indendation and newlines properly. - NRK