diff --git a/app/assets/javascripts/pretty-text/engines/discourse-markdown/table.js.es6 b/app/assets/javascripts/pretty-text/engines/discourse-markdown/table.js.es6 index c3760799e0b..27620d20bc2 100644 --- a/app/assets/javascripts/pretty-text/engines/discourse-markdown/table.js.es6 +++ b/app/assets/javascripts/pretty-text/engines/discourse-markdown/table.js.es6 @@ -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 '
\n'; + }; + + md.renderer.rules.table_close = function(){ + return '
\n
'; + }; + }); // we need a custom callback for style handling helper.whiteList({ @@ -24,5 +33,6 @@ export function setup(helper) { 'tr', 'th', 'td', + 'div.md-table' ]); } diff --git a/app/assets/stylesheets/common/base/compose.scss b/app/assets/stylesheets/common/base/compose.scss index 4d14bff26d3..9cec8bcfe52 100644 --- a/app/assets/stylesheets/common/base/compose.scss +++ b/app/assets/stylesheets/common/base/compose.scss @@ -297,3 +297,7 @@ div.ac-wrap { color: lighten($primary, 40%); } } + +.md-table { + overflow-y: auto; +} diff --git a/spec/components/pretty_text_spec.rb b/spec/components/pretty_text_spec.rb index 1a60ffd741f..fef584a6178 100644 --- a/spec/components/pretty_text_spec.rb +++ b/spec/components/pretty_text_spec.rb @@ -965,6 +965,7 @@ HTML MD expected = <<~HTML +
@@ -981,6 +982,7 @@ HTML
+
HTML expect(PrettyText.cook(markdown)).to eq(expected.strip)