diff --git a/webviz_config/containers/_markdown.py b/webviz_config/containers/_markdown.py index 64c07d3d..865e59ff 100644 --- a/webviz_config/containers/_markdown.py +++ b/webviz_config/containers/_markdown.py @@ -7,6 +7,7 @@ import dash_core_components as html from . import WebvizContainer from ..webviz_assets import webviz_assets +from ..webviz_store import webvizstore class _WebvizMarkdownExtension(Extension): @@ -105,9 +106,12 @@ class Markdown(WebvizContainer): ALLOWED_STYLES = ['width', 'height'] def __init__(self, markdown_file: Path): + + self.markdown_file = markdown_file + self.html = bleach.clean( markdown.markdown( - markdown_file.read_text(), + get_path(self.markdown_file).read_text(), extensions=['tables', 'sane_lists', _WebvizMarkdownExtension( @@ -118,6 +122,14 @@ def __init__(self, markdown_file: Path): styles=Markdown.ALLOWED_STYLES ) + def add_webvizstore(self): + return [(get_path, [{'path': self.markdown_file}])] + @property def layout(self): return html.Markdown(self.html, dangerously_allow_html=True) + + +@webvizstore +def get_path(path) -> Path: + return path