-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Pandoc vs Markdown.pl
List of cases where `Markdown.pl` fails and Pandoc does the right thing.
Babelmark is a web page that allows you to compare various markdown implementations (thanks to Michel Fortin and Tom Doran). Here are some of my favorites:
- Unordered list followed by ordered list
- Indented code in list item
- Right-aligned list numbering
- Unescaped >
- Nested strong and emph
http://thread.gmane.org/gmane.text.markdown.general/2341/focus=2342
Just a small test
This is some code
and some indented code
and this is the end
1. Just a small test
This is some code
and some indented code
and this is the end
Markdown.pl
yields
<p>Just a small test</p>
<pre><code> This is some code
and some indented code
</code></pre>
<p>and this is the end</p>
<ol>
<li><p>Just a small test</p>
<pre><code> This is some code
<pre><code> and some indented code
</code></pre>
</code></pre>
<p>and this is the end</p></li>
</ol>
<div>
<div>
text
</div>
</div>
Markdown.pl
yields
<div>
<div>
text
</div>
<p></div></p>
Note: This is fixed in Markdown.pl 1.0.2.
This should be an unordered list followed by an ordered one:
- foo
- bar
1. first
1. second
Markdown.pl
yields
<h1>Test case</h1>
<p>This should be an unordered list followed by an ordered one:</p>
<ul>
<li>foo</li>
<li><p>bar</p></li>
<li><p>first</p></li>
<li>second</li>
</ul>
See also: http://bugs.debian.org/368413
Input:
+ item 1
+ item 2
* * * * *
Markdown.pl's output:
<ul>
<li><p>item 1</p>
<ul><li><p>item 2</p></li>
<li><ul><li><ul><li><ul><li>*</li></ul></li></ul></li></ul></li></ul></li>
</ul>
(Courtesy of Allan Odgaard)
* item 1
* item 1a
* item 2
* item 2a
* item 2b
* item 2c
* item 3
And
8. item 1
9. item 2
10. item 2a
In both cases, Markdown.pl
produces sublists (in the way indicated by
the item numbering) and pandoc does not.
***bold** in italics*
Markdown.pl's output:
<p><strong><em>bold</strong> in italics</em></p>
Markdown.pl
turns
x<max(a,b)
into
<p>x<max(a,b)</p>
where it should be
<p>x<max(a,b)</p>
""" 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)