Multiline table functionality #93

Open
wants to merge 2 commits into
from

Conversation

2 participants
@cleverdripper

Adds functionality to handle markdown tables that have rows that span multiple lines of source.

This enables the source code to look considerably cleaner for table cells that have a lot of content. For example, instead of having

Column A  | Column B
----------|---------
row a     | Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
more a... | Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

You can do

Column A  | Column B
----------+----------
row a     | Lorem ipsum dolor sit amet, consectetur adipisicing elit,
          | sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
          | Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris
etc       | nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in
          | reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla
          | pariatur. Excepteur sint occaecat cupidatat non proident, sunt in
          | culpa qui officia deserunt mollit anim id est laborum.
----------+----------
more a... | Lorem ipsum dolor sit amet, consectetur adipisicing elit,
          | sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
          | Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris
etc       | nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in
          | reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla
          | pariatur. Excepteur sint occaecat cupidatat non proident, sunt in
          | culpa qui officia deserunt mollit anim id est laborum.

The only difference is that you use + in the underline for the column headers instead of a |, and when you want a new row you use ---+---. The two tables above will end up translated to the same HTML table.

This does not break existing Markdown features, and it stays consistent with Markdown's goal to be readable in plain-text form.

cleverdripper added some commits Jul 5, 2013

Fixed a dumb mistake in the multiline table reader.
Where it never stops reading.

Also made the regexes for determining row separators more tolerant.
@bhollis

This comment has been minimized.

Show comment Hide comment
@bhollis

bhollis Jul 8, 2013

Owner

Thanks @cleverdripper. If you don't mind, I'm going to park this pull request until I'm starting to pull together the 1.0 release, where I'll be considering new features and Markdown syntax extensions.

Owner

bhollis commented Jul 8, 2013

Thanks @cleverdripper. If you don't mind, I'm going to park this pull request until I'm starting to pull together the 1.0 release, where I'll be considering new features and Markdown syntax extensions.

@cleverdripper

This comment has been minimized.

Show comment Hide comment
@cleverdripper

cleverdripper Jul 8, 2013

@bhollis No problem, thanks for considering. Great work on maruku.

@bhollis No problem, thanks for considering. Great work on maruku.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment