@@ -58,7 +58,7 @@ let Markdown = {
5858
5959// 将html字符串解析成jQuery对象
6060function parseHtml ( html_str : string ) {
61- let nodes = $ . parseHTML ( html_str , null , true ) ;
61+ let nodes = $ . parseHTML ( html_str . trim ( ) , null , true ) ;
6262 let elem ;
6363 if ( nodes . length != 1 )
6464 elem = $ ( document . createElement ( 'div' ) ) . append ( nodes ) ;
@@ -172,8 +172,7 @@ let Table = {
172172
173173 let header : itemType [ ] , data : itemType [ ] [ ] ;
174174 [ header , ...data ] = table_data ;
175- let html = render_tpl ( table_tpl , { header : header , tdata : data } ) ;
176- return $ ( html ) ;
175+ return render_tpl ( table_tpl , { header : header , tdata : data } ) ;
177176 }
178177} ;
179178
@@ -242,15 +241,15 @@ const SCOPE_TPL = `<div>
242241</div>` ;
243242let ScopeWidget = {
244243 handle_type : 'scope' ,
245- get_element : function ( spec : { dom_id :string , contents : any [ ] } ) {
244+ get_element : function ( spec : { dom_id : string , contents : any [ ] } ) {
246245 let elem = render_tpl ( SCOPE_TPL , spec ) ;
247246 // need to check the duplicate id after current output widget shown.
248247 // because the current widget may have multiple sub-widget which have same dom id.
249- AfterCurrentOutputWidgetShow ( ( ) => {
250- if ( $ ( `#${ spec . dom_id } ` ) . length !== 0 ) {
248+ AfterCurrentOutputWidgetShow ( ( ) => {
249+ if ( $ ( `#${ spec . dom_id } ` ) . length !== 0 ) {
251250 let tip = `<p style="color: grey; border:1px solid #ced4da; padding: .375rem .75rem;">${ t ( "duplicated_scope_name" ) } </p>` ;
252251 elem . empty ( ) . html ( tip ) ;
253- } else {
252+ } else {
254253 elem . attr ( 'id' , spec . dom_id ) ;
255254 }
256255 } )
0 commit comments