-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Pandoc vs Multimarkdown
This is an evolving document comparing features of Pandoc and Fletcher Penney's Multimarkdown.
| Format | Pandoc | MMD |
|---|---|---|
| markdown | yes | yes |
| reStructuredText | yes | no |
| Textile | yes | no |
| HTML | yes | no |
| LaTeX | yes | no |
| Format | Pandoc | MMD |
|---|---|---|
| HTML | yes | yes |
| LaTeX | yes | yes |
| ConTeXt | yes | no |
| markdown | yes | no |
| OPML | no | yes |
| OpenDocument XML | yes | yes |
| ODT | yes | no |
| Textile | yes | no |
| reStructuredText | yes | no |
| RTF | yes | no |
| DocBook | yes | no |
| Texinfo | yes | no |
| Groff man | yes | no |
| Mediawiki | yes | no |
| Emacs org-mode | yes | no |
| EPUB | yes | no |
| Slidy | yes | no |
| S5 | yes | no |
Pandoc includes a templating system for standalone documents. Default templates are included, but users can override them with custom templates.
Pandoc supports delimited code blocks, like this:
~~~~ {.haskell}
fibs = 1 : 1 : zipWith (+) (tail fibs) fibs
~~~~
Pandoc highlights code marked with a language in a delimited code block. No external program is required. Over 80 syntaxes are supported.
Pandoc supports a syntax for running example lists that are incremented throughout a document:
(@one) My first example will be numbered (1).
(@) My second example will be numbered (2).
Explanation of example (@one).
(@) My third example will be numbered (3).
Pandoc allows ordered lists to have different numbering styles and delimiters; these are recorded and reproduced, where possible, in the output format.
(a) My list
(b) Lowercase letters
i. Roman sublist
ii. Next
In standard markdown the starting number of an ordered list is ignored, so all lists start with 1. Pandoc allows lists to start with any number.
Pandoc supports strikeout ~~like so~~.
Pandoc supports superscripts: mc^2^.
Pandoc supports subscripts: H~2~O.
Pandoc allows raw TeX commands and environments in markdown. These are passed unchanged to LaTeX and ConTeXt writers, and ignored in other writers.
Pandoc treats an image in a paragraph by itself as a separate figure with a caption.
Pandoc has a Haskell API for convenient scripting. The AST can be modified between parsing and writing. For examples, see Scripting with pandoc.
Pandoc tables are designed to look natural in plain text (but require a monospace font for readability). Table cells can span multiple lines. Table cells can contain block-level elements (multiple paragraphs, lists, code blocks). Row spans and column spans are not currently supported. Captions are supported. Cell alignment is determined implicitly, based on the position of the column header. Cell widths are also determined implicitly, based on the width of the column.
Simple table:
Right Left Center Default
------- ------ ---------- -------
12 12 12 12
123 123 123 123
1 1 1 1
Table: Demonstration of simple table syntax.
Multiline table:
----------- ------- --------------- -------------------------
First row 12.0 Example of a row that
spans multiple lines.
Second row 5.0 Here's another one. Note
the blank line between
rows.
-------------------------------------------------------------
Grid table (generated using Emacs table mode):
+---------------+---------------+--------------------+
| Fruit | Price | Advantages |
+===============+===============+====================+
| Bananas | $1.34 | - built-in wrapper |
| | | - bright color |
+---------------+---------------+--------------------+
| Oranges | $2.10 | - cures scurvy |
| | | - tasty |
+---------------+---------------+--------------------+
MMD tables use | characters to indicate columns, so the tables are more readable using a proportional spaced font. Colons are used to indicate column alignment. Column spans but not row spans are supported. Captions are supported. Cells are limited to a single line and cannot contain block-level elements. Cell widths are not supported.
MMD table:
| | Grouping ||
First Header | Second Header | Third Header |
------------ | :-----------: | -----------: |
Content | *Long Cell* ||
Content | **Cell** | Cell |
New section | More | Data |
And more | And more |
[Prototype table]
Both pandoc and MMD allow a metadata block at the beginning of the document. Pandoc only supports title, author, and date (though other metadata can be specified by the command line). By convention, the first line preceded by % is the title, the second (if present) the authors, and the third (if present) the date. MMD allows arbitrary metadata fields to be specified using a key : value format. Quite a few document features can be controlled using metadata.
MMD does not parse the contents of metadata fields as markdown. Pandoc does, allowing titles and authors to include arbitrary markdown formatting (even footnotes).
An advantage of MMD's system is that arbitrary metadata fields can be specified. A disadvantage is that a document starting with a line containing a colon may be unexpectedly interpreted as beginning with metadata. Try "To be or not to be: that is the question." Note also that MMD's metadata fields cannot contain blank lines.
Pandoc metadata:
% My title with `markdown` *emphasis*
% John MacFarlane
John Doe
% September 6, 2004
MMD metadata:
Title: A New MultiMarkdown Document
Author: Fletcher T. Penney
John Doe
Date: July 25, 2005
""" XXX DEX PPT Generator - 主入口文件 生成深色科技风格的XXX DEX产品演示PPT """
from fastapi import FastAPI, File, UploadFile, HTTPException from fastapi.responses import FileResponse from fastapi.middleware.cors import CORSMiddleware from src.ppt_generator import XXXDEXPPTGenerator import uvicorn import os import tempfile
app = FastAPI( title="XXX DEX PPT Generator", description="生成XXX DEX产品演示PPT的自动化工具", version="1.0.0" )
app.add_middleware( CORSMiddleware, allow_origins=[""], allow_credentials=True, allow_methods=[""], allow_headers=["*"], )
@app.post("/generate-ppt") async def generate_ppt(): """生成PPTX文件并返回下载链接""" try: generator = XXXDEXPPTGenerator()
# 创建临时文件
with tempfile.NamedTemporaryFile(suffix='.pptx', delete=False) as tmp_file:
tmp_path = tmp_file.name
# 生成PPT
generator.create_presentation(tmp_path)
return FileResponse(
tmp_path,
media_type="application/vnd.openxmlformats-officedocument.presentationml.presentation",
filename="XXX-DEX-产品演示.pptx"
)
except Exception as e:
raise HTTPException(status_code=500, detail=str(e))
@app.get("/health") async def health_check(): """健康检查接口""" return {"status": "healthy", "service": "XXX DEX PPT Generator"}
if name == "main": uvicorn.run(app, host="0.0.0.0", port=8000)