File tree Expand file tree Collapse file tree 1 file changed +7
-9
lines changed Expand file tree Collapse file tree 1 file changed +7
-9
lines changed Original file line number Diff line number Diff line change @@ -229,28 +229,26 @@ impl Markdown {
229
229
Event :: End ( tag) => {
230
230
tags. pop ( ) ;
231
231
match tag {
232
- Tag :: Heading ( _, _, _)
233
- | Tag :: Paragraph
234
- | Tag :: CodeBlock ( CodeBlockKind :: Fenced ( _) )
235
- | Tag :: Item => {
232
+ Tag :: Heading ( _, _, _) | Tag :: Paragraph | Tag :: CodeBlock ( _) | Tag :: Item => {
236
233
push_line ( & mut spans, & mut lines) ;
237
234
}
238
235
_ => ( ) ,
239
236
}
240
237
241
238
// whenever heading, code block or paragraph closes, empty line
242
239
match tag {
243
- Tag :: Heading ( _, _, _)
244
- | Tag :: Paragraph
245
- | Tag :: CodeBlock ( CodeBlockKind :: Fenced ( _) ) => {
240
+ Tag :: Heading ( _, _, _) | Tag :: Paragraph | Tag :: CodeBlock ( _) => {
246
241
lines. push ( Spans :: default ( ) ) ;
247
242
}
248
243
_ => ( ) ,
249
244
}
250
245
}
251
246
Event :: Text ( text) => {
252
- // TODO: temp workaround
253
- if let Some ( Tag :: CodeBlock ( CodeBlockKind :: Fenced ( language) ) ) = tags. last ( ) {
247
+ if let Some ( Tag :: CodeBlock ( kind) ) = tags. last ( ) {
248
+ let language = match kind {
249
+ CodeBlockKind :: Fenced ( language) => language,
250
+ CodeBlockKind :: Indented => "" ,
251
+ } ;
254
252
let tui_text = highlighted_code_block (
255
253
text. to_string ( ) ,
256
254
language,
You can’t perform that action at this time.
0 commit comments