Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -6,7 +6,8 @@ import traceback
|
|
6 |
from io import BytesIO
|
7 |
import re
|
8 |
import base64
|
9 |
-
|
|
|
10 |
from pygments.formatters import HtmlFormatter
|
11 |
from pygments.styles import get_all_styles
|
12 |
|
@@ -96,6 +97,13 @@ def build_full_html(markdown_text, styles, include_fontawesome):
|
|
96 |
color: {styles.get('text_color', '#333')}; background-color: {styles.get('background_color', '#fff')};
|
97 |
}}
|
98 |
/* ... other scoped styles ... */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
99 |
{wrapper_id} h1, {wrapper_id} h2, {wrapper_id} h3 {{ border-bottom: 1px solid #eee; padding-bottom: 5px; margin-top: 1.5em; }}
|
100 |
{wrapper_id} :not(pre) > code {{ font-family: 'Courier New', monospace; background-color: #eef; padding: .2em .4em; border-radius: 3px; }}
|
101 |
{pygments_css} {styles.get('custom_css', '')}
|
|
|
6 |
from io import BytesIO
|
7 |
import re
|
8 |
import base64
|
9 |
+
from pygments import highlight
|
10 |
+
from pygments.lexers import get_lexer_by_name
|
11 |
from pygments.formatters import HtmlFormatter
|
12 |
from pygments.styles import get_all_styles
|
13 |
|
|
|
97 |
color: {styles.get('text_color', '#333')}; background-color: {styles.get('background_color', '#fff')};
|
98 |
}}
|
99 |
/* ... other scoped styles ... */
|
100 |
+
|
101 |
+
{wrapper_id} table {{ border-collapse: collapse; width: 100%; }}
|
102 |
+
{wrapper_id} th, {wrapper_id} td {{ border: 1px solid #ddd; padding: 8px; text-align: left; }}
|
103 |
+
{wrapper_id} th {{ background-color: #f2f2f2; }}
|
104 |
+
{wrapper_id} img {{ max-width: 100%; height: auto; }}
|
105 |
+
{wrapper_id} pre {{ padding: {styles.get('code_padding', '15')}px; border-radius: 5px; white-space: pre-wrap; word-wrap: break-word; }}
|
106 |
+
|
107 |
{wrapper_id} h1, {wrapper_id} h2, {wrapper_id} h3 {{ border-bottom: 1px solid #eee; padding-bottom: 5px; margin-top: 1.5em; }}
|
108 |
{wrapper_id} :not(pre) > code {{ font-family: 'Courier New', monospace; background-color: #eef; padding: .2em .4em; border-radius: 3px; }}
|
109 |
{pygments_css} {styles.get('custom_css', '')}
|