Skip to content

Commit

Permalink
Add center align
Browse files Browse the repository at this point in the history
  • Loading branch information
nobu committed Oct 6, 2022
1 parent 333952a commit 512cc55
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 4 additions & 2 deletions lib/rdoc/markdown.kpeg
Expand Up @@ -1214,8 +1214,10 @@ TableLine = ( ( TableAlign:align1 TableAlign2*:aligns {[align1, *aligns] } ):lin
{ line }
TableAlign2 = "|" @Sp TableAlign
TableAlign = < /:?-+:?/ > @Sp
{ text.start_with?(":") ? :left :
text.end_with?(":") ? :right : nil
{
text.start_with?(":") ?
(text.end_with?(":") ? :center : :left) :
(text.end_with?(":") ? :right : nil)
}

DefinitionList = &{ definition_lists? }
Expand Down
4 changes: 2 additions & 2 deletions test/rdoc/test_rdoc_markdown.rb
Expand Up @@ -1065,14 +1065,14 @@ def test_gfm_table
def test_gfm_table_2
doc = parse <<~'MD'
| Cmd | Returns | Meaning
----- | ------- | -------
----- | :-----: | -------
|"b" | boolean | True if file1 is a block device
"c" | boolean | True if file1 is a character device
|"\|" | boolean | escaped bar \| test
MD

head = %w[Cmd Returns Meaning]
align = [nil, nil, nil]
align = [nil, :center, nil]
body = [
['"b"', 'boolean', 'True if file1 is a block device'],
['"c"', 'boolean', 'True if file1 is a character device'],
Expand Down

0 comments on commit 512cc55

Please sign in to comment.