Skip to content

Commit 6fb3a5f

Browse files
committed
chore(fix): update charactermap and default colorscheme
1 parent 14d6362 commit 6fb3a5f

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

src/render/html.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,20 @@ import { isBinaryOperator, SYMBOL, type Token, TOKEN } from '../lexer/tokens';
22

33
export type HTMLRenderOptions = {
44
classPrefix: string;
5-
colorScheme: 'auto' | 'light' | 'dark';
5+
colorScheme: 'none' | 'auto' | 'light' | 'dark';
66
includeDebugInfo: boolean;
77
};
88

99
const characterMap: Record<string, string> = {
1010
'^': '', // will be handled specially for superscript
1111
'-': '&minus;',
12-
'*': '&times;',
12+
'*': '&middot;',
1313
'/': '&divide;',
1414
'=': '&equals;',
1515
'+': '&plus;',
1616
'\n': '<br>',
1717
pi: '&pi;',
18-
sqrt: '&sqrt;',
18+
sqrt: '&Sqrt;',
1919
Infinity: '&infin;'
2020
};
2121

@@ -41,14 +41,17 @@ function formatTokenValue(token: Token): string {
4141
return value;
4242
}
4343

44-
// Generate HTML representation of the expression from tokens
44+
/**
45+
* Generate HTML representation of the expression from tokens
46+
* - _experimental_
47+
*/
4548
export function renderTokensAsHTML(
4649
tokens: Token[],
4750
options: Partial<HTMLRenderOptions> = {}
4851
) {
4952
const config: HTMLRenderOptions = {
5053
classPrefix: options.classPrefix || 'mf',
51-
colorScheme: options.colorScheme || 'auto',
54+
colorScheme: options.colorScheme || 'none',
5255
includeDebugInfo: options.includeDebugInfo || false,
5356
...options
5457
};

0 commit comments

Comments
 (0)