@@ -33,7 +33,7 @@ export function renderMarkedString(markedString: MarkedString, options: RenderOp
3333 */
3434export function renderHtml ( content : RenderableContent , options : RenderOptions = { } ) : Node {
3535 if ( typeof content === 'string' ) {
36- return _renderHtml ( { isText : true , text : content } , options ) ;
36+ return document . createTextNode ( content ) ;
3737 } else if ( Array . isArray ( content ) ) {
3838 return _renderHtml ( { children : content } , options ) ;
3939 } else if ( content ) {
@@ -46,11 +46,7 @@ function _renderHtml(content: IHTMLContentElement, options: RenderOptions = {}):
4646
4747 let { codeBlockRenderer, actionCallback } = options ;
4848
49- if ( content . isText ) {
50- return document . createTextNode ( content . text ) ;
51- }
52-
53- var tagName = getSafeTagName ( content . tagName ) || 'div' ;
49+ var tagName = content . inline ? 'span' : 'div' ;
5450 var element = document . createElement ( tagName ) ;
5551
5652 if ( content . className ) {
@@ -59,14 +55,6 @@ function _renderHtml(content: IHTMLContentElement, options: RenderOptions = {}):
5955 if ( content . text ) {
6056 element . textContent = content . text ;
6157 }
62- if ( content . style ) {
63- element . setAttribute ( 'style' , content . style ) ;
64- }
65- if ( content . customStyle ) {
66- Object . keys ( content . customStyle ) . forEach ( ( key ) => {
67- element . style [ key ] = content . customStyle [ key ] ;
68- } ) ;
69- }
7058 if ( content . children ) {
7159 content . children . forEach ( ( child ) => {
7260 element . appendChild ( renderHtml ( child , options ) ) ;
@@ -191,45 +179,6 @@ function _renderHtml(content: IHTMLContentElement, options: RenderOptions = {}):
191179 return element ;
192180}
193181
194- var SAFE_TAG_NAMES = {
195- a : true ,
196- b : true ,
197- blockquote : true ,
198- code : true ,
199- del : true ,
200- dd : true ,
201- div : true ,
202- dl : true ,
203- dt : true ,
204- em : true ,
205- h1h2h3i : true ,
206- img : true ,
207- kbd : true ,
208- li : true ,
209- ol : true ,
210- p : true ,
211- pre : true ,
212- s : true ,
213- span : true ,
214- sup : true ,
215- sub : true ,
216- strong : true ,
217- strike : true ,
218- ul : true ,
219- br : true ,
220- hr : true ,
221- } ;
222-
223- function getSafeTagName ( tagName : string ) : string {
224- if ( ! tagName ) {
225- return null ;
226- }
227- if ( SAFE_TAG_NAMES . hasOwnProperty ( tagName ) ) {
228- return tagName ;
229- }
230- return null ;
231- }
232-
233182// --- formatted string parsing
234183
235184class StringStream {
0 commit comments