1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

[ruby/rdoc] Fixed CodeFence without blank lines

Currently a fenced code block needs a preceding blank line, it
should not be required, as:
https://github.github.com/gfm/#fenced-code-blocks
> A fenced code block may interrupt a paragraph, and does not
> require a blank line either before or after.

Just recommended:
https://docs.github.com/en/github/writing-on-github/creating-and-highlighting-code-blocks
> We recommend placing a blank line before and after code blocks
> to make the raw formatting easier to read.

0e1776caf3
This commit is contained in:
Nobuyoshi Nakada 2021-02-22 21:34:11 +09:00
parent 10b082064e
commit de8e6218a3
Notes: git 2021-03-16 15:47:53 +09:00
2 changed files with 113 additions and 372 deletions

View file

@ -143,7 +143,7 @@ a block quote
end
def test_parse_code_github
doc = parse <<-MD
doc = <<-MD
Example:
```
@ -156,11 +156,25 @@ code goes here
para("Example:"),
verb("code goes here\n"))
assert_equal expected, doc
assert_equal expected, parse(doc)
assert_equal expected, parse(doc.sub(/^\n/, ''))
@parser.github = false
expected =
doc(para("Example:"),
para("<code>\n""code goes here\n</code>"))
assert_equal expected, parse(doc)
expected =
doc(para("Example:\n<code>\n""code goes here\n</code>"))
assert_equal expected, parse(doc.sub(/^\n/, ''))
end
def test_parse_code_github_format
doc = parse <<-MD
doc = <<-MD
Example:
``` ruby
@ -176,7 +190,21 @@ code goes here
para("Example:"),
code)
assert_equal expected, doc
assert_equal expected, parse(doc)
assert_equal expected, parse(doc.sub(/^\n/, ''))
@parser.github = false
expected =
doc(para("Example:"),
para("<code>ruby\n""code goes here\n</code>"))
assert_equal expected, parse(doc)
expected =
doc(para("Example:\n<code>ruby\n""code goes here\n</code>"))
assert_equal expected, parse(doc.sub(/^\n/, ''))
end
def test_parse_definition_list