FEATURE: add overflow-y auto to Markdown tables

This commit is contained in:
Sam 2017-11-13 17:52:15 +11:00
parent cb14da4d90
commit 8a66446849
3 changed files with 18 additions and 2 deletions

View File

@ -1,6 +1,15 @@
export function setup(helper) {
// this is built in now
// TODO: sanitizer needs fixing, does not properly support this yet
helper.registerPlugin(md => {
md.renderer.rules.table_open = function(){
return '<div class="md-table">\n<table>';
};
md.renderer.rules.table_close = function(){
return '</table>\n</div>';
};
});
// we need a custom callback for style handling
helper.whiteList({
@ -24,5 +33,6 @@ export function setup(helper) {
'tr',
'th',
'td',
'div.md-table'
]);
}

View File

@ -297,3 +297,7 @@ div.ac-wrap {
color: lighten($primary, 40%);
}
}
.md-table {
overflow-y: auto;
}

View File

@ -965,6 +965,7 @@ HTML
MD
expected = <<~HTML
<div class="md-table">
<table>
<thead>
<tr>
@ -981,6 +982,7 @@ HTML
</tr>
</tbody>
</table>
</div>
HTML
expect(PrettyText.cook(markdown)).to eq(expected.strip)