File tree Expand file tree Collapse file tree 2 files changed +20
-6
lines changed Expand file tree Collapse file tree 2 files changed +20
-6
lines changed Original file line number Diff line number Diff line change @@ -88,8 +88,7 @@ export class HaMarkdown extends LitElement {
8888 }
8989 ol ,
9090 ul {
91- list-style-position : inside;
92- padding-inline-start : 0 ;
91+ padding-inline-start : 1rem ;
9392 }
9493 li {
9594 & : has (input [type = "checkbox" ]) {
@@ -140,16 +139,19 @@ export class HaMarkdown extends LitElement {
140139 margin : var (--ha-space-4 ) 0 ;
141140 }
142141 table {
143- border-collapse : collapse;
144- display : block;
145- overflow-x : auto;
142+ border-collapse : var (--markdown-table-border-collapse , collapse);
143+ }
144+ div : has (> table ) {
145+ overflow : auto;
146146 }
147147 th {
148148 text-align : start;
149149 }
150150 td ,
151151 th {
152- border : 1px solid var (--markdown-table-border-color , transparent);
152+ border-width : var (--markdown-table-border-width , 1px );
153+ border-style : var (--markdown-table-border-style , solid);
154+ border-color : var (--markdown-table-border-color , var (--divider-color ));
153155 padding : 0.25em 0.5em ;
154156 }
155157 blockquote {
Original file line number Diff line number Diff line change @@ -55,6 +55,18 @@ const renderMarkdown = async (
5555
5656 marked . setOptions ( markedOptions ) ;
5757
58+ marked . use ( {
59+ renderer : {
60+ table ( ...args ) {
61+ const defaultRenderer = new marked . Renderer ( ) ;
62+ // Wrap the table with block element because the property 'overflow'
63+ // cannot be applied to elements of display type 'table'.
64+ // https://www.w3.org/TR/css-overflow-3/#overflow-control
65+ return `<div>${ defaultRenderer . table . apply ( this , args ) } </div>` ;
66+ } ,
67+ } ,
68+ } ) ;
69+
5870 const tokens = marked . lexer ( content ) ;
5971 return tokens . map ( ( token ) =>
6072 filterXSS ( marked . parser ( [ token ] ) , {
You can’t perform that action at this time.
0 commit comments