Add table markup to Phabricator

Summary: See D2902.

Test Plan: Made tables, generated docs.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

Differential Revision: https://secure.phabricator.com/D2903
This commit is contained in:
epriestley
2012-07-02 14:44:38 -07:00
parent 534c0aa326
commit a33e84e1e5
4 changed files with 103 additions and 26 deletions

View File

@@ -2283,7 +2283,7 @@ celerity_register_resource_map(array(
), ),
'phabricator-remarkup-css' => 'phabricator-remarkup-css' =>
array( array(
'uri' => '/res/f6d48479/rsrc/css/core/remarkup.css', 'uri' => '/res/3b93a50d/rsrc/css/core/remarkup.css',
'type' => 'css', 'type' => 'css',
'requires' => 'requires' =>
array( array(
@@ -2577,7 +2577,7 @@ celerity_register_resource_map(array(
), array( ), array(
'packages' => 'packages' =>
array( array(
'e6711f13' => '3cdc275f' =>
array( array(
'name' => 'core.pkg.css', 'name' => 'core.pkg.css',
'symbols' => 'symbols' =>
@@ -2606,7 +2606,7 @@ celerity_register_resource_map(array(
21 => 'phabricator-flag-css', 21 => 'phabricator-flag-css',
22 => 'aphront-error-view-css', 22 => 'aphront-error-view-css',
), ),
'uri' => '/res/pkg/e6711f13/core.pkg.css', 'uri' => '/res/pkg/3cdc275f/core.pkg.css',
'type' => 'css', 'type' => 'css',
), ),
'f363b322' => 'f363b322' =>
@@ -2773,20 +2773,20 @@ celerity_register_resource_map(array(
'reverse' => 'reverse' =>
array( array(
'aphront-attached-file-view-css' => '7839ae2d', 'aphront-attached-file-view-css' => '7839ae2d',
'aphront-crumbs-view-css' => 'e6711f13', 'aphront-crumbs-view-css' => '3cdc275f',
'aphront-dialog-view-css' => 'e6711f13', 'aphront-dialog-view-css' => '3cdc275f',
'aphront-error-view-css' => 'e6711f13', 'aphront-error-view-css' => '3cdc275f',
'aphront-form-view-css' => 'e6711f13', 'aphront-form-view-css' => '3cdc275f',
'aphront-headsup-action-list-view-css' => '96bc37d6', 'aphront-headsup-action-list-view-css' => '96bc37d6',
'aphront-headsup-view-css' => 'e6711f13', 'aphront-headsup-view-css' => '3cdc275f',
'aphront-list-filter-view-css' => 'e6711f13', 'aphront-list-filter-view-css' => '3cdc275f',
'aphront-pager-view-css' => 'e6711f13', 'aphront-pager-view-css' => '3cdc275f',
'aphront-panel-view-css' => 'e6711f13', 'aphront-panel-view-css' => '3cdc275f',
'aphront-side-nav-view-css' => 'e6711f13', 'aphront-side-nav-view-css' => '3cdc275f',
'aphront-table-view-css' => 'e6711f13', 'aphront-table-view-css' => '3cdc275f',
'aphront-tokenizer-control-css' => 'e6711f13', 'aphront-tokenizer-control-css' => '3cdc275f',
'aphront-tooltip-css' => 'e6711f13', 'aphront-tooltip-css' => '3cdc275f',
'aphront-typeahead-control-css' => 'e6711f13', 'aphront-typeahead-control-css' => '3cdc275f',
'differential-changeset-view-css' => '96bc37d6', 'differential-changeset-view-css' => '96bc37d6',
'differential-core-view-css' => '96bc37d6', 'differential-core-view-css' => '96bc37d6',
'differential-inline-comment-editor' => 'f4bbbd84', 'differential-inline-comment-editor' => 'f4bbbd84',
@@ -2852,15 +2852,15 @@ celerity_register_resource_map(array(
'javelin-workflow' => 'f363b322', 'javelin-workflow' => 'f363b322',
'maniphest-task-summary-css' => '7839ae2d', 'maniphest-task-summary-css' => '7839ae2d',
'maniphest-transaction-detail-css' => '7839ae2d', 'maniphest-transaction-detail-css' => '7839ae2d',
'phabricator-app-buttons-css' => 'e6711f13', 'phabricator-app-buttons-css' => '3cdc275f',
'phabricator-content-source-view-css' => '96bc37d6', 'phabricator-content-source-view-css' => '96bc37d6',
'phabricator-core-buttons-css' => 'e6711f13', 'phabricator-core-buttons-css' => '3cdc275f',
'phabricator-core-css' => 'e6711f13', 'phabricator-core-css' => '3cdc275f',
'phabricator-directory-css' => 'e6711f13', 'phabricator-directory-css' => '3cdc275f',
'phabricator-drag-and-drop-file-upload' => 'f4bbbd84', 'phabricator-drag-and-drop-file-upload' => 'f4bbbd84',
'phabricator-dropdown-menu' => 'f363b322', 'phabricator-dropdown-menu' => 'f363b322',
'phabricator-flag-css' => 'e6711f13', 'phabricator-flag-css' => '3cdc275f',
'phabricator-jump-nav' => 'e6711f13', 'phabricator-jump-nav' => '3cdc275f',
'phabricator-keyboard-shortcut' => 'f363b322', 'phabricator-keyboard-shortcut' => 'f363b322',
'phabricator-keyboard-shortcut-manager' => 'f363b322', 'phabricator-keyboard-shortcut-manager' => 'f363b322',
'phabricator-menu-item' => 'f363b322', 'phabricator-menu-item' => 'f363b322',
@@ -2868,11 +2868,11 @@ celerity_register_resource_map(array(
'phabricator-paste-file-upload' => 'f363b322', 'phabricator-paste-file-upload' => 'f363b322',
'phabricator-prefab' => 'f363b322', 'phabricator-prefab' => 'f363b322',
'phabricator-project-tag-css' => '7839ae2d', 'phabricator-project-tag-css' => '7839ae2d',
'phabricator-remarkup-css' => 'e6711f13', 'phabricator-remarkup-css' => '3cdc275f',
'phabricator-shaped-request' => 'f4bbbd84', 'phabricator-shaped-request' => 'f4bbbd84',
'phabricator-standard-page-view' => 'e6711f13', 'phabricator-standard-page-view' => '3cdc275f',
'phabricator-tooltip' => 'f363b322', 'phabricator-tooltip' => 'f363b322',
'phabricator-transaction-view-css' => 'e6711f13', 'phabricator-transaction-view-css' => '3cdc275f',
'syntax-highlighting-css' => 'e6711f13', 'syntax-highlighting-css' => '3cdc275f',
), ),
)); ));

View File

@@ -38,6 +38,7 @@ empty lines:
Use "- " or "* " for bulleted lists, and "# " for numbered lists. Use "- " or "* " for bulleted lists, and "# " for numbered lists.
Use ``` or indent two spaces for code. Use ``` or indent two spaces for code.
Use %%% for a literal block. Use %%% for a literal block.
Use <table>...</table> for tables.
= Basic Styling = = Basic Styling =
@@ -355,3 +356,60 @@ To place text in a literal block use "%%%":
Remarkup will not process the text inside of literal blocks (other than to Remarkup will not process the text inside of literal blocks (other than to
escape HTML and preserve line breaks). escape HTML and preserve line breaks).
= Tables =
Remarkup supports a simplified HTML table syntax. For example, this:
<table>
<tr>
<th>Fruit</th>
<th>Color</th>
<th>Price</th>
<th>Peel?</th>
</tr>
<tr>
<td>Apple</td>
<td>red</td>
<td>`$0.93`</td>
<td>no</td>
</tr>
<tr>
<td>Banana</td>
<td>yellow</td>
<td>`$0.19`</td>
<td>**YES**</td>
</tr>
</table>
...produces this:
<table>
<tr>
<th>Fruit</th>
<th>Color</th>
<th>Price</th>
<th>Peel?</th>
</tr>
<tr>
<td>Apple</td>
<td>red</td>
<td>`$0.93`</td>
<td>no</td>
</tr>
<tr>
<td>Banana</td>
<td>yellow</td>
<td>`$0.19`</td>
<td>**YES**</td>
</tr>
</table>
Some general notes about this syntax:
- your tags must all be properly balanced;
- your tags must NOT include attributes (`<td>` is OK, `<td style="...">` is
not);
- you can use other Remarkup rules (like **bold**, //italics//, etc.) inside
table cells.

View File

@@ -171,6 +171,7 @@ class PhabricatorMarkupEngine {
$blocks[] = new PhutilRemarkupEngineRemarkupListBlockRule(); $blocks[] = new PhutilRemarkupEngineRemarkupListBlockRule();
$blocks[] = new PhutilRemarkupEngineRemarkupCodeBlockRule(); $blocks[] = new PhutilRemarkupEngineRemarkupCodeBlockRule();
$blocks[] = new PhutilRemarkupEngineRemarkupNoteBlockRule(); $blocks[] = new PhutilRemarkupEngineRemarkupNoteBlockRule();
$blocks[] = new PhutilRemarkupEngineRemarkupTableBlockRule();
$blocks[] = new PhutilRemarkupEngineRemarkupDefaultBlockRule(); $blocks[] = new PhutilRemarkupEngineRemarkupDefaultBlockRule();
$custom_block_rule_classes = $options['custom-block']; $custom_block_rule_classes = $options['custom-block'];

View File

@@ -228,3 +228,21 @@ img.phabricator-remarkup-embed-image {
-moz-box-shadow: 1px 1px 6px rgba(0,0,0,.5); -moz-box-shadow: 1px 1px 6px rgba(0,0,0,.5);
-webkit-box-shadow: 1px 1px 6px rgba(0,0,0,.5); -webkit-box-shadow: 1px 1px 6px rgba(0,0,0,.5);
} }
.phabricator-remarkup table.remarkup-table {
border-collapse: separate;
border-spacing: 1px;
background: #d3d3d3;
margin: 1em;
}
.phabricator-remarkup table.remarkup-table th {
font-weight: bold;
padding: 3px 6px;
background: #e3e3e3;
}
.phabricator-remarkup table.remarkup-table td {
background: #ffffff;
padding: 3px 6px;
}