@@ -12,8 +12,8 @@ import { getDecorations } from "./helpers/decorations";
12
12
* @param {DataFixture } data - The state object containing the necessary data for HTML generation.
13
13
* @returns {Promise<{ before: string; during: string; after: string }> } A promise that resolves to the generated HTML content for each step.
14
14
*/
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 ( ) ;
17
17
}
18
18
19
19
/**
@@ -22,7 +22,7 @@ export async function generateHtml(data: DataFixture) {
22
22
* @param {DataFixture } data - The state object containing the necessary data for HTML generation.
23
23
* @returns {Object } An object with generate, generateAll, and getDecorations async functions.
24
24
*/
25
- function createHtmlGenerator ( data : DataFixture ) {
25
+ function createHtmlGenerator ( data : DataFixture , debug = false ) {
26
26
const lang = data . languageId as BundledLanguage ;
27
27
const command = data . command ;
28
28
const raw = data ;
@@ -41,7 +41,7 @@ function createHtmlGenerator(data: DataFixture) {
41
41
async function generate ( stepName : StepNameType ) {
42
42
const state = testCaseStates [ stepName ] ;
43
43
if ( ! state ) {
44
- console . error ( `Error in ${ stepName } ${ raw . command . spokenForm } ` ) ;
44
+ if ( debug ) { console . error ( `Error in ${ stepName } ${ raw . command . spokenForm } ` ) ; }
45
45
return "Error" ;
46
46
}
47
47
const extendedState = { ...state , stepName } ;
@@ -60,7 +60,7 @@ function createHtmlGenerator(data: DataFixture) {
60
60
codeBody = marker . codeToHtml ( documentContents , options ) ;
61
61
htmlArray . push ( codeBody ) ;
62
62
} catch ( error ) {
63
- console . error ( "Failed to generate code body:" , error ) ;
63
+ if ( debug ) { console . error ( "Failed to generate code body:" , error ) ; }
64
64
codeBody = "" ;
65
65
}
66
66
0 commit comments