mdq 0.10.0

Select and render specific elements in a Markdown document
Documentation
[given]
md = '''
### Preamble A

Starts with H3.

## Preamble B

Starts with H2.

# Alpha

My first section.

## Sub-section

Hello, world.

# Bravo

My second section.
'''


[expect."select top-level section"]
cli_args = ["# alpha"]
output = '''
# Alpha

My first section.

## Sub-section

Hello, world.
'''


[expect."select subsection"]
cli_args = ["# sub"]
output = '''
## Sub-section

Hello, world.
'''


[expect."select all sections"]
# note: This selects all the doc's contents, but not as a single doc: each top-level header is its own selection, so the
# output separates them with a thematic break.
cli_args = ["#"]
output = '''
### Preamble A

Starts with H3.

   -----

## Preamble B

Starts with H2.

   -----

# Alpha

My first section.

## Sub-section

Hello, world.

   -----

# Bravo

My second section.
'''


[expect."chained"]
cli_args = ['# bravo | # bravo']
output = '''
# Bravo

My second section.
'''


[expect."section minimum level"]
cli_args = ['#{2,}']
output = '''
### Preamble A

Starts with H3.

   -----

## Preamble B

Starts with H2.

   -----

## Sub-section

Hello, world.
'''


[expect."section maximum level"]
cli_args = ['#{,2}']
output = '''
## Preamble B

Starts with H2.

   -----

# Alpha

My first section.

## Sub-section

Hello, world.

   -----

# Bravo

My second section.
'''


[expect."section exact level"]
cli_args = ['#{2}']
output = '''
## Preamble B

Starts with H2.

   -----

## Sub-section

Hello, world.
'''