Skip to content

Commit

Permalink
scrot and cache
Browse files Browse the repository at this point in the history
  • Loading branch information
treatmesubj committed Apr 12, 2023
1 parent d2d9649 commit 937e60c
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ optional arguments:
Specify alternative directory [default:current directory]
--css_file CSS_FILE css-file-path; its content will be written to the <style> element
--live_md_rr LIVE_MD_RR, -l LIVE_MD_RR
continuous refresh rate of MD page, in ms
Continuous refresh rate of MD page, in ms. Respects cache
```

### Markdown-to-HTML Out-File
Expand Down
3 changes: 3 additions & 0 deletions httpmdhtml/md_to_html.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ def markdown_to_html(MarkdownIt_obj, in_file_path, out_file_path="tmp.html",
soup = BeautifulSoup(html_text, 'html5lib') # adds <html>, <head>, <body>
soup.select_one('head').append(soup.new_tag("meta"))
soup.select_one('meta').attrs['charset'] = "UTF-8"
# if lots of images, caching is preferable more often than not
# soup.select_one('meta').attrs['http-equiv'] = "Cache-control"
# soup.select_one('meta').attrs['content'] = "no-cache"
soup.select_one('head').append(soup.new_tag("style"))
if css_file:
with open(css_file, 'r') as f:
Expand Down
2 changes: 1 addition & 1 deletion httpmdhtml/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def do_GET(self, rm_temp_html=False):
parser.add_argument('--css_file', default=None,
help='css-file-path; its content will be written to the <style> element')
parser.add_argument('--live_md_rr', '-l', action='store', type=int, default=None,
help='continuous refresh rate of MD page, in ms')
help='Continuous refresh rate of MD page, in ms. Respects cache')
parser.add_argument('port', action='store',
default=8000, type=int,
nargs='?',
Expand Down
Binary file modified scrot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 937e60c

Please sign in to comment.