### Scan Directory with Global Install
Source: https://github.com/jackdewinter/pymarkdown/blob/main/newdocs/src/user-guide.md
Scan all Markdown files in the 'examples' directory using a global Python installation.
```sh
pymarkdown scan examples
```
--------------------------------
### Get Global Help (Global Python Install)
Source: https://github.com/jackdewinter/pymarkdown/blob/main/newdocs/src/user-guide.md
Run this command to get general help for the PyMarkdown CLI when installed globally.
```sh
pymarkdown --help
```
--------------------------------
### Install PyMarkdown with uv
Source: https://github.com/jackdewinter/pymarkdown/blob/main/newdocs/src/quick-starts/advanced.md
Example of installing PyMarkdown as a development dependency using uv.
```sh
# uv
uv add --dev pymarkdownlnt
```
--------------------------------
### Get Command-Specific Help (Global Python Install)
Source: https://github.com/jackdewinter/pymarkdown/blob/main/newdocs/src/user-guide.md
Replace '{command}' with a specific subcommand to get detailed help for it when PyMarkdown is installed globally.
```sh
pymarkdown {command} --help
```
--------------------------------
### Get Help for the `fix` Command (Global Install)
Source: https://github.com/jackdewinter/pymarkdown/blob/main/newdocs/src/quick-starts/fixing.md
Prints help text for the command-line options and arguments available in fix mode when using a global Python installation.
```sh
pymarkdown fix --help
```
--------------------------------
### URL Autolinks Example
Source: https://github.com/jackdewinter/pymarkdown/blob/main/newdocs/src/extensions/extended-autolinks.md
Shows how plain URLs (starting with http:// or https://) are automatically converted into links. Includes examples with and without surrounding parentheses.
```Markdown
http://commonmark.org
(Visit https://encrypted.google.com/search?q=Markup+(business))
```
```HTML
http://commonmark.org
(Visit https://encrypted.google.com/search?q=Markup+(business))
```
--------------------------------
### Install PyMarkdown with Poetry
Source: https://github.com/jackdewinter/pymarkdown/blob/main/newdocs/src/quick-starts/advanced.md
Example of installing PyMarkdown as a development dependency using Poetry.
```sh
# Poetry
poetry add --dev pymarkdownlnt
```
--------------------------------
### Protocol Autolinks Example
Source: https://github.com/jackdewinter/pymarkdown/blob/main/newdocs/src/extensions/extended-autolinks.md
Demonstrates how text starting with recognized protocols like 'mailto:' or 'xmpp:' is converted into appropriate links.
```Markdown
mailto:foo@bar.baz
xmpp:foo@bar.baz/txt
```
```HTML
mailto:foo@bar.baz
xmpp:foo@bar.baz/txt
```
--------------------------------
### Run Scan with Configuration (Global Python Install)
Source: https://github.com/jackdewinter/pymarkdown/blob/main/newdocs/src/user-guide.md
Example of running the 'scan' command with a specific configuration file when PyMarkdown is installed globally.
```sh
pymarkdown --config my-config.json scan examples
```
--------------------------------
### YAML Configuration Example
Source: https://github.com/jackdewinter/pymarkdown/blob/main/newdocs/src/advanced_configuration.md
This YAML configuration provides the same settings as the JSON example, offering more flexibility and brevity.
```yaml
# Do not allow any files starting with `draft-`
system:
exclude_path: "draft-*.md"
extensions:
markdown-tables:
enabled: true
plugins:
MD013:
enabled: true
line_length: 100
```
--------------------------------
### Install PyMarkdown Globally
Source: https://github.com/jackdewinter/pymarkdown/blob/main/newdocs/src/quick-starts/advanced.md
Install the PyMarkdown linter globally using pip. This is the quickest way to get started if you don't need project-specific dependencies.
```sh
# Install globally
pip install pymarkdownlnt
```
--------------------------------
### Basic PyMarkdown Pre-Commit Hook Setup
Source: https://github.com/jackdewinter/pymarkdown/blob/main/newdocs/src/advanced_pre-commit.md
This is the basic setup for the PyMarkdown pre-commit hook. It serves as a starting point for more complex configurations.
```yaml
- repo: https://github.com/jackdewinter/pymarkdown
rev: main
hooks:
- id: pymarkdown
```
--------------------------------
### Install and Scan with PyMarkdown
Source: https://github.com/jackdewinter/pymarkdown/blob/main/README.md
Installs PyMarkdown globally and scans the current directory for linting issues. This is a quick start command for immediate use.
```sh
pip install pymarkdownlnt
pymarkdown scan .
```
--------------------------------
### PyMarkdown Plugins Info Example Output (MD001 with Configuration)
Source: https://github.com/jackdewinter/pymarkdown/blob/main/newdocs/src/user-guide.md
Example output for the 'pymarkdown plugins info' command when querying plugin 'MD001', including configuration item details.
```txt
ITEM DESCRIPTION
Id md001
Name(s) heading-increment,header-increment
Short Description Heading levels should only increment by one level at a time.
Description Url https://pymarkdown.readthedocs.io/en/latest/plugins/rule_md001.md
CONFIGURATION ITEM TYPE VALUE
front_matter_title string "title"
```
--------------------------------
### Example Command Line Translation
Source: https://github.com/jackdewinter/pymarkdown/blob/main/newdocs/src/advanced_pre-commit.md
This example illustrates how pre-commit manages environments. The 'pipenv run' prefix is a stand-in for pre-commit's internal execution of hooks within dedicated virtual environments.
```bash
pipenv run pymarkdown scan -r .
```
--------------------------------
### Set Log Level Example
Source: https://github.com/jackdewinter/pymarkdown/blob/main/newdocs/src/advanced_configuration.md
Example of using the --set command to configure the log level. This is a shortcut for the --log-level command-line argument.
```sh
--set 'log.level=INFO'
```
--------------------------------
### Set Strict Configuration Mode Example
Source: https://github.com/jackdewinter/pymarkdown/blob/main/newdocs/src/advanced_configuration.md
Example of using the --set command to enable strict configuration mode. It demonstrates the use of the '$!' prefix to specify a boolean value.
```sh
--set `mode.strict-config=$!True`
```
--------------------------------
### Example Directory Structure
Source: https://github.com/jackdewinter/pymarkdown/blob/main/newdocs/src/user-guide.md
This text block shows the assumed directory structure for PyMarkdown examples. It includes a base directory, an examples subdirectory with two markdown files, and a README.md file.
```text
base directory
|--- examples
|--- example-1.md
|--- example-2.md
|--- README.md
```
--------------------------------
### Enable Front-Matter and Tables Extensions (Global Install)
Source: https://github.com/jackdewinter/pymarkdown/blob/main/newdocs/src/quick-starts/extensions.md
Enable the 'markdown-tables' and 'front-matter' extensions when scanning a file using a global Python installation.
```sh
pymarkdown --enable-extensions markdown-tables,front-matter scan sample.md
```
--------------------------------
### Scan Specific Files with Global Install
Source: https://github.com/jackdewinter/pymarkdown/blob/main/newdocs/src/user-guide.md
Scan specific Markdown files using a global Python installation.
```sh
pymarkdown scan examples/example-1.md examples/example-2.md
```
--------------------------------
### Task List Items Example
Source: https://github.com/jackdewinter/pymarkdown/blob/main/newdocs/src/advanced_extensions.md
Illustrates how list items starting with '[ ]' or '[x]' are recognized as task list items when the 'task-list-items' extension is enabled. Non-matching items remain as normal list items.
```markdown
- [ ] something
- [x] something
- [a] something
```
--------------------------------
### Verify Pre-Commit Installation
Source: https://github.com/jackdewinter/pymarkdown/blob/main/newdocs/src/getting-started.md
Check if the pre-commit tool is installed and accessible in your project environment. This command should output the installed version number.
```bash
pipenv run pre-commit --version
```
--------------------------------
### Markdown with Consistent Unordered List Styles
Source: https://github.com/jackdewinter/pymarkdown/blob/main/newdocs/src/plugins/rule_md004.md
This example shows a correct scenario where all unordered list items use the same starting character. This adheres to the 'consistent' style configuration.
```Markdown
+ First Item
+ Second Item
+ Third Item
```
--------------------------------
### PyMarkdown Plugins Info Example Output (MD005)
Source: https://github.com/jackdewinter/pymarkdown/blob/main/newdocs/src/user-guide.md
Example output for the 'pymarkdown plugins info' command when querying plugin 'MD005', showing basic plugin details.
```txt
ITEM DESCRIPTION
Id md005
Name(s) list-indent
Short Description Inconsistent indentation for list items at the same level
Description Url https://pymarkdown.readthedocs.io/en/latest/plugins/rule_md005.md
```
--------------------------------
### Check PyMarkdown Version (Global Install)
Source: https://github.com/jackdewinter/pymarkdown/blob/main/newdocs/src/quick-starts/general.md
Run this command to display the installed PyMarkdown version when using a global Python installation. Useful for verifying your setup.
```sh
pymarkdown version
```
--------------------------------
### Expected PyMarkdown Scan Output
Source: https://github.com/jackdewinter/pymarkdown/blob/main/newdocs/src/quick-starts/installation.md
Compare your terminal output to this example to verify correct installation. Focus on Rule IDs, line numbers, and the number of reported problems.
```text
sample.md:1:1: MD022: Headings should be surrounded by blank lines. [Expected: 1; Actual: 0; Below] (blanks-around-headings,blanks-around-headers)
sample.md:2:1: MD022: Headings should be surrounded by blank lines. [Expected: 1; Actual: 0; Above] (blanks-around-headings,blanks-around-headers)
sample.md:2:1: MD025: Multiple top-level headings in the same document (single-title,single-h1)
```
--------------------------------
### PyMarkdown Pre-Commit Configuration Examples
Source: https://github.com/jackdewinter/pymarkdown/blob/main/newdocs/src/advanced_pre-commit.md
These examples show how to configure the PyMarkdown pre-commit hook to scan specific directories with custom configuration files.
```yaml
- id: pymarkdown
pass_filenames: false
args:
- --config
- clean.json
- scan
- .
- ./docs
```
```yaml
- id: pymarkdown
pass_filenames: false
args:
- --config
- newdocs/clean.json
- scan
- ./newdocs/src
```
--------------------------------
### TOML Configuration Example
Source: https://github.com/jackdewinter/pymarkdown/blob/main/newdocs/src/advanced_configuration.md
This TOML configuration is suitable if you already use pyproject.toml. It keeps all configurations in one file.
```toml
[tool.pymarkdown]
# Do not allow any files starting with `draft-`
system.exclude_path = "draft-*.md"
extensions.markdown-tables.enabled = true
plugins.MD013.enabled = true
plugins.MD013.line_length = 100
```
--------------------------------
### PyMarkdown Plugins List Example Output
Source: https://github.com/jackdewinter/pymarkdown/blob/main/newdocs/src/user-guide.md
Example output of the 'pymarkdown plugins list' command with a 'list_filter' applied, showing plugin properties.
```txt
ID NAMES ENABLED ENABLED VERSION FIX
(DEFAULT) (CURRENT)
md025 single-title, single-h1 True True 0.5.0 No
md047 single-trailing-newline True True 0.5.1 Yes
```
--------------------------------
### Example PyMarkdown Version Output
Source: https://github.com/jackdewinter/pymarkdown/blob/main/newdocs/src/quick-starts/general.md
This is an example of the output you can expect when running the PyMarkdown version command.
```text
0.9.36
```
--------------------------------
### General Package Manager Installation
Source: https://github.com/jackdewinter/pymarkdown/blob/main/newdocs/src/quick-starts/advanced.md
A general form for installing PyMarkdown with various package managers.
```sh
add/install [--dev] pymarkdownlnt
```
--------------------------------
### Markdown with Consistent Sublist Styles (Second Example)
Source: https://github.com/jackdewinter/pymarkdown/blob/main/newdocs/src/plugins/rule_md004.md
This example further illustrates the 'sublist' style, showing a new list that correctly follows the established nesting patterns.
```Markdown
+ New List
- With Sublist Items
* At each level
```
--------------------------------
### Markdown with Consistent Sublist Styles
Source: https://github.com/jackdewinter/pymarkdown/blob/main/newdocs/src/plugins/rule_md004.md
This example demonstrates correct usage of the 'sublist' style configuration. Each level of nesting uses a consistent starting character, even if different characters are used across levels.
```Markdown
+ First Level
- Second Level
* Third Level
```
--------------------------------
### Run PyMarkdown Scan (Global Install)
Source: https://github.com/jackdewinter/pymarkdown/blob/main/newdocs/src/quick-starts/installation.md
Execute this command from your project's base directory if PyMarkdown was installed globally.
```sh
pymarkdown scan sample.md
```
--------------------------------
### Fix Specific Markdown Files with Exclusions (Global Install)
Source: https://github.com/jackdewinter/pymarkdown/blob/main/newdocs/src/user-guide.md
Find all Markdown files that do not have the 'draft' prefix in any 'docs' directory, focusing only on files that will be committed to the Git repository and fix them if possible. This example uses a global Python install and respects gitignore.
```sh
pymarkdown fix --respect-gitignore --exclude draft_* --exclude draft-* **/docs
```
--------------------------------
### Shell Command Example
Source: https://github.com/jackdewinter/pymarkdown/blob/main/test/resources/performance/sample.md
Example of executing a shell command within a Markdown context, potentially for processing input with a script.
```shell
return shell_exec("echo $input | $markdown_script");
```
--------------------------------
### Scan a Directory (Global Install)
Source: https://github.com/jackdewinter/pymarkdown/blob/main/newdocs/src/quick-starts/advanced.md
Scan all Markdown files within a specified directory using the 'pymarkdown scan {directory}/' command with a global installation.
```sh
pymarkdown scan {directory}/
```
--------------------------------
### Markdown Example with Custom Configuration
Source: https://github.com/jackdewinter/pymarkdown/blob/main/newdocs/src/plugins/rule_md030.md
This example demonstrates a Markdown list structure that would not trigger the rule when 'ul_single' is configured to 2 and 'ul_multi' to 1, showcasing custom spacing rules for multi-line and single-line unordered list items.
```markdown
+ first item
+ second item
+ inner item
inner item
```
--------------------------------
### Get Command-Specific Help (Pipenv)
Source: https://github.com/jackdewinter/pymarkdown/blob/main/newdocs/src/user-guide.md
Replace '{command}' with a specific subcommand to get detailed help for it when using Pipenv.
```sh
pipenv run pymarkdown {command} --help
```
--------------------------------
### Scan Directory with Pipenv
Source: https://github.com/jackdewinter/pymarkdown/blob/main/newdocs/src/user-guide.md
Scan all Markdown files in the 'examples' directory using Pipenv.
```sh
pipenv run pymarkdown scan examples
```
--------------------------------
### Get Global Help (Pipenv)
Source: https://github.com/jackdewinter/pymarkdown/blob/main/newdocs/src/user-guide.md
Run this command to get general help for the PyMarkdown CLI when using Pipenv.
```sh
pipenv run pymarkdown --help
```
--------------------------------
### Example of Dig Command Output with Tabs
Source: https://github.com/jackdewinter/pymarkdown/blob/main/test/resources/rules/md010/good_simple_text_with_tabs_in_code_block.md
This example shows the output of a 'dig' command for MX records, which may contain tabs. Ensure such outputs are handled correctly to avoid Markdown linting errors.
```text
oisix.com. 300 IN MX 10 mail01.oisix.com.
oisix.com. 300 IN MX 100 mail02.oisix.com.
oisix.com. 300 IN MX 150 mx.idc.jp.
oisix.com. 300 IN MX 160 mx2.idc.jp.
oisix.com. 300 IN MX 250 mx3.idc.jp.
```
--------------------------------
### Enable Front-Matter and Markdown Tables Extensions (Global Install)
Source: https://github.com/jackdewinter/pymarkdown/blob/main/newdocs/src/user-guide.md
Command to enable specific PyMarkdown extensions for front-matter and markdown tables when using a global Python installation.
```sh
pymarkdown --enable-extensions front-matter,markdown-tables scan **/docs
```
--------------------------------
### Run Scan with Configuration (Pipenv)
Source: https://github.com/jackdewinter/pymarkdown/blob/main/newdocs/src/user-guide.md
Example of running the 'scan' command with a specific configuration file when using Pipenv.
```sh
pipenv run pymarkdown --config my-config.json scan examples
```
--------------------------------
### Basic Atx Heading Example
Source: https://github.com/jackdewinter/pymarkdown/blob/main/newdocs/src/user-guide.md
A simple Markdown heading that would typically trigger a linter failure due to extra spaces.
```markdown
# My Bad Atx Heading
```
--------------------------------
### Multi-Layer Rule Plugin Configuration Example
Source: https://github.com/jackdewinter/pymarkdown/blob/main/newdocs/src/advanced_plugins.md
Illustrates how rule plugin enablement decisions are made when configuration files and command-line options conflict, demonstrating precedence rules.
```json
{
"plugins": {
"MD011": {
"enabled": true,
},
"MD012": {
"enabled": true,
},
"MD013": {
"enabled": false
}
}
}
```
```bash
pipenv run pymarkdown --disable-rules MD011 \
--set 'plugins.MD011.enabled=$!True' \
--set 'plugins.MD012.enabled=$!False' \
--config config.json \
scan -r .
```
--------------------------------
### Scan Directories with Global Python Install
Source: https://github.com/jackdewinter/pymarkdown/blob/main/newdocs/src/quick-starts/fixing.md
Scan all 'docs' directories under the current directory using a global Python installation. This command helps identify potential rule violations before applying fixes.
```sh
pymarkdown scan **/docs
```
--------------------------------
### Create Sample Markdown File
Source: https://github.com/jackdewinter/pymarkdown/blob/main/newdocs/src/quick-starts/fixing.md
Create a sample Markdown file named 'sample.md' with two ATX headings. Ensure the file ends with a blank line for accurate scan results.
```Markdown
# Heading 1
# Another Heading 1
```
--------------------------------
### Check Python Version
Source: https://github.com/jackdewinter/pymarkdown/blob/main/newdocs/src/getting-started.md
Verify that your Python installation meets the minimum requirement of 3.10 or later.
```text
python --version
```
--------------------------------
### Install PyMarkdown as a Regular Dependency
Source: https://github.com/jackdewinter/pymarkdown/blob/main/newdocs/src/getting-started.md
Install PyMarkdown as a regular dependency, omitting the development flag, if it's not solely a development-time tool.
```bash
pipenv install pymarkdownlnt
```
--------------------------------
### Install PyMarkdown with Pipenv
Source: https://github.com/jackdewinter/pymarkdown/blob/main/newdocs/src/getting-started.md
Install the PyMarkdown linter as a development dependency for your project using Pipenv.
```bash
pipenv install -d pymarkdownlnt
```
--------------------------------
### Install Pipenv Globally
Source: https://github.com/jackdewinter/pymarkdown/blob/main/newdocs/src/getting-started.md
Install Pipenv globally using pip. This is recommended for managing project dependencies.
```bash
pip install --user pipenv
```
--------------------------------
### Apply Fixes to Files in Directories (Global Install)
Source: https://github.com/jackdewinter/pymarkdown/blob/main/newdocs/src/quick-starts/fixing.md
Applies available fixes to all Markdown files in directories named 'docs' under the current directory when using a global Python installation.
```sh
pymarkdown fix **/docs
```
--------------------------------
### Scan a Directory Recursively (Global Install)
Source: https://github.com/jackdewinter/pymarkdown/blob/main/newdocs/src/quick-starts/advanced.md
Scan a directory and all its subdirectories recursively using the 'pymarkdown scan --recurse {directory}/' command with a global installation.
```sh
pymarkdown scan --recurse {directory}/
```
--------------------------------
### Apply Fixes to a Single File (Global Install)
Source: https://github.com/jackdewinter/pymarkdown/blob/main/newdocs/src/quick-starts/fixing.md
Applies available fixes to a single Markdown file when using a global Python installation.
```sh
pymarkdown fix sample.md
```
--------------------------------
### Run PyMarkdown Scan on a Sample File
Source: https://github.com/jackdewinter/pymarkdown/blob/main/newdocs/src/quick-starts/advanced.md
Create a sample Markdown file and run PyMarkdown's scan command on it. This verifies the installation and demonstrates basic usage.
```sh
# Run once on a sample file
echo -e "# First Heading
# Another First Heading" > sample.md
pymarkdown scan sample.md
```
--------------------------------
### Global Python Install
Source: https://github.com/jackdewinter/pymarkdown/blob/main/newdocs/src/quick-starts/installation.md
Use this command to install PyMarkdown into your system Python using pip. This is the simplest method for most users.
```sh
pip install pymarkdownlnt
```
--------------------------------
### Front-Matter Block Example
Source: https://github.com/jackdewinter/pymarkdown/blob/main/newdocs/src/quick-starts/extensions.md
This is an example of a Front-Matter block written in YAML. It is typically placed at the top of a Markdown file to provide metadata.
```yaml
---
summary: Quick-Start documentation on how to use PyMarkdown Extensions.
authors:
- Jack De Winter
---
```
--------------------------------
### Correct Scenario: Readability with blank lines
Source: https://github.com/jackdewinter/pymarkdown/blob/main/newdocs/src/plugins/rule_md028.md
This example demonstrates how to maintain readability by using blank lines appropriately when a blockquote is followed by a paragraph and then another blockquote.
```markdown
> This is one section of a blockquote
This is its own paragraph.
> This is the other section.
```
--------------------------------
### Disable Rule Plugin MD022 (Global Python Install)
Source: https://github.com/jackdewinter/pymarkdown/blob/main/newdocs/src/quick-starts/rules.md
Use the `--disable-rule` argument followed by the rule ID to disable a specific rule plugin for all PyMarkdown commands. This example disables MD022 for a global Python installation.
```sh
pymarkdown --disable-rule MD022 scan sample.md
```
--------------------------------
### Markdown Link Example
Source: https://github.com/jackdewinter/pymarkdown/blob/main/newdocs/src/plugins/rule_md039.md
A standard Markdown link format.
```markdown
[a link](https://www.example.com)
```
--------------------------------
### Enable Extensions via Command Line
Source: https://github.com/jackdewinter/pymarkdown/blob/main/newdocs/src/advanced_configuration.md
Enable multiple extensions by providing a comma-separated list to the --enable-extensions argument.
```sh
--enable-extensions front-matter,markdown-tables
```
--------------------------------
### Ordered List Item Prefix: Correct Scenario (All start with 1)
Source: https://github.com/jackdewinter/pymarkdown/blob/main/newdocs/src/plugins/rule_md029.md
This scenario is considered correct when all ordered list items consistently start with the number 1.
```Markdown
1. First Line
1. Second Line
```
--------------------------------
### Get Help for the Scan Command
Source: https://github.com/jackdewinter/pymarkdown/blob/main/newdocs/src/quick-starts/general.md
This shows the help output for the `scan` command, detailing its arguments and options.
```sh
pymarkdown scan --help
```
--------------------------------
### Install Pre-Commit with Pipenv
Source: https://github.com/jackdewinter/pymarkdown/blob/main/newdocs/src/getting-started.md
Install the pre-commit tool as a development dependency for your project using pipenv. This is required to use PyMarkdown's pre-commit hook.
```bash
pipenv install -d pre-commit
```
--------------------------------
### Scan a Single File (Global Install)
Source: https://github.com/jackdewinter/pymarkdown/blob/main/newdocs/src/quick-starts/fixing.md
Scan the 'sample.md' file using the 'pymarkdown scan' command with a global Python installation. This command identifies rule failures like MD019 and MD025.
```sh
pymarkdown scan sample.md
```
--------------------------------
### Get PyMarkdown Version
Source: https://github.com/jackdewinter/pymarkdown/blob/main/newdocs/src/user-guide.md
Run the 'version' command to display the installed PyMarkdown build version. This is often used in troubleshooting or when reporting issues.
```txt
{major}.{minor}.{fix}
```
--------------------------------
### Correct Scenario: Setext with ATX for Higher Levels
Source: https://github.com/jackdewinter/pymarkdown/blob/main/newdocs/src/plugins/rule_md003.md
This example shows a valid document configuration using Setext for the first two levels and ATX for levels 3 and higher, when the 'setext_with_atx' style is specified.
```Markdown
Setext style H1
===============
Setext style H2
---------------
### ATX style H3
```
--------------------------------
### Scan Standard Input with Global Python Install
Source: https://github.com/jackdewinter/pymarkdown/blob/main/newdocs/src/user-guide.md
Use this command to pipe the output of another program directly into PyMarkdown for scanning when using a global Python installation.
```sh
my-program some-args | pymarkdown scan-stdin
```
--------------------------------
### Ordered List Item Prefix: Correct Scenario (Starts with 1, increasing by 1)
Source: https://github.com/jackdewinter/pymarkdown/blob/main/newdocs/src/plugins/rule_md029.md
This scenario is considered correct when the first ordered list item starts with 1 and subsequent items increase by one.
```Markdown
1. First Item
2. Second Item
3. Third Item
```
--------------------------------
### Markdown Headings Without Leading Whitespace (Correct Scenarios)
Source: https://github.com/jackdewinter/pymarkdown/blob/main/newdocs/src/plugins/rule_md023.md
These examples illustrate correctly formatted Markdown headings that start at the beginning of the line, satisfying the MD023 rule.
```markdown
# This is a bad heading
This is also a bad heading
==========================
```
--------------------------------
### Heading 2 Example
Source: https://github.com/jackdewinter/pymarkdown/blob/main/test/resources/rules/md022/setext_with_code_block_and_bad_line_spacing.md
Illustrates a Level 2 Setext-style heading. The underline must be composed of equals signs and span the entire width of the heading text.
```markdown
Heading 2
=========
```
--------------------------------
### PyMarkdown Scan Mode Output Example
Source: https://github.com/jackdewinter/pymarkdown/blob/main/newdocs/src/quick-starts/index.md
This example shows typical output from PyMarkdown's scan mode, highlighting multiple rule failures with file, line, column, rule ID, description, and specific details.
```text
sample.md:1:1: MD022: Headings should be surrounded by blank lines. [Expected: 1; Actual: 0; Below] (blanks-around-headings,blanks-around-headers)
sample.md:2:1: MD022: Headings should be surrounded by blank lines. [Expected: 1; Actual: 0; Above] (blanks-around-headings,blanks-around-headers)
sample.md:2:1: MD025: Multiple top-level headings in the same document (single-title,single-h1)
```
--------------------------------
### Heading 1 Example
Source: https://github.com/jackdewinter/pymarkdown/blob/main/test/resources/rules/md022/setext_with_code_block_and_bad_line_spacing.md
Illustrates a Level 1 Setext-style heading. The underline must be composed of hyphens and span the entire width of the heading text.
```markdown
Heading 1
---------
```
--------------------------------
### Markdown with Inconsistent Unordered List Styles
Source: https://github.com/jackdewinter/pymarkdown/blob/main/newdocs/src/plugins/rule_md004.md
This example demonstrates a failure scenario where different characters are used to start unordered list items. The rule will trigger because the styles are inconsistent.
```Markdown
+ First Item
- Second Item
* Third Item
```
--------------------------------
### Create Sample Markdown File
Source: https://github.com/jackdewinter/pymarkdown/blob/main/newdocs/src/quick-starts/advanced.md
Create a sample Markdown file named 'sample.md' with specific content for testing PyMarkdown scans.
```text
# First Heading
# Another First Heading
```
--------------------------------
### Get Information About a Specific Extension
Source: https://github.com/jackdewinter/pymarkdown/blob/main/newdocs/src/user-guide.md
Use the 'info' subcommand with an extension ID to retrieve detailed information. This is useful for understanding an extension's configuration and purpose.
```txt
ITEM DESCRIPTION
ID front-matter
Name Front-Matter Metadata
Short Description Allows metadata to be parsed from document Front-Matter.
Description Url https://pymarkdown.readthedocs.io/en/latest/extensions/front-matter/
```
--------------------------------
### Example Setext Heading with Code Block
Source: https://github.com/jackdewinter/pymarkdown/blob/main/test/resources/rules/md022/setext_with_code_block_and_bad_line_spacing.md
Demonstrates a Setext-style heading followed by a code block. Ensure there is a blank line between the heading underline and the code block for correct parsing.
```markdown
Code block
```
```
--------------------------------
### Example of Misaligned Lazy Continuation Line
Source: https://github.com/jackdewinter/pymarkdown/blob/main/newdocs/src/plugins/rule_pml102.md
Demonstrates a list item where the second line of the paragraph starts at the left margin instead of aligning with the list item's text, violating the rule.
```Markdown
1. A paragraph
with two lines.
```
--------------------------------
### Run PyMarkdown Scan in Other CI Systems
Source: https://github.com/jackdewinter/pymarkdown/blob/main/newdocs/src/getting-started.md
Scan the current directory recursively using PyMarkdown within a CI environment. This example assumes Python 3.10+, Pipenv, and necessary dependencies are installed.
```bash
pipenv run pymarkdown scan --recurse .
```
--------------------------------
### Example Markdown for Correct First Line Heading
Source: https://github.com/jackdewinter/pymarkdown/blob/main/newdocs/src/user-guide.md
This Markdown snippet shows a correct implementation for the MD041 rule, where the first line is a top-level heading.
```Markdown
# This is an example
```
--------------------------------
### JSON Configuration Example
Source: https://github.com/jackdewinter/pymarkdown/blob/main/newdocs/src/advanced_configuration.md
Use this JSON configuration for PyMarkdown. It supports inline comments via JSON5.
```json
{
// Do not allow any files starting with `draft-`
"system" : {
"exclude_path" : "draft-*.md"
},
"extensions": {
"markdown-tables": {
"enabled" : true
}
},
"plugins": {
"MD013": {
"enabled": true,
"line_length": 100
}
}
}
```
--------------------------------
### Markdown Table with Alignment
Source: https://github.com/jackdewinter/pymarkdown/blob/main/newdocs/src/advanced_extensions.md
Shows a more comprehensive Markdown table example with different text alignments. Ensure the 'markdown-tables' extension is enabled.
```markdown
| normal | right | left | center |
| --- | --: | :-- | :--: |
| baz | bim | bam | bom |
```
--------------------------------
### PyMarkdown Command-Line Help Output
Source: https://github.com/jackdewinter/pymarkdown/blob/main/newdocs/src/quick-starts/general.md
This is an example of the output you will see when running `pymarkdown --help`. It details the usage, positional arguments (main commands), and options (flags) available.
```text
usage: main.py [-h] [-e ENABLE_RULES] [-d DISABLE_RULES] [--enable-extensions ENABLE_EXTENSIONS] [--add-plugin ADD_PLUGIN]
[--config CONFIGURATION_FILE] [--set SET_CONFIGURATION] [--strict-config] [--no-json5] [--stack-trace]
[--continue-on-error] [--log-level {CRITICAL,ERROR,WARNING,INFO,DEBUG}] [--log-file LOG_FILE]
[--return-code-scheme {default,minimal,explicit}]
{extensions,fix,plugins,scan,scan-stdin,version} ...
Lint any found Markdown files.
positional arguments:
{extensions,fix,plugins,scan,scan-stdin,version}
extensions extension commands
fix fix the Markdown files in any specified paths
plugins plugin commands
scan scan the Markdown files in any specified paths
scan-stdin scan the standard input as a Markdown file
version version of the application
options:
-h, --help show this help message and exit
-e, --enable-rules ENABLE_RULES
comma separated list of rules to enable
-d, --disable-rules DISABLE_RULES
comma separated list of rules to disable
--enable-extensions ENABLE_EXTENSIONS
comma separated list of extensions to enable
--add-plugin ADD_PLUGIN
path to a plugin containing a new rule to apply
--config, -c CONFIGURATION_FILE
path to the configuration file to use
--set, -s SET_CONFIGURATION
manually set an individual configuration property
--strict-config throw an error if configuration is bad, instead of assuming default
--no-json5 use stdlib's json reader instead of new JSON5 json reader
--stack-trace if an error occurs, print out the stack trace for debug purposes
--continue-on-error if a tokenization or plugin error occurs, allow processing to continue
--log-level {CRITICAL,ERROR,WARNING,INFO,DEBUG}
minimum level required to log messages
--log-file LOG_FILE destination file for log messages
--return-code-scheme {default,minimal,explicit}
scheme to choose for selecting the application return code
```
--------------------------------
### Markdown Unordered List Indentation Triggered by Incorrect Indentation
Source: https://github.com/jackdewinter/pymarkdown/blob/main/newdocs/src/plugins/rule_md007.md
This example triggers the rule because the unordered list starts at column 5 instead of the expected column 4, even though it follows an ordered list.
```Markdown
1. ordered indent
* unordered indent
```
--------------------------------
### Markdown Table Syntax
Source: https://github.com/jackdewinter/pymarkdown/blob/main/newdocs/src/extensions/markdown-tables.md
This is an example of Markdown syntax for creating a simple table. It includes a header, a separator line, and a data row.
```markdown
| foo | bar |
| --- | --- |
| baz | bim |
```
--------------------------------
### Block Quote with Link Reference Definition and Trailing Text (Not LRD)
Source: https://github.com/jackdewinter/pymarkdown/blob/main/xxy.md
This example shows a block quote containing a line that starts like a link reference definition but has extra text after the title. This is not considered a valid LRD because of the trailing characters.
```python
source_markdown = "> \t[fred]:\t/url1\t"abc"def
[fred]"
```
```python
source_markdown = "> \t[fred]:\t/url1\t"abc"def
[fred]"
```
--------------------------------
### Markdown with Correct Heading Structure
Source: https://github.com/jackdewinter/pymarkdown/blob/main/newdocs/src/plugins/rule_md043.md
This example shows a correct heading structure that satisfies the rule's requirements.
```Markdown
# Level 1
## Level 2
```
--------------------------------
### Disable Rule Plugins by ID or Alias (Pipenv)
Source: https://github.com/jackdewinter/pymarkdown/blob/main/newdocs/src/user-guide.md
Similar to a global install, this example demonstrates disabling Rule Plugins using the '-d' or '--disable-rules' flag within a Pipenv environment. It shows disabling rules by their IDs (MD012, MD013) or their aliases ('no-multiple-blanks', 'line-length').
```sh
# disable by Rule Plugin id
pipenv run pymarkdown -d MD012,MD013 scan examples
# or, disable by Rule Plugin aliases:
pipenv run pymarkdown -d no-multiple-blanks,line-length scan examples
```
--------------------------------
### Extended Autolinks Example
Source: https://github.com/jackdewinter/pymarkdown/blob/main/newdocs/src/advanced_extensions.md
Shows how plain text resembling a URL is automatically converted into a clickable link when the 'markdown-extended-autolinks' extension is enabled.
```markdown
Visit www.commonmark.org/help for more information.
```
--------------------------------
### Correct Scenario: No blank line
Source: https://github.com/jackdewinter/pymarkdown/blob/main/newdocs/src/plugins/rule_md028.md
This example shows the correct way to avoid the rule by ensuring no blank line exists between blockquote sections.
```markdown
> This is one section of a blockquote
# Not A Blank Line
> This is the other section.
```
--------------------------------
### Correct Scenarios for Anchored List Indentation
Source: https://github.com/jackdewinter/pymarkdown/blob/main/newdocs/src/plugins/rule_pml101.md
Examples demonstrating the correct indentation for list items and sublists to comply with Rule PML101. The indentation amount can be configured using the 'indent' value.
```Markdown
* properly indented unordered list
* indented according to Md007
1. properly indented ordered list
1. indented according to Md007
> * properly indented list within a block quote
> * indented according to Md007
```
--------------------------------
### Ordered List Item Prefix: Nested Lists (Failure Cases)
Source: https://github.com/jackdewinter/pymarkdown/blob/main/newdocs/src/plugins/rule_md029.md
This example demonstrates failure cases in nested lists. The outer list starts with '2', the first inner list uses 'one' style, and the second inner list uses 'ordered' style incorrectly.
```Markdown
2. first
1. first-first
1. first-second
2. first-third
3. second
1. second-first
2. second-second
2. second-third
```
--------------------------------
### Markdown Image Link Example
Source: https://github.com/jackdewinter/pymarkdown/blob/main/newdocs/src/plugins/rule_md039.md
A Markdown image link format, which is also checked by this rule.
```markdown

```
--------------------------------
### Disable Rule Plugins by ID or Alias (Global Install)
Source: https://github.com/jackdewinter/pymarkdown/blob/main/newdocs/src/user-guide.md
Use the '-d' or '--disable-rules' flag followed by a comma-separated list of Rule Plugin IDs or aliases to disable specific rules when scanning. This example shows disabling rules MD012 and MD013, or their aliases 'no-multiple-blanks' and 'line-length'.
```sh
# disable by Rule Plugin id
pymarkdown -d MD012,MD013 scan examples
# or, disable by Rule Plugin aliases:
pymarkdown -d no-multiple-blanks,line-length scan examples
```
--------------------------------
### Block Quote with Text, Tabs, and Link Reference Definition (Not LRD)
Source: https://github.com/jackdewinter/pymarkdown/blob/main/xxy.md
This example demonstrates a scenario within a block quote where a line starting with tabs and a potential link reference definition is followed by a paragraph. It is not considered a valid LRD due to the preceding text and lack of proper block quote continuation.
```python
source_markdown = "> abc
[fred]: /url "bob\t"
[fred]"
```
--------------------------------
### Run PyMarkdown Scan (Pipenv)
Source: https://github.com/jackdewinter/pymarkdown/blob/main/newdocs/src/quick-starts/installation.md
Execute this command from your project's base directory if PyMarkdown was installed using Pipenv.
```sh
pipenv run pymarkdown scan sample.md
```
--------------------------------
### Pipenv Package Manager Install
Source: https://github.com/jackdewinter/pymarkdown/blob/main/newdocs/src/quick-starts/installation.md
Use this command to install PyMarkdown when managing your project with Pipenv. This installs the package into a Pipenv virtual environment.
```sh
pipenv install pymarkdownlnt
```
--------------------------------
### LRD Title Ending with Blank Line (No Start Char)
Source: https://github.com/jackdewinter/pymarkdown/blob/main/xxy.md
Shows that a title must end with the same starting character; a blank line interrupts this, even without an explicit starting character.
```python
source_markdown = """
[foo]: /url
'title
with blank line
[foo]"""
```
--------------------------------
### WWW Autolinks Example
Source: https://github.com/jackdewinter/pymarkdown/blob/main/newdocs/src/extensions/extended-autolinks.md
Demonstrates how 'www.' prefixed text is converted into clickable HTTP links when the extension is enabled. Handles various URL structures and parenthetical enclosures.
```Markdown
Visit www.commonmark.org/help for more information.
Or www.commonmark.org/help.
Or (www.google.com/search?q=Markup+(business)).
```
```HTML
Visit www.commonmark.org/help for more information.
Visit www.commonmark.org/help.
(www.google.com/search?q=Markup+(business))
```
--------------------------------
### Create Sample Markdown File
Source: https://github.com/jackdewinter/pymarkdown/blob/main/newdocs/src/getting-started.md
Create a sample Markdown file to test PyMarkdown's linting capabilities. This file intentionally includes violations of common rules.
```text
# First Heading
# Another First Heading
```
--------------------------------
### Verify PyMarkdown Installation
Source: https://github.com/jackdewinter/pymarkdown/blob/main/newdocs/src/getting-started.md
Confirm that PyMarkdown has been installed correctly for your project by checking its version.
```bash
pipenv run pymarkdown version
```
--------------------------------
### Get Help for the `fix` Command (Pipenv)
Source: https://github.com/jackdewinter/pymarkdown/blob/main/newdocs/src/quick-starts/fixing.md
Prints help text for the command-line options and arguments available in fix mode when using Pipenv.
```sh
pipenv run pymarkdown fix --help
```
--------------------------------
### Rule Failure Format Example
Source: https://github.com/jackdewinter/pymarkdown/blob/main/newdocs/src/user-guide.md
An example of the rule failure format output by PyMarkdown.
```text
examples\example-1.md:1:1: MD041: First line in file should be a top level heading (first-line-heading,first-line-h1)
```
--------------------------------
### List Available Extensions
Source: https://github.com/jackdewinter/pymarkdown/blob/main/newdocs/src/user-guide.md
Use the 'extensions list' command to view properties of all configured extensions. This helps verify your extension settings and troubleshoot issues.
```txt
ID NAME ENABLED ENABLED VERSION
(DEFAULT) (CURRENT)
front-matter Front Matter Metadata False False 0.5.0
linter-pragmas Pragma Linter Instructions True True 0.5.0
markdown-disallow-raw-html Markdown Disallow Raw HTML False False 0.5.0
markdown-extended-autolinks Markdown Extended Autolinks False False 0.5.0
markdown-strikethrough Markdown Strikethrough False False 0.5.0
markdown-tables Markdown Tables False False 0.1.0
markdown-task-list-items Markdown Task List Items False False 0.5.0
```
--------------------------------
### Add Rule Plugins via Command Line
Source: https://github.com/jackdewinter/pymarkdown/blob/main/newdocs/src/advanced_configuration.md
Use the --add-plugin argument to temporarily add rule plugins. Each argument should point to the plugin file.
```sh
--add-plugin /path/to/plugin1.py --add-plugin /path/to/plugin2.py
```
--------------------------------
### General Command Line Arguments Help
Source: https://github.com/jackdewinter/pymarkdown/blob/main/newdocs/src/user-guide.md
Displays the help message for all general command-line arguments available for PyMarkdown.
```text
options:
-h, --help show this help message and exit
-e, --enable-rules ENABLE_RULES
comma separated list of rules to enable
-d, --disable-rules DISABLE_RULES
comma separated list of rules to disable
--enable-extensions ENABLE_EXTENSIONS
comma separated list of extensions to enable
--add-plugin ADD_PLUGIN
path to a plugin containing a new rule to apply
--config, -c CONFIGURATION_FILE
path to the configuration file to use
--set, -s SET_CONFIGURATION
manually set an individual configuration property
--strict-config throw an error if configuration is bad, instead of assuming default
--no-json5 use stdlib's json reader instead of new JSON5 json reader
--stack-trace if an error occurs, print out the stack trace for debug purposes
--continue-on-error if a tokenization or plugin error occurs, allow processing to continue
--log-level {CRITICAL,ERROR,WARNING,INFO,DEBUG}
minimum level required to log messages
--log-file LOG_FILE destination file for log messages
--return-code-scheme {default,minimal}
scheme to choose for selecting the application return code
```
--------------------------------
### Check Pipenv Version
Source: https://github.com/jackdewinter/pymarkdown/blob/main/newdocs/src/getting-started.md
Verify that Pipenv is installed and check its current version. This command will fail if Pipenv is not installed or not in your PATH.
```bash
pipenv --version
```
--------------------------------
### LRD with URL but incomplete title start
Source: https://github.com/jackdewinter/pymarkdown/blob/main/xxy.md
Tests an LRD where the URL is present, but the title starts without proper termination.
```python
source_markdown = """
[foo]: /url ("""
```
--------------------------------
### Get Help for PyMarkdown Commands
Source: https://github.com/jackdewinter/pymarkdown/blob/main/newdocs/src/quick-starts/general.md
Use `pymarkdown --help` to list all available commands. For specific command options, run `pymarkdown --help`.
```sh
pymarkdown --help
```
```sh
pymarkdown scan --help
```
```sh
pymarkdown fix --help
```
--------------------------------
### Incomplete LRD with link text start
Source: https://github.com/jackdewinter/pymarkdown/blob/main/xxy.md
Tests a markdown string that starts with an opening bracket and the beginning of link text for an LRD.
```python
source_markdown = """
[foo"""
```
--------------------------------
### Markdown Table Example
Source: https://github.com/jackdewinter/pymarkdown/blob/main/newdocs/src/quick-starts/extensions.md
This is an example of a Markdown table. When the Tables Extension is enabled, PyMarkdown recognizes this structure for specific rule processing.
```markdown
| User | Best Score | Average Score |
| ------ | ---------- | ------------- |
| Fred | 200 | 185 |
| Barney | 250 | 182 |
```
--------------------------------
### Enable Extensions via Command Line
Source: https://github.com/jackdewinter/pymarkdown/blob/main/newdocs/src/advanced_extensions.md
Enables extensions like front-matter and markdown-tables. Extensions can be enabled but not configured without the --set argument.
```sh
# Extensions can be enabled, but without --set, cannot be configured.
--enable-extensions front-matter,markdown-tables
```
--------------------------------
### Pipenv Development-Only Install
Source: https://github.com/jackdewinter/pymarkdown/blob/main/newdocs/src/quick-starts/installation.md
Install PyMarkdown as a development-only dependency using Pipenv. This is recommended for tools used during development and testing, not for deployed applications.
```sh
pipenv install -d pymarkdownlnt
```
--------------------------------
### Set Command Format
Source: https://github.com/jackdewinter/pymarkdown/blob/main/newdocs/src/advanced_configuration.md
This is the general format for the --set command argument. It specifies a configuration item key and its value, with an optional format prefix for the value.
```text
=
```
--------------------------------
### Enable Extensions via YAML Configuration
Source: https://github.com/jackdewinter/pymarkdown/blob/main/newdocs/src/advanced_configuration.md
Enable extensions like 'front-matter' and 'markdown-tables' using a YAML configuration.
```yaml
extensions:
front-matter:
enabled: true
markdown-tables:
enabled: true
```
--------------------------------
### Disable Specific Rule Plugins (Global Install)
Source: https://github.com/jackdewinter/pymarkdown/blob/main/newdocs/src/user-guide.md
Disables Rule Plugins MD012 and MD013 for the 'scan' command when using a global Python installation.
```sh
pymarkdown --disable-rules MD012,MD013 scan examples
```
--------------------------------
### Configure Rule Plugin Enablement
Source: https://github.com/jackdewinter/pymarkdown/blob/main/newdocs/src/advanced_plugins.md
Shows how to enable a specific rule plugin ('line-length') using command line, JSON, YAML, and TOML configurations.
```sh
--set 'plugins.line-length.enabled=$!True'
```
```json
{
"plugins": {
"line-length": {
"enabled": true
}
}
}
```
```yaml
plugins:
line-length:
enabled: true
```
```toml
[tool.pymarkdown]
plugins.line-length.enabled = true
```
--------------------------------
### Run All Pre-Commit Hooks
Source: https://github.com/jackdewinter/pymarkdown/blob/main/newdocs/src/quick-starts/installation.md
Execute this command in your project's root directory to run all configured Pre-Commit hooks, including PyMarkdown, on every file in your repository. The first run may take longer as Pre-Commit downloads and installs necessary hooks.
```sh
pre-commit run --all
```
--------------------------------
### Add Rule Plugins via --set Argument
Source: https://github.com/jackdewinter/pymarkdown/blob/main/newdocs/src/advanced_configuration.md
Configure additional plugin paths using the --set argument with a comma-separated list.
```sh
--set 'plugins.additional_paths=/path/to/plugin1.py,/path/to/plugin2.py'
```
--------------------------------
### Enable Rule Plugin MD013 via Command Line
Source: https://github.com/jackdewinter/pymarkdown/blob/main/newdocs/src/advanced_configuration.md
Use the --enable-rules or -e argument to enable a specific rule plugin from the command line.
```sh
--enable-rules MD013
# OR
-e MD013
```
--------------------------------
### Show PyMarkdown Global Help
Source: https://github.com/jackdewinter/pymarkdown/blob/main/newdocs/src/quick-starts/general.md
Use the --help option with no other arguments to see a summary of available commands and options for PyMarkdown. This command can be run directly if PyMarkdown is installed globally.
```sh
pymarkdown --help
```
--------------------------------
### Enable Extensions via --set Argument
Source: https://github.com/jackdewinter/pymarkdown/blob/main/newdocs/src/advanced_configuration.md
Enable specific extensions like 'front-matter' and 'markdown-tables' using the --set argument.
```sh
--set 'extensions.front-matter.enabled=$!True' --set 'extensions.markdown-tables.enabled=$!True'
```
--------------------------------
### Enable Rule Plugin MD013 via --set Argument
Source: https://github.com/jackdewinter/pymarkdown/blob/main/newdocs/src/advanced_configuration.md
Configure a specific rule plugin to be enabled using the --set argument with the desired configuration path and value.
```sh
--set 'plugins.MD013.enabled=$!True'
```
--------------------------------
### Enable Debug Logging to a File
Source: https://github.com/jackdewinter/pymarkdown/blob/main/newdocs/src/user-guide.md
This command demonstrates how to set the log level to DEBUG and redirect all logging output to a file named 'app.log'. This is useful for capturing detailed diagnostic information without cluttering standard output.
```sh
pymarkdown --log-level DEBUG --log-file app.log scan examples
```
```sh
pipenv run pymarkdown --log-level DEBUG --log-file app.log scan examples
```
--------------------------------
### Add Rule Plugins via TOML Configuration
Source: https://github.com/jackdewinter/pymarkdown/blob/main/newdocs/src/advanced_configuration.md
Set additional plugin paths in a TOML configuration file. Supports both string and array formats for paths.
```toml
[tool.pymarkdown]
plugins.additional_paths = "/path/to/plugin1.py,/path/to/plugin2.py"
```
```toml
[tool.pymarkdown]
plugins.additional_paths = ["/path/to/plugin1.py","/path/to/plugin2.py"]
```
--------------------------------
### PyMarkdown Scan Output Example
Source: https://github.com/jackdewinter/pymarkdown/blob/main/newdocs/src/getting-started.md
Example of the output you should expect when PyMarkdown detects linting errors in a Markdown file. It details the file, line, column, rule ID, and message.
```text
sample.md:1:1: MD022: Headings should be surrounded by blank lines. [Expected: 1; Actual: 0; Below] (blanks-around-headings,blanks-around-headers)
sample.md:2:1: MD022: Headings should be surrounded by blank lines. [Expected: 1; Actual: 0; Above] (blanks-around-headings,blanks-around-headers)
sample.md:2:1: MD025: Multiple top-level headings in the same document (single-title,single-h1)
```
--------------------------------
### Collapsed Image with Newline Starting Label
Source: https://github.com/jackdewinter/pymarkdown/blob/main/scenario-cases.md
Illustrates a collapsed Markdown image where the label text starts with a newline. This tests parser behavior with leading newlines in labels for collapsed images.
```markdown
a![
bar][]a
```
```markdown
a![
bar][]
```
--------------------------------
### Markdown Line Length Failure Example
Source: https://github.com/jackdewinter/pymarkdown/blob/main/newdocs/src/plugins/rule_md013.md
This example demonstrates a line that exceeds the maximum character count, triggering the MD013 rule. Assumes a maximum line length of 50 characters.
```Markdown
This is a sample line that is a total of 60 characters long.
```
--------------------------------
### Table with Link Reference Definition
Source: https://github.com/jackdewinter/pymarkdown/blob/main/xxx.md
Demonstrates a markdown table followed by a link reference definition. Ensure the link reference definition is correctly placed after the table.
```python
source_markdown = """| abc | def |
| --- | --- |
| bar | [baz] |
[baz]: /url"""
```
--------------------------------
### Table with Ordered List (Blank Line)
Source: https://github.com/jackdewinter/pymarkdown/blob/main/xxx.md
Demonstrates a markdown table followed by an ordered list, separated by a blank line. This ensures the ordered list is recognized as a distinct element.
```python
source_markdown = """| abc | def |
| --- | --- |
| bar | baz |
1. bar"""
```
--------------------------------
### Example Markdown File 1 Content
Source: https://github.com/jackdewinter/pymarkdown/blob/main/newdocs/src/user-guide.md
This Markdown code block represents the content of 'example-1.md'. It contains a level 2 ATX heading and a simple text line.
```markdown
## This is an example
Just an example.
```
--------------------------------
### Ordered List Item Prefix: Failure Scenario (Starts with 2)
Source: https://github.com/jackdewinter/pymarkdown/blob/main/newdocs/src/plugins/rule_md029.md
This scenario triggers the rule when an ordered list item does not start with 0 or 1, and subsequent items are not in strictly increasing order.
```Markdown
2. second item
3. third item
```
--------------------------------
### Markdown Line Length Correct Example
Source: https://github.com/jackdewinter/pymarkdown/blob/main/newdocs/src/plugins/rule_md013.md
This example shows a line that meets the maximum character count, thus not triggering the MD013 rule. Assumes a maximum line length of 50 characters.
```Markdown
This is a sample line that is 50 characters long.
```
--------------------------------
### Full Image with Newline Starting Link Reference
Source: https://github.com/jackdewinter/pymarkdown/blob/main/scenario-cases.md
Illustrates a full Markdown image where the link reference ID starts with a newline. This tests parser behavior with leading newlines in reference IDs for images.
```markdown
a![foo][
bar]a
```
```markdown
a![
bar][]
```
--------------------------------
### Email Autolinks Example
Source: https://github.com/jackdewinter/pymarkdown/blob/main/newdocs/src/extensions/extended-autolinks.md
Illustrates how email addresses are recognized and converted into 'mailto:' links. Highlights valid and invalid email formats according to the extension's rules.
```Markdown
foo@bar.baz
hello@mail+xyz.example isn't valid, but hello+xyz@mail.example is.
```
```HTML
foo@bar.baz
hello@mail+xyz.example isn't valid, but hello+xyz@mail.example is.
```
--------------------------------
### Ordered List Item Prefix: Failure Scenario (Starts with 3)
Source: https://github.com/jackdewinter/pymarkdown/blob/main/newdocs/src/plugins/rule_md029.md
This scenario triggers the rule when an ordered list item starts with a number other than 0 or 1, and subsequent items are not in strictly increasing order.
```Markdown
3. first item
3. second item
```
--------------------------------
### Ordered List Item Prefix: Failure Scenario (Starts with 1, skips 2)
Source: https://github.com/jackdewinter/pymarkdown/blob/main/newdocs/src/plugins/rule_md029.md
This scenario triggers the rule when an ordered list item starts correctly but subsequent items are not in strictly increasing order.
```Markdown
1. first item
3. third item
```
--------------------------------
### Example Markdown File 2 Content
Source: https://github.com/jackdewinter/pymarkdown/blob/main/newdocs/src/user-guide.md
This Markdown code block represents the content of 'example-2.md'. It contains a level 1 ATX heading and a simple text line.
```markdown
# This is an example
Just an example.
```
--------------------------------
### Unordered List Indentation Example
Source: https://github.com/jackdewinter/pymarkdown/blob/main/newdocs/src/plugins/rule_md007.md
This example demonstrates a scenario where the original MarkdownLint rule MD007 would not trigger, but this rule correctly identifies inconsistent indentation in nested unordered lists within an ordered list.
```Markdown
1. ordered list
+ sublist
+ sublist
```
--------------------------------
### Scan Command Help Output
Source: https://github.com/jackdewinter/pymarkdown/blob/main/newdocs/src/quick-starts/general.md
The detailed help message for the `scan` command, including usage, positional arguments, and options.
```text
usage: main.py scan [-h] [-l] [-r] [-ae ALTERNATE_EXTENSIONS] [-e PATH_EXCLUSIONS] [--respect-gitignore] path [path ...]
positional arguments:
path one or more paths to examine for eligible Markdown files
options:
-h, --help show this help message and exit
-l, --list-files list any eligible Markdown files found on the specified paths and exit
-r, --recurse recursively traverse any found directories for matching files
-ae, --alternate-extensions ALTERNATE_EXTENSIONS
provide an alternate set of file extensions to match against
-e, --exclude PATH_EXCLUSIONS
one or more paths to exclude from the search. Can be a glob pattern.
--respect-gitignore respect any setting in the local .gitignore file.
```