我已经安装了 markdown preview plugin适用于在 Lubuntu 13.04 上运行的 gedit。它按预期工作。
但是,为了便于查看,我通过在每个 Markdown 文件的顶部包含指向本地样式表的链接来更改生成的 html 面板(左侧面板)的外观。但这种方法显然意味着我必须更改所有现有的 Markdown 文件。
为了避免这种情况,我查看了 ~/.local/share/gedit/plugins/markdown-preview/__init__.py 其中有 code for the plugin ,我看到第 39 行和第 40 行(转载如下):
# Can be used to add default HTML code (e.g. default header section with CSS).
htmlTemplate = "%s"
这给我的印象是我可以以某种方式告诉插件查看样式表并相应地设置 html 的样式。但我不知道该怎么办(如果确实 htmlTemplate = "%s" 必须更改)。
请您参考如下方法:
将 htmlTemplate 设置为如下内容
# Can be used to add default HTML code (e.g. default header section with CSS).
htmlTemplate = """
<html>
<head>
<link rel="stylesheet" type="text/css" charset="utf-8" media="screen" href="http://paste.ubuntu.com/static/pastebin.css">
</head>
<body>
%s
</body>
</html>
"""
