add feature:
setting to increase font scale
This commit is contained in:
@ -25,7 +25,7 @@ markdowner = Markdown(extras=["fenced-code-blocks", "cuddled-lists"])
|
||||
# does it stupidly throw them out? (we could implement something of our own)
|
||||
executor = concurrent.futures.ThreadPoolExecutor(max_workers=5)
|
||||
|
||||
def markdown2html(markdown, basepath, re_render, resources, viewport_width):
|
||||
def markdown2html(markdown, basepath, re_render, resources, viewport_width, font_scale=1.0):
|
||||
""" converts the markdown to html, loads the images and puts in base64 for sublime
|
||||
to understand them correctly. That means that we are responsible for loading the
|
||||
images from the internet. Hence, we take in re_render, which is just a function we
|
||||
@ -84,7 +84,11 @@ def markdown2html(markdown, basepath, re_render, resources, viewport_width):
|
||||
# FIXME: highlight the code using Sublime's syntax
|
||||
|
||||
# FIXME: report that ST doesn't support <br/> but does work with <br />... WTF?
|
||||
return "<style>\n{}\n</style>\n\n{}".format(resources["stylesheet"], soup).replace(
|
||||
# Add font scaling CSS rule
|
||||
font_scale_css = "body {{ font-size: {}em; }}\n".format(font_scale)
|
||||
stylesheet = font_scale_css + resources["stylesheet"]
|
||||
|
||||
return "<style>\n{}\n</style>\n\n{}".format(stylesheet, soup).replace(
|
||||
"<br/>", "<br />"
|
||||
)
|
||||
|
||||
@ -218,4 +222,5 @@ def independent_markdown2html(markdown):
|
||||
"stylesheet": "",
|
||||
},
|
||||
960,
|
||||
1.0, # Add default font_scale for independent call
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user