Py.Cafe

huong-li-nguyen/

vizro-styling-playground

Vizro Styling Playground

DocsPricing
  • assets/
  • app.py
  • requirements.txt
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# Vizro is an open-source toolkit for creating modular data visualization applications.
# check out https://github.com/mckinsey/vizro for more info about Vizro
# and checkout https://vizro.readthedocs.io/en/stable/ for documentation.

"""Debug page to compare Vizro markdown/code styling in different wrappers."""

from vizro import Vizro
import vizro.models as vm


TEST_MARKDOWN = """
        `ENV_VAR`

        `<<TEST:TEST>>`

        `{{figure:<figure_id>}}`

        `<<TEST_TEST>>`
"""

TEST_MARKDOWN_CODE_BLOCK = """
        `ENV_VAR`
        `<<TEST:TEST>>`
        `<<TEST_TEST>>`
        ```python
        def foo():
           ...
        ```

"""
page_plain = vm.Page(
    title="Playground Plain",
    layout=vm.Flex(),
    components=[
        vm.Text(
            id="playground-plain-text",
            text=TEST_MARKDOWN,
        )
    ],
)

page_code_block = vm.Page(
    title="Playground Code Block",
    layout=vm.Flex(),
    components=[
        vm.Text(
            id="playground-code-block-text",
            text=TEST_MARKDOWN_CODE_BLOCK,
        )
    ],
)

pages = [page_plain, page_code_block]
dashboard = vm.Dashboard(pages=pages)

Vizro().build(dashboard).run()