使用指定的 css 将 markdown 转换为 html
首先,我要说 - 我喜欢 Markdown。真的很喜欢它。它简单、优雅、性感,这就是我对标记语言的所有期望。如果可以的话,我会建议它:)
到目前为止,我一直在以一种非常好的和简单的方式使用它,Vim + python-markdown = 在我选择的浏览器中快速预览。
但是,它有一个缺点......CSS表被硬编码在插件内的某个地方,我无法更改它。 注意:我对 python 的了解为零,或者非常接近它。
是否有一个 markdown 到 -各种格式 - 插件,可以让你指定要使用的 css 页面,这样我就可以有几个并使用我当时希望的版本创建同一文档的多个版本?
它会是这样的
markdown my-document-in.markdown css-sheet.css cool-looking-document.html
First, let me say - I love markdown. Truly love it. It's simple, it's elegant, it's sexy, it's everything I wish for in a markup language. If I could, I'd propose to it :)
So far I've been using it in a very nice and simple way, Vim + python-markdown = fast preview in my browser of choice.
But, it has one drawback ... the css sheet is hardcoded somewhere inside the plugin, and I can't change it. Note: I know zero python, or something very close to it.
Is there a markdown to -various formats- plugin that lets you specify a css page to use, so that I could have several and create several versions of the same document using the one I wish at that time?
It would go something like
markdown my-document-in.markdown css-sheet.css cool-looking-document.html
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用 https://github.com/trentm/python-markdown2/ (特别是 https://raw.github.com/trentm/python-markdown2/master/lib/markdown2.py) ,我写了一个小脚本,当它被称为
generator.py input.markdown styles.css Pretty.html
(假设你将其保存为generator.py)使用python-markdown2库将markdown转换为HTML,将css文件嵌入到顶部并将其写入 Pretty.html。将 github 上的链接文件和上面的代码复制到一个文件夹中,它应该可以正常运行。我在本地测试过,可以用。希望它也能帮助你。
Using https://github.com/trentm/python-markdown2/ (specifically https://raw.github.com/trentm/python-markdown2/master/lib/markdown2.py), I wrote a small script which when called as
generator.py input.markdown styles.css pretty.html
(assuming you saved it as generator.py) uses the python-markdown2 library to convert the markdown to HTML, embeds the css file in the top and writes it to pretty.html.Copy the linked file from github and the code above into a folder together and it should run fine. I've tested it locally and it works. Hope it can help you too.