@@ -12,8 +12,8 @@ import { getDecorations } from "./helpers/decorations";
1212 * @param {DataFixture } data - The state object containing the necessary data for HTML generation.
1313 * @returns {Promise<{ before: string; during: string; after: string }> } A promise that resolves to the generated HTML content for each step.
1414 */
15- export async function generateHtml ( data : DataFixture ) {
16- return createHtmlGenerator ( data ) . generateAll ( ) ;
15+ export async function generateHtml ( data : DataFixture , debug = false ) {
16+ return createHtmlGenerator ( data , debug ) . generateAll ( ) ;
1717}
1818
1919/**
@@ -22,7 +22,7 @@ export async function generateHtml(data: DataFixture) {
2222 * @param {DataFixture } data - The state object containing the necessary data for HTML generation.
2323 * @returns {Object } An object with generate, generateAll, and getDecorations async functions.
2424 */
25- function createHtmlGenerator ( data : DataFixture ) {
25+ function createHtmlGenerator ( data : DataFixture , debug = false ) {
2626 const lang = data . languageId as BundledLanguage ;
2727 const command = data . command ;
2828 const raw = data ;
@@ -41,7 +41,7 @@ function createHtmlGenerator(data: DataFixture) {
4141 async function generate ( stepName : StepNameType ) {
4242 const state = testCaseStates [ stepName ] ;
4343 if ( ! state ) {
44- console . error ( `Error in ${ stepName } ${ raw . command . spokenForm } ` ) ;
44+ if ( debug ) { console . error ( `Error in ${ stepName } ${ raw . command . spokenForm } ` ) ; }
4545 return "Error" ;
4646 }
4747 const extendedState = { ...state , stepName } ;
@@ -60,7 +60,7 @@ function createHtmlGenerator(data: DataFixture) {
6060 codeBody = marker . codeToHtml ( documentContents , options ) ;
6161 htmlArray . push ( codeBody ) ;
6262 } catch ( error ) {
63- console . error ( "Failed to generate code body:" , error ) ;
63+ if ( debug ) { console . error ( "Failed to generate code body:" , error ) ; }
6464 codeBody = "" ;
6565 }
6666
0 commit comments