Spaces:
Runtime error
Runtime error
Update code_editor.py
Browse files- code_editor.py +4 -1
code_editor.py
CHANGED
@@ -1,17 +1,20 @@
|
|
1 |
import json
|
2 |
|
3 |
-
def code_editor(value: str = "", issue_num: int = 0) -> str:
|
4 |
"""
|
5 |
Returns an HTML snippet for a CodeMirror-based code editor.
|
6 |
|
7 |
Args:
|
8 |
value (str): Initial content for the code editor.
|
9 |
issue_num (int): The issue number to identify the editor instance.
|
|
|
10 |
|
11 |
Returns:
|
12 |
str: HTML string that embeds a CodeMirror editor.
|
13 |
"""
|
|
|
14 |
html = f"""
|
|
|
15 |
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.65.3/codemirror.min.css">
|
16 |
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.65.3/theme/material-darker.min.css">
|
17 |
|
|
|
1 |
import json
|
2 |
|
3 |
+
def code_editor(value: str = "", issue_num: int = 0, label: str = "") -> str:
|
4 |
"""
|
5 |
Returns an HTML snippet for a CodeMirror-based code editor.
|
6 |
|
7 |
Args:
|
8 |
value (str): Initial content for the code editor.
|
9 |
issue_num (int): The issue number to identify the editor instance.
|
10 |
+
label (str): Optional label for the editor.
|
11 |
|
12 |
Returns:
|
13 |
str: HTML string that embeds a CodeMirror editor.
|
14 |
"""
|
15 |
+
# You can include the label in the HTML if needed
|
16 |
html = f"""
|
17 |
+
<div>{label}</div> <!-- Display the label -->
|
18 |
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.65.3/codemirror.min.css">
|
19 |
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.65.3/theme/material-darker.min.css">
|
20 |
|