* ANSI escape sequences in jupyter notebook output cells
@ 2022-09-20 14:59 Meik Hellmund
[not found] ` <956e8385-8b5f-49de-a74a-cc62f84be526n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
0 siblings, 1 reply; 5+ messages in thread
From: Meik Hellmund @ 2022-09-20 14:59 UTC (permalink / raw)
To: pandoc-discuss
[-- Attachment #1.1: Type: text/plain, Size: 1010 bytes --]
'jupyter nbconvert' is able to produce colored output in HTML and LaTeX
from ipynb files with output colored and styled by ANSI escape sequences. I
think
https://github.com/jupyter/nbconvert/blob/main/nbconvert/filters/ansi.py is
the relevant code.
Is it possible to implement this by a pandoc filter? If I understand
https://github.com/jgm/pandoc/issues/5633 correctly, those escape
sequences are already missing in the AST presented to a filter. Would it be
possible to have an option that keeps them?
Many thanks for a great software and years of development and maintenance!
Meik
--
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/956e8385-8b5f-49de-a74a-cc62f84be526n%40googlegroups.com.
[-- Attachment #1.2: Type: text/html, Size: 1391 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: ANSI escape sequences in jupyter notebook output cells
[not found] ` <956e8385-8b5f-49de-a74a-cc62f84be526n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2022-09-20 18:01 ` John MacFarlane
[not found] ` <A2514F6B-C5E9-4815-A15B-06570F1DA399-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
0 siblings, 1 reply; 5+ messages in thread
From: John MacFarlane @ 2022-09-20 18:01 UTC (permalink / raw)
To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw
The ANSI escapes are stripped out of the code block unless the output format is ipynb OR `--ipynb-output=all` is used.
So, if you use that command-line option, you could write a filter that does something with the ANSI escapes.
> On Sep 20, 2022, at 7:59 AM, Meik Hellmund <meik.hellmund-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
> 'jupyter nbconvert' is able to produce colored output in HTML and LaTeX from ipynb files with output colored and styled by ANSI escape sequences. I think https://github.com/jupyter/nbconvert/blob/main/nbconvert/filters/ansi.py is the relevant code.
>
> Is it possible to implement this by a pandoc filter? If I understand https://github.com/jgm/pandoc/issues/5633 correctly, those escape sequences are already missing in the AST presented to a filter. Would it be possible to have an option that keeps them?
>
> Many thanks for a great software and years of development and maintenance!
> Meik
>
>
> --
> You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/956e8385-8b5f-49de-a74a-cc62f84be526n%40googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/A2514F6B-C5E9-4815-A15B-06570F1DA399%40gmail.com.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: ANSI escape sequences in jupyter notebook output cells
[not found] ` <A2514F6B-C5E9-4815-A15B-06570F1DA399-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2022-09-21 10:14 ` Meik Hellmund
[not found] ` <5f877bed-697b-481c-9604-c5d69168eda9n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
0 siblings, 1 reply; 5+ messages in thread
From: Meik Hellmund @ 2022-09-21 10:14 UTC (permalink / raw)
To: pandoc-discuss
[-- Attachment #1.1: Type: text/plain, Size: 1043 bytes --]
Ah, thank you! I totally misunderstood the meaning of `--ipynb-output`.
So I can start playing around with a lua filter.
I want to use this filter with Quarto. Then I will need the original
meaning/effect of `ipynb-output=best`, too.
Rewrite your ` filterIpynbOutput` function in Lua?
Best regards, Meik
fiddlosopher schrieb am Dienstag, 20. September 2022 um 20:01:46 UTC+2:
> The ANSI escapes are stripped out of the code block unless the output
> format is ipynb OR `--ipynb-output=all` is used.
> So, if you use that command-line option, you could write a filter that
> does something with the ANSI escapes.
>
>
--
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/5f877bed-697b-481c-9604-c5d69168eda9n%40googlegroups.com.
[-- Attachment #1.2: Type: text/html, Size: 1634 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: ANSI escape sequences in jupyter notebook output cells
[not found] ` <5f877bed-697b-481c-9604-c5d69168eda9n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2022-09-21 17:31 ` John MacFarlane
[not found] ` <C06A9D62-D18A-45A0-B1A8-CC0C7917AB1D-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
0 siblings, 1 reply; 5+ messages in thread
From: John MacFarlane @ 2022-09-21 17:31 UTC (permalink / raw)
To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw
You could perhaps output to native (using the filter and --ipynb-output=all), then read in the native and output your desired format using --ipynb-output=best?
> On Sep 21, 2022, at 3:14 AM, Meik Hellmund <meik.hellmund-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
> Ah, thank you! I totally misunderstood the meaning of `--ipynb-output`. So I can start playing around with a lua filter.
> I want to use this filter with Quarto. Then I will need the original meaning/effect of `ipynb-output=best`, too.
> Rewrite your ` filterIpynbOutput` function in Lua?
>
> Best regards, Meik
>
>
>
> fiddlosopher schrieb am Dienstag, 20. September 2022 um 20:01:46 UTC+2:
> The ANSI escapes are stripped out of the code block unless the output format is ipynb OR `--ipynb-output=all` is used.
> So, if you use that command-line option, you could write a filter that does something with the ANSI escapes.
>
>
> --
> You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/5f877bed-697b-481c-9604-c5d69168eda9n%40googlegroups.com.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: ANSI escape sequences in jupyter notebook output cells
[not found] ` <C06A9D62-D18A-45A0-B1A8-CC0C7917AB1D-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2022-09-26 19:06 ` Meik Hellmund
0 siblings, 0 replies; 5+ messages in thread
From: Meik Hellmund @ 2022-09-26 19:06 UTC (permalink / raw)
To: pandoc-discuss
[-- Attachment #1.1: Type: text/plain, Size: 2102 bytes --]
Hm, I want to use this as a quarto extension. Don't know how to make two
pandoc-runs in quarto. So I tried to implement the logic of
`--ipynb-outbut=best` in lua:
https://gitea.math.uni-leipzig.de/hellmund/PandocAnsiFilter
fiddlosopher schrieb am Mittwoch, 21. September 2022 um 19:32:04 UTC+2:
> You could perhaps output to native (using the filter and
> --ipynb-output=all), then read in the native and output your desired format
> using --ipynb-output=best?
>
> > On Sep 21, 2022, at 3:14 AM, Meik Hellmund <meik.h...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> >
> > Ah, thank you! I totally misunderstood the meaning of `--ipynb-output`.
> So I can start playing around with a lua filter.
> > I want to use this filter with Quarto. Then I will need the original
> meaning/effect of `ipynb-output=best`, too.
> > Rewrite your ` filterIpynbOutput` function in Lua?
> >
> > Best regards, Meik
> >
> >
> >
> > fiddlosopher schrieb am Dienstag, 20. September 2022 um 20:01:46 UTC+2:
> > The ANSI escapes are stripped out of the code block unless the output
> format is ipynb OR `--ipynb-output=all` is used.
> > So, if you use that command-line option, you could write a filter that
> does something with the ANSI escapes.
> >
> >
> > --
> > You received this message because you are subscribed to the Google
> Groups "pandoc-discuss" group.
> > To unsubscribe from this group and stop receiving emails from it, send
> an email to pandoc-discus...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> > To view this discussion on the web visit
> https://groups.google.com/d/msgid/pandoc-discuss/5f877bed-697b-481c-9604-c5d69168eda9n%40googlegroups.com
> .
>
>
--
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/b116a85b-6a23-40ee-9f90-3dd5e29b6a9dn%40googlegroups.com.
[-- Attachment #1.2: Type: text/html, Size: 3257 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-09-26 19:06 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-20 14:59 ANSI escape sequences in jupyter notebook output cells Meik Hellmund
[not found] ` <956e8385-8b5f-49de-a74a-cc62f84be526n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2022-09-20 18:01 ` John MacFarlane
[not found] ` <A2514F6B-C5E9-4815-A15B-06570F1DA399-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2022-09-21 10:14 ` Meik Hellmund
[not found] ` <5f877bed-697b-481c-9604-c5d69168eda9n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2022-09-21 17:31 ` John MacFarlane
[not found] ` <C06A9D62-D18A-45A0-B1A8-CC0C7917AB1D-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2022-09-26 19:06 ` Meik Hellmund
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).