-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapp.py
38 lines (32 loc) · 896 Bytes
/
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
import dash_react_syntax_highlighter
from dash import Dash, html
app = Dash(__name__)
sample_code = """
def fibonacci(n):
if n <= 1:
return n
else:
return fibonacci(n-1) + fibonacci(n-2)
# Print the first 10 Fibonacci numbers
for i in range(10):
print(f"Fibonacci({i}) = {fibonacci(i)}")
""".strip()
style_options = ["dark", "coy", "okaidia", "twilight", "solarizedlight"]
app.layout = html.Div(
[
html.H1("Syntax Highlighting Styles"),
*[
html.Div(
[
html.H2(style),
dash_react_syntax_highlighter.DashReactSyntaxHighlighter(
code=sample_code, language="python", styleName=style
),
]
)
for style in style_options
],
]
)
if __name__ == "__main__":
app.run_server(debug=True)