1
- import { createHighlighter , createCssVariablesTheme } from "shiki " ;
1
+ import { createHighlighter } from "./createHighlighter " ;
2
2
import type { BundledLanguage } from "shiki" ;
3
3
import type { Lang , StepNameType , ExtendedTestCaseSnapshot , DataFixture } from "./types" ;
4
4
import type { Command , CommandLatest , TestCaseFixture } from "@cursorless/common" ;
5
5
6
6
import { createDecorations } from "./helpers" ;
7
7
8
- const myTheme = createCssVariablesTheme ( {
9
- name : "css-variables" ,
10
- variablePrefix : "--shiki-" ,
11
- variableDefaults : { } ,
12
- fontStyle : true ,
13
- } ) ;
14
-
15
8
/**
16
9
* Generates HTML content based on the provided state, language, command, and ide.
17
10
*
18
11
* @param {DataFixture } data - The state object containing the necessary data for HTML generation.
19
- * @returns {Promise<string> } A promise that resolves to the generated HTML content.
12
+ * @returns {Promise<{ before: string; during: string; after: string } > } A promise that resolves to the generated HTML content for each step .
20
13
*/
21
14
export async function generateHtml ( data : DataFixture ) {
22
- const HTMLOBject = await new HTMLGenerator ( data )
23
- const returnObject = HTMLOBject . generateAll ( )
24
- return returnObject ;
15
+ return new HTMLGenerator ( data ) . generateAll ( )
25
16
}
26
17
27
- const highlighter = createHighlighter ( {
28
- themes : [ myTheme ] ,
29
- langs : [ "javascript" , "typescript" , "python" , "markdown" ] ,
30
- } ) ;
18
+ const highlighter = createHighlighter ( ) ;
31
19
32
20
class HTMLGenerator {
33
21
private testCaseStates : {
@@ -38,22 +26,12 @@ class HTMLGenerator {
38
26
private lang : Lang ;
39
27
private command ?: CommandLatest | Command ;
40
28
private raw : TestCaseFixture ;
41
- private rendered : {
42
- before : string ;
43
- during : string ;
44
- after : string ;
45
- }
46
29
47
30
constructor ( data : DataFixture ) {
48
31
const { languageId, command } = data ;
49
32
this . lang = languageId as BundledLanguage ;
50
33
this . command = command ; // Optional command parameter
51
34
this . raw = data
52
- this . rendered = {
53
- before : "" ,
54
- during : "" ,
55
- after : "" ,
56
- }
57
35
this . testCaseStates = {
58
36
before : data . initialState ,
59
37
during : {
0 commit comments