> Version 0.6 brings DashMachine one big step forward to being a finished product by adding a gui to edit the various settings in the config.ini. **Changelog** - improvements to /home including 'pinned' cards, multi-select tag filtering, 'action providers' allowing you to do web searches from the searchbar - rebuilt sidenav with list view, mirroring filter/search/collapse state of the homepage - /settings and /home now on same route - dynamic reloading of settings (no more page reloads) - dedicated config.ini editor slide-out - settings editor slide-out - card editor slide-out - better access group control - dedicated documentation pages - improved documentation - new system for automatically generating documentation for platforms - ability to load custom platforms - added an 'on_starup' method for platforms allowing for registering api routes. (example coming soon)
59 lines
1.4 KiB
Python
59 lines
1.4 KiB
Python
import os
|
|
from markdown2 import markdown
|
|
from flask import render_template_string, url_for
|
|
from dashmachine.paths import docs_folder
|
|
from dashmachine.docs_system.core_docs import (
|
|
base_md_string,
|
|
doc_toc_string,
|
|
apps_doc_dict,
|
|
custom_card_doc_dict,
|
|
collections_doc_dict,
|
|
)
|
|
|
|
|
|
def convert_html_to_md(md):
|
|
html = markdown(
|
|
md,
|
|
extras=[
|
|
"tables",
|
|
"fenced-code-blocks",
|
|
"break-on-newline",
|
|
"header-ids",
|
|
"code-friendly",
|
|
],
|
|
)
|
|
return html
|
|
|
|
|
|
def get_md_from_file(file, full_path=None):
|
|
if full_path:
|
|
path = full_path
|
|
else:
|
|
path = os.path.join(docs_folder, file)
|
|
with open(path) as readme_file:
|
|
md = readme_file.read()
|
|
html = convert_html_to_md(md)
|
|
return html
|
|
|
|
|
|
def get_md_from_dict(doc_dict):
|
|
rendered_md = render_template_string(base_md_string, doc_dict=doc_dict)
|
|
html = convert_html_to_md(rendered_md)
|
|
return html
|
|
|
|
|
|
def get_toc_md_from_dicts(doc_dicts):
|
|
rendered_md = render_template_string(doc_toc_string, doc_dicts=doc_dicts)
|
|
html = convert_html_to_md(rendered_md)
|
|
return html
|
|
|
|
|
|
def get_card_doc_dict(card_type):
|
|
if card_type == "app":
|
|
card_doc_dict = apps_doc_dict
|
|
if card_type == "collection":
|
|
card_doc_dict = collections_doc_dict
|
|
if card_type == "custom":
|
|
card_doc_dict = custom_card_doc_dict
|
|
return card_doc_dict
|