Skip to content

[BUG] Incorrect ordering of markdown elements #1036

@aroberge

Description

@aroberge

Read the docs
I didn't see this bug mentioned ... nor would I expect you not to know about it and not fix it! ;-)

Describe the bug
When a markdown file contains a indented block after an itemized list, the content of the indented block is shown before the itemized list.

To Reproduce
A minimal code example that reproduces the problem would be a big help if you can provide it. If the issue is visual in nature, consider posting a screenshot.

Here's the content of a simple markdown file:

This is a test.

1. first item
2. second item

       code block

Normal text

Here is how Rich renders it:

This is a test.

┌─────────────────────────────────────────────────────────────────┐
│ code block                                                      │
└─────────────────────────────────────────────────────────────────┘

 1 first item
 2 second item

Normal text

Platform
Windows, Windows terminal

Diagnose
I may ask you to cut and paste the output of the following commands. It may save some time if you do it now.

╭──────────────── <class 'rich.console.Console'> ─────────────────╮
│ A high level console interface.                                 │
│                                                                 │
│ ╭─────────────────────────────────────────────────────────────╮ │
│ │ <console width=67 ColorSystem.TRUECOLOR>                    │ │
│ ╰─────────────────────────────────────────────────────────────╯ │
│                                                                 │
│     color_system = 'truecolor'                                  │
│         encoding = 'utf-8'                                      │
│             file = <_io.TextIOWrapper name='<stdout>' mode='w'  │
│                    encoding='utf-8'>                            │
│           height = 41                                           │
│ is_dumb_terminal = False                                        │
│   is_interactive = True                                         │
│       is_jupyter = False                                        │
│      is_terminal = True                                         │
│   legacy_windows = False                                        │
│         no_color = False                                        │
│          options = ConsoleOptions(size=ConsoleDimensions(width… │
│                    height=41), legacy_windows=False,            │
│                    min_width=1, max_width=67, is_terminal=True, │
│                    encoding='utf-8', justify=None,              │
│                    overflow=None, no_wrap=False,                │
│                    highlight=None, height=None)                 │
│            quiet = False                                        │
│           record = False                                        │
│         safe_box = True                                         │
│             size = ConsoleDimensions(width=67, height=41)       │
│        soft_wrap = False                                        │
│           stderr = False                                        │
│            style = None                                         │
│         tab_size = 8                                            │
│            width = 67                                           │
╰─────────────────────────────────────────────────────────────────╯

platform="Windows"
WindowsConsoleFeatures(vt=True, truecolor=True)

Rich version 9.11.0

Did I help?

If I was able to resolve your problem, consider sponsoring my work on Rich, or buy me a coffee to say thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions