A better, easier way to make Multi-page apps with Dash
Status
:tada: Now available in dash 2.5.1!
Convert your multi-page app from a dash-labs pages plug-in to the pages feature in dash 2.5.1 in 3 easy steps:
Remove import dash_labs as dl or upgrade dash-labs to V1.1.0
There is a conflict between dash-labs versions less than 1.1.0 when running a pages app in dash 2.5.1
Change:
app = Dash(__name__, plugins=[dl.plugins.pages])
to:
app = Dash(__name__, use_pages=True)
Change:
dl.plugins.page_container
to:
dash.page_container
That's it!
:point_right: Thepages feature will no longer be developed and maintained here in dash-labs. I recommend all dash-labs multi-page apps be converted to use the pages feature in dash 2.5.1
MarkdownAIO
MarkdownAIO is a Dash feature that allows you to write Dash Apps as Markdown files. Simply pass in a Markdown file and MarkdownAIO will return a set of components with the option to display and/or execute code blocks. So it’s part:
Documentation helper
Markdown / Text authoring tool
Easy way to bring a markdown file into an app without doing open('file.md')
Status: Pull request in Dash Labs. Feature preview available. Project on hold pending re-write to make it easier to write secure dash apps
Summary of Open items:
[ ] Current way of running the code with exec can increase the risk of running malicious code. Project is on hold until this issue is solved. One potential solution is to only run code added to a markdown file like this: {% include example1.py %} This will ensure that only code on the server can be executed.
[ ] Improve the Stylesheet and add examples. Or find a better way to do this.
[ ] Do a dash-labs release
[ ] Write a parser for the yaml front-matter in Markdown files.
The purpose is to improve security by limiting the scope to pages/ and MarkdownAIO data. Use json.loads instead of eval or exec. This will also remove the pyaml and python-frontmatter dependency. See discussion: https://github.com/plotly/dash-labs/pull/82#discussion_r801129076
Add more info and concrete examples about writing secure dash apps with MarkdownAIO
Add examples for front-matter in Markdown files.
how to escape three back tick code fences in the docs
how to escape the {% include myfile.py %} in docs
[ ] Feature Request - Add Markdown files to hot reload in dash.
That way users can have the same hot-reloading dev experience when working in markdown. Pull request in Dash.
[ ] Feature request- Be able to use different sub-components.
Use-case is to use Prism from the dash-mantine-componets library to display code.
[ ] Feature request - Be able to change defaults globally so it doesn't have to be done for each MarkdownAIO() instance.
Multi Page Apps
A better, easier way to make Multi-page apps with Dash
Status
:tada: Now available in dash 2.5.1!
Convert your multi-page app from a dash-labs
pages
plug-in to thepages
feature in dash 2.5.1 in 3 easy steps:Remove
import dash_labs as dl
or upgrade dash-labs to V1.1.0 There is a conflict between dash-labs versions less than 1.1.0 when running a pages app in dash 2.5.1Change:
to:
Change:
to:
That's it!
:point_right: The
pages
feature will no longer be developed and maintained here in dash-labs. I recommend all dash-labs multi-page apps be converted to use thepages
feature in dash 2.5.1MarkdownAIO
MarkdownAIO is a Dash feature that allows you to write Dash Apps as Markdown files. Simply pass in a Markdown file and MarkdownAIO will return a set of components with the option to display and/or execute code blocks. So it’s part:
Status: Pull request in Dash Labs. Feature preview available. Project on hold pending re-write to make it easier to write secure dash apps
Summary of Open items:
[ ] Current way of running the code with exec can increase the risk of running malicious code. Project is on hold until this issue is solved. One potential solution is to only run code added to a markdown file like this: {% include example1.py %} This will ensure that only code on the server can be executed.
[ ] Raise error if using MarkdownAIO with exec within a callback. See discussion here: https://github.com/plotly/dash-labs/pull/82#discussion_r801171286
[ ] Improve the Stylesheet and add examples. Or find a better way to do this.
[ ] Do a dash-labs release
[ ] Write a parser for the
yaml
front-matter in Markdown files. The purpose is to improve security by limiting the scope topages/
andMarkdownAIO
data. Usejson.loads
instead ofeva
l orexec
. This will also remove thepyaml
andpython-frontmatter
dependency. See discussion: https://github.com/plotly/dash-labs/pull/82#discussion_r801129076[ ] Improve error handling and error messages
[ ] Write community forum announcement
[ ] Create dash pull request :confetti_ball:
[ ] Documentation
MarkdownAIO
[ ] Feature Request - Add Markdown files to hot reload in dash. That way users can have the same hot-reloading dev experience when working in markdown. Pull request in Dash.
[ ] Feature request- Be able to use different sub-components.
Use-case is to use Prism from the
dash-mantine-componets
library to display code.[ ] Feature request - Be able to change defaults globally so it doesn't have to be done for each MarkdownAIO() instance.