admin管理员组

文章数量:1391925

I'm using Pandoc to convert a Latex project to Markdown (to display it via Dokusaurus). I would like to define certain sections inside the Latex text that are ignored when compiled as a Pdf, but are kept when converted to markdown

I'm thinking of something like this:

% This config is only relevant for dokusuarus and must not be present in the Pdf
\begin{markdown-only}
---
title: Foobar42
---
\end{markdown-only}

\section{Section 1}
Lorem Ipsum dolor sit amet.

Resulting Latex PDF:

Section 1

Lorem Ipsum dolor sit amet.

Resulting markdown after conversion with pandoc:

---
title: Foobar42
---

# Section 1
Lorem Ipsum dolor sit amet.

How can I achieve this? I've played around with custom Latex commands and pandoc Lua-Filters. But it seems pandoc is too smart and ignores everything that would not end up in the Latex pdf.

本文标签: luaHow to have an invisible Latex section that is kept when converted to markdown (Pandoc)Stack Overflow