Skip to content

Commit 512cc55

Browse files
committed
Add center align
1 parent 333952a commit 512cc55

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

lib/rdoc/markdown.kpeg

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1214,8 +1214,10 @@ TableLine = ( ( TableAlign:align1 TableAlign2*:aligns {[align1, *aligns] } ):lin
12141214
{ line }
12151215
TableAlign2 = "|" @Sp TableAlign
12161216
TableAlign = < /:?-+:?/ > @Sp
1217-
{ text.start_with?(":") ? :left :
1218-
text.end_with?(":") ? :right : nil
1217+
{
1218+
text.start_with?(":") ?
1219+
(text.end_with?(":") ? :center : :left) :
1220+
(text.end_with?(":") ? :right : nil)
12191221
}
12201222

12211223
DefinitionList = &{ definition_lists? }

test/rdoc/test_rdoc_markdown.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1065,14 +1065,14 @@ def test_gfm_table
10651065
def test_gfm_table_2
10661066
doc = parse <<~'MD'
10671067
| Cmd | Returns | Meaning
1068-
----- | ------- | -------
1068+
----- | :-----: | -------
10691069
|"b" | boolean | True if file1 is a block device
10701070
"c" | boolean | True if file1 is a character device
10711071
|"\|" | boolean | escaped bar \| test
10721072
MD
10731073

10741074
head = %w[Cmd Returns Meaning]
1075-
align = [nil, nil, nil]
1075+
align = [nil, :center, nil]
10761076
body = [
10771077
['"b"', 'boolean', 'True if file1 is a block device'],
10781078
['"c"', 'boolean', 'True if file1 is a character device'],

0 commit comments

Comments
 (0)