Ask Your Question

Pandoc filter

asked 2019-09-08 23:55:57 +0200

Georg Damm gravatar image

I'd like to use sagemath in markdown similar to sagetex:

<div class="sagesilent"> f(x)=sin(x) </div> 
This is a plot of <span class="sage"> f(x) </span> 
<div class="sageplot"> plot(f(x),(x,0,5)) </div>

Is there already a pandoc filter for this?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2019-09-09 02:26:04 +0200

Emmanuel Charpentier gravatar image

updated 2019-09-09 02:42:26 +0200

I suppose that you aim at creating some object document from a source (not LaTeX: in this latter case, pandocing a LaTeX source containing (processed) SageTeX chunks would probably work).

I'd suggest to take a look at codebraid, which aims to do for Markdown what Pythontex does for LaTeX (i. e. inserting Python (and other languages) chunks in a source text, but more general): both packages support Sage.

Processing a Markdown source via codebraid and translating it to HTML via pandoc should give you something close to what you aim at (at least for some values of "Markdown"...).

Another possibility is org-mode, whose abilities are impressive, but is strictly an emacs tool, that comes with its Matterhorrn-like learning curve... Needs a bit of time to get used to, supports an impressive array of languages (about 75 last time I looked), including Sage.

If you need heavy cross-referencing (i. e. captions and pointers to tables, figures, equations, parts of text, bibliographic reerences), your best bet is LaTeX + (possibly imperfect) translation to HTML via pandoc or org-mode: the crross-referencing abilities of Markdown are still in infancy and need (not so stable) external filters...

edit flag offensive delete link more


Thank's for your answer, but this is not what I'm looking for. I'll try to write a filter. Is there an easy way to get the (latex) output


from the following file?

Georg Damm gravatar imageGeorg Damm ( 2019-09-12 23:28:05 +0200 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2019-09-08 23:55:57 +0200

Seen: 87 times

Last updated: Sep 09 '19