Escape codes visible in code block
atsaloli opened this issue · 12 comments
Hello,
Just started using mdless
. Really excited to adopt this tool, I plan to use this to teach a class, my materials are in Markdown format and I can use mdless to render them for the students live.
Small problem -- I am seeing escape codes in the code block:
This is with mdless 1.0.15.
pygments has my code language:
[root@ip-172-31-16-17 source]# pygmentize -L | grep cfengine
* cfengine3, cf3:
[root@ip-172-31-16-17 source]#
I am on Windows 10, and the above screenshot is in Windows Terminal. I have the same issue in the Windows console (what I get when I run bash.exe):
Is it me? Or is it something in mdless?
Here is my source file (just take out the backslashes), to reproduce:
The promise type is always followed by a single colon.
\```cfengine3
files:
"/etc/nologin"
create => "true",
comment => "Prevent non-root users from logging in";
\```
If I run mdless with --no-color, the escape codes disappear -- but I want the color. :)
Well, that older pygmentize doesn't know about my language:
[root@localhost source]# pygmentize -L|grep cf3
[root@localhost source]#
I don't know if it is the case for you, but I worked out that I was seeing the Escape codes because my PAGER was most
export PAGER=most
echo '#h1
' | mdless
^[[0;1;47;90mh1 ===
The workaround is to disable the PAGER with the -P
switch or change your PAGER to less
or something else.
Workaround
export PAGER=less
or
echo '#h1
' | PAGER=less mdless
Sorry it took me so long to get back around to this, @atsaloli . Did you ever find a resolution for the issue?
I found a workaround @ttscoff -- see atsaloli/cf3-tutorial@fee89be
As noted in #60 (comment) my workaround is to add a header
Thanks for following up! :)
I was very happy to be able to teach my class using mdless