| 
									
										
										
										
											2020-11-27 19:02:05 +01:00
										 |  |  | const hastToHTML = require('hast-util-to-html'); | 
					
						
							|  |  |  | const { root } = require('mdast-builder'); | 
					
						
							| 
									
										
										
										
											2021-08-02 15:39:40 +02:00
										 |  |  | const mdastToHast = require('mdast-util-to-hast'); | 
					
						
							| 
									
										
										
										
											2020-11-27 19:02:05 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | function mdastToHTML(nodes) { | 
					
						
							|  |  |  |   if (!Array.isArray(nodes)) | 
					
						
							|  |  |  |     throw Error('mdastToHTML expects an array argument'); | 
					
						
							|  |  |  |   // - the 'nodes' are children, so first need embedding in a parent
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   return hastToHTML(mdastToHast(root(nodes), { allowDangerousHtml: true }), { | 
					
						
							|  |  |  |     allowDangerousHtml: true | 
					
						
							|  |  |  |   }); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | module.exports = mdastToHTML; |