Closed AnnMarieW closed 4 months ago
This was a cool project but did't make it across the finish line because there were concerns about executing the code securely.
There are some other community project that are good for project that are a mix of code and markdown text. See:
https://github.com/snehilvj/markdown2dash https://github.com/snehilvj/dmc-docs https://github.com/emilhe/dash-down
Adds the new component
MarkdownAIO
See the live demo
MarkdownAIO
is a Dash feature that allows you to write Dash Apps as Markdown files. Simply pass in a Markdown file andMarkdownAIO
will return a set of components with the option to display and/or execute code blocks. So it’s part:It's also compatible with the
pages/
api. The online docs for dash-labs is a multi-page app made withpages/
and each page is a Markdown file displayed usingMarkdownAIO
.Here is a summary of the TODOs and questions:
[x] To further reduce security risk with
exec
, check for local files only. Ensure that the file is within a certain directory, and by default that should be the parent directory of the main app but maybe we could create a way to override that. Similar to /assets? Update - require full path from pages/[ ] css:
[x] see todos in
pages.py
in_register_page_from_markdown_file()
[x ] use UUID for clipboard ID?
[ ] add ability to change defaults "globally" so it doesn't have to be done for each
MarkdownAIO()
instance.[x] add ability to embed another file within the Markdown file. Use case being, ability to keep the python app code in a separate file so you can run it individually. We could integrate jinja in here perhaps…: {% include code.py %}
[ ] Add Markdown files to hot reload in dash. That way users can have the same hot-reloading dev experience when working in markdown
[ ] if code block is not executed don't register callbacks and layout? Goal it to reduce the number of
id
clashes.[ ] Need to remove
if __name__ == "__main__": ...
from the code blocks?[x] refactor
_update_props()
(It works, but it's kinda ugly)[x] rewrite the
_remove_app_instance()
to use the AST module