Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -44,6 +44,17 @@ def markdown_to_word(markdown_text):
|
|
| 44 |
if word.startswith('**') and word.endswith('**'):
|
| 45 |
run = p.add_run(word[2:-2])
|
| 46 |
run.bold = True
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 47 |
elif word.startswith('*') and word.endswith('*'):
|
| 48 |
run = p.add_run(word[1:-1])
|
| 49 |
run.italic = True
|
|
|
|
| 44 |
if word.startswith('**') and word.endswith('**'):
|
| 45 |
run = p.add_run(word[2:-2])
|
| 46 |
run.bold = True
|
| 47 |
+
elif '**' in word:
|
| 48 |
+
# Handle case where bold spans multiple words
|
| 49 |
+
start_index = word.find('**')
|
| 50 |
+
end_index = word.rfind('**')
|
| 51 |
+
if start_index != -1 and end_index != -1:
|
| 52 |
+
run = p.add_run(word[start_index + 2:end_index])
|
| 53 |
+
run.bold = True
|
| 54 |
+
p.add_run(' ')
|
| 55 |
+
# Add the remaining part of the word after bold formatting
|
| 56 |
+
p.add_run(word[end_index + 2:])
|
| 57 |
+
continue # Move to the next word
|
| 58 |
elif word.startswith('*') and word.endswith('*'):
|
| 59 |
run = p.add_run(word[1:-1])
|
| 60 |
run.italic = True
|