Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Markdown preview Python-based plugin for gedit

Tags:

python

gedit

I've installed the gedit-markdown plugin for gedit running on Lubuntu 13.04. It works as expected.

markdown preview in gedit

However, for ease of viewing, I altered the appearance of the resulting html panel (left panel) by including a link to a local stylesheet at the top of each markdown file. But this approach obviously means that I have to alter all my existing markdown files.

To avoid that, I looked at ~/.local/share/gedit/plugins/markdown-preview/__init__.py which has the code for the plugin, and I see lines #39 and #40 (reproduced below):

# Can be used to add default HTML code (e.g. default header section with CSS).
htmlTemplate = "%s" 

That gives me the impression that I can somehow tell the plugin to look at a stylesheet and style the html accordingly. But I don't know what to do (if indeed htmlTemplate = "%s" has to be changed).


1 Answers

Set htmlTemplate to something like the following

# 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>
"""
like image 143
punchagan Avatar answered May 31 '26 06:05

punchagan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!