Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generators/Markdown: add blank line after title #722

Merged
merged 1 commit into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Generators/Markdown.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ protected function printFooter()
protected function processSniff(DOMNode $doc)
{
$title = $this->getTitle($doc);
echo PHP_EOL."## $title".PHP_EOL;
echo PHP_EOL."## $title".PHP_EOL.PHP_EOL;

foreach ($doc->childNodes as $node) {
if ($node->nodeName === 'standard') {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# GeneratorTest Coding Standard

## Code Comparison, blank lines

This is a standard block.
<table>
<tr>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# GeneratorTest Coding Standard

## Code Comparison, block length

This is a standard block.
<table>
<tr>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# GeneratorTest Coding Standard

## Code Comparison, char encoding

This is a standard block.
<table>
<tr>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# GeneratorTest Coding Standard

## Code Comparison, line length

Ensure there is no PHP &quot;Warning: str_repeat(): Second argument has to be greater than or equal to 0&quot;.
Ref: squizlabs/PHP_CodeSniffer#2522
<table>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# GeneratorTest Coding Standard

## Code Title, line wrapping

This is a standard block.
<table>
<tr>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# GeneratorTest Coding Standard

## Code Title, whitespace handling

This is a standard block.
<table>
<tr>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# GeneratorTest Coding Standard

## lowercase title

This is a standard block.

Documentation generated on *REDACTED* by [PHP_CodeSniffer *VERSION*](https://github.com/PHPCSStandards/PHP_CodeSniffer)
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# GeneratorTest Coding Standard

## This is a very very very very very very very very very very very long title

This is a standard block.

Documentation generated on *REDACTED* by [PHP_CodeSniffer *VERSION*](https://github.com/PHPCSStandards/PHP_CodeSniffer)
1 change: 1 addition & 0 deletions tests/Core/Generators/Expectations/ExpectedOutputOneDoc.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# GeneratorTest Coding Standard

## One Standard Block, No Code

Documentation contains one standard block and no code comparison.

Documentation generated on *REDACTED* by [PHP_CodeSniffer *VERSION*](https://github.com/PHPCSStandards/PHP_CodeSniffer)
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# GeneratorTest Coding Standard

## Standard Element, blank line handling

There is a blank line at the start of this standard.

And the above blank line is also deliberate to test part of the logic.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# GeneratorTest Coding Standard

## Standard Element, handling of HTML tags

The use of *tags* in standard descriptions is allowed and their handling should be *safeguarded*.
Other tags, like &lt;a href=&quot;example.com&quot;&gt;link&lt;/a&gt;, &lt;b&gt;bold&lt;/bold&gt;, &lt;script&gt;&lt;/script&gt; are not allowed and will be encoded for display when the HTML or Markdown report is used.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# GeneratorTest Coding Standard

## Standard Element, indentation should be ignored

This line has no indentation.
This line has 4 spaces indentation.
This line has 8 spaces indentation.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# GeneratorTest Coding Standard

## Standard Element, line wrapping handling

This line has to be exactly 99 chars to test part of the logic.------------------------------------
And this line has to be exactly 100 chars.----------------------------------------------------------
And here we have a line which should start wrapping as it is longer than 100 chars. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean pellentesque iaculis enim quis hendrerit. Morbi ultrices in odio pharetra commodo.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

## No Content


## Code Comparison Only, Missing Standard Block

<table>
<tr>
<th>Valid: Lorem ipsum dolor sit amet.</th>
Expand All @@ -23,6 +25,7 @@
</table>

## One Standard Block, Code Comparison

Documentation contains one standard block and one code comparison.
<table>
<tr>
Expand All @@ -44,9 +47,11 @@ Documentation contains one standard block and one code comparison.
</table>

## One Standard Block, No Code

Documentation contains one standard block and no code comparison.

## One Standard Block, Two Code Comparisons

Documentation contains one standard block and two code comparisons.
<table>
<tr>
Expand Down Expand Up @@ -86,10 +91,12 @@ Documentation contains one standard block and two code comparisons.
</table>

## Two Standard Blocks, No Code

This is standard block one.
This is standard block two.

## Two Standard Blocks, One Code Comparison

This is standard block one.
<table>
<tr>
Expand All @@ -112,6 +119,7 @@ This is standard block one.
This is standard block two.

## Two Standard Blocks, Three Code Comparisons

This is standard block one.
<table>
<tr>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@

## Code element at wrong level


Documentation generated on *REDACTED* by [PHP_CodeSniffer *VERSION*](https://github.com/PHPCSStandards/PHP_CodeSniffer)
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# GeneratorTest Coding Standard

## One element correct, one element wrong level

This is a standard block at the correct level.

Documentation generated on *REDACTED* by [PHP_CodeSniffer *VERSION*](https://github.com/PHPCSStandards/PHP_CodeSniffer)
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# GeneratorTest Coding Standard

## Superfluous code element

This is a standard block.
<table>
<tr>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@

## Unknown element


Documentation generated on *REDACTED* by [PHP_CodeSniffer *VERSION*](https://github.com/PHPCSStandards/PHP_CodeSniffer)