Skip to main content

Module blank

Module blank 

Source
Expand description

The blank check: hygiene blank PATH... fails when a Markdown file has two blank lines in a row.

§Design

One blank line ends a paragraph. A second blank line adds nothing, and a diff that adds it is noise. So no Markdown file of the book has two blank lines in a row (01M51K1VMWTNZGD6PT1BYDGWM3). just wrap runs hygiene blank docs/src: each .md file in the folder and its subfolders.

The rule blank finds each blank line after a blank line. It skips a code block: the text of a block is an example, as it is. A line with only spaces is blank.

let errors = hygiene::blank::check("a.md", "# A\n\n\nText.\n");
assert_eq!(errors.len(), 1);
assert_eq!(errors[0].rule, "blank");
assert_eq!(errors[0].text, "a.md:3: a second blank line. Remove it.");

let block = "# A\n\n```text\none\n\n\ntwo\n```\n";
assert!(hygiene::blank::check("a.md", block).is_empty());

Functions§

check
The errors of the Markdown file name with the content text: one for each line of second_blank_lines.
second_blank_lines
The number of each blank line of text that follows a blank line, outside a code block. Each number counts from 1.