groff -mandoc creating "ESC[1m" versus overstriking with backspace for bold text
0
votes
2
answers
138
views
I found that groff uses different ways to indicate bold text for the
utf8
output format.
On FreeBSD 14, groff emits escape codes for a terminal (ESC, [1m
):
$ printf ".Dd today\n.Sh NAME\n" | groff -mandoc -Tutf8 | od -c
0000000 \n 033 [ 1 m N A M E 033 [ 0 m \n
[...]
On Linux (debian Bookworm) is uses backspaces and overstriking:
$ printf ".Dd today\n.Sh NAME\n" | groff -mandoc -Tutf8 | od -c
[...]
0000120 N \b N A \b A M \b M E \b E \n
Why is it so and is there a way to make Linux groff also use ESC codes for the terminal? I have read the groff man page from top to bottom but can't find an option to change this behavior.
(I need to post-process the result and ESC codes make that much easier and flexible.)
**EDIT**: The solution (thanks go to @egmont) was to read Debian's grotty(1) manual and then force the SGR behavior with
printf ".Dd today\n.Sh NAME\n" | GROFF_SGR=y groff -mandoc -Tutf8
Asked by Jens
(1894 rep)
Nov 6, 2023, 07:10 PM
Last activity: Nov 7, 2023, 11:32 PM
Last activity: Nov 7, 2023, 11:32 PM