11// js/opencon.js
22const body = document . querySelector ( "body" ) ;
3+ // Convert Markdown content to HTML
4+ function convertMarkdownToHTML ( markdown ) {
5+ if ( typeof marked !== "undefined" ) {
6+ return marked . parse ( markdown ) ;
7+ } else {
8+ return markdown ;
9+ }
10+ // return markdown;
11+ }
312
413fetch ( "specs/opencon.yaml" )
514 . then ( ( response ) => response . text ( ) )
@@ -127,7 +136,7 @@ fetch("specs/opencon.yaml")
127136 containerMainContent . appendChild ( containerMainContentH1 ) ;
128137 const containerMainContentP1 = document . createElement ( "p" ) ;
129138 containerMainContentP1 . classList . add ( "paragraph" ) ;
130- containerMainContentP1 . textContent = preamble . content ;
139+ containerMainContentP1 . innerHTML = convertMarkdownToHTML ( preamble . content ) ;
131140 containerMainContent . appendChild ( containerMainContentP1 ) ;
132141 const containerMainContentP2 = document . createElement ( "p" ) ;
133142 containerMainContentP2 . classList . add ( "paragraph" ) ;
@@ -157,7 +166,7 @@ fetch("specs/opencon.yaml")
157166 articleContainer . appendChild ( articleContainerH2 ) ;
158167 const articleContainerP = document . createElement ( "p" ) ;
159168 articleContainerP . classList . add ( "paragraph" ) ;
160- articleContainerP . textContent = article . content ;
169+ articleContainerP . innerHTML = convertMarkdownToHTML ( article . content ) ;
161170 articleContainer . appendChild ( articleContainerP ) ;
162171 sections = article . sections ;
163172 if ( sections != undefined ) {
@@ -172,7 +181,7 @@ fetch("specs/opencon.yaml")
172181 sectionContainer . appendChild ( sectionContainerH3 ) ;
173182 const sectionContainerP = document . createElement ( "p" ) ;
174183 sectionContainerP . classList . add ( "paragraph" ) ;
175- sectionContainerP . textContent = section . content ;
184+ sectionContainerP . innerHTML = convertMarkdownToHTML ( section . content ) ;
176185 sectionContainer . appendChild ( sectionContainerP ) ;
177186 } ) ;
178187 }
0 commit comments