@@ -2134,7 +2134,7 @@ def export_to_markdown( # noqa: C901
2134
2134
text = f"{ marker } { item .text } \n "
2135
2135
mdtexts .append (text .strip () + "\n " )
2136
2136
2137
- elif isinstance (item , TextItem ) and item .label in [ DocItemLabel . CODE ] :
2137
+ elif isinstance (item , CodeItem ) and item .label in labels :
2138
2138
in_list = False
2139
2139
text = f"```\n { item .text } \n ```\n "
2140
2140
mdtexts .append (text )
@@ -2440,11 +2440,14 @@ def close_lists(
2440
2440
text = f"<li>{ item .text } </li>"
2441
2441
html_texts .append (text )
2442
2442
2443
+ elif isinstance (item , CodeItem ) and item .label in labels :
2444
+ text = f"<pre><code>{ item .text } </code></pre>"
2445
+ html_texts .append (text .strip ())
2446
+
2443
2447
elif isinstance (item , TextItem ) and item .label in labels :
2444
2448
2445
2449
text = f"<p>{ item .text } </p>"
2446
2450
html_texts .append (text .strip ())
2447
-
2448
2451
elif isinstance (item , TableItem ):
2449
2452
2450
2453
text = item .export_to_html (doc = self , add_caption = True )
@@ -2642,6 +2645,17 @@ def close_lists(
2642
2645
add_content = add_content ,
2643
2646
add_page_index = add_page_index ,
2644
2647
)
2648
+ elif isinstance (item , CodeItem ) and (item .label in labels ):
2649
+
2650
+ result += item .export_to_document_tokens (
2651
+ doc = self ,
2652
+ new_line = delim ,
2653
+ xsize = xsize ,
2654
+ ysize = ysize ,
2655
+ add_location = add_location ,
2656
+ add_content = add_content ,
2657
+ add_page_index = add_page_index ,
2658
+ )
2645
2659
2646
2660
elif isinstance (item , TextItem ) and (item .label in labels ):
2647
2661
0 commit comments