Skip to content

trashhalo/astro-pandoc

Repository files navigation

Astro Pandoc

Astro component for using pandoc to convert content. This allows you to embed any format pandoc supports.

Usage

---
import { Pandoc } from "astro-pandoc";
---
<Pandoc caller={import.meta.url} file="Component.tex" extraArgs={["--webtex"]} /

Component.tex

\documentclass{article}
\usepackage{amsmath} % for the equation* environment
\begin{document}

This is a simple math expression \(\sqrt{x^2+1}\) inside text. 
And this is also the same: 
\begin{math}
\sqrt{x^2+1}
\end{math}
but by using another command.

This is a simple math expression without numbering
\[\sqrt{x^2+1}\] 
separated from text.

This is also the same:
\begin{displaymath}
\sqrt{x^2+1}
\end{displaymath}

\ldots and this:
\begin{equation*}
\sqrt{x^2+1}
\end{equation*}

\end{document}

Screenshot of a the rendered demo page

Props

  • caller: url of the caller so we can use it to look up relative paths
  • file: input file relative to the caller
  • extraArgs: optional. array of extra arguments to pass to pandoc
  • template: optional. control the html generated by pandoc