Skip to content

Commit

Permalink
feat: export HTMLDumpConfig type
Browse files Browse the repository at this point in the history
  • Loading branch information
thetutlage committed Aug 23, 2024
1 parent 65dd6de commit 6b41c26
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 11 deletions.
9 changes: 4 additions & 5 deletions formatters/html/head.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@
* of the document
*/
export function createStyleSheet() {
return `.dumper-dump {
return `.dumper-dump, .dumper-dump pre, .dumper-dump code, .dumper-dump samp {
font-family: Menlo, Monaco, Consolas, monospace;
}
.dumper-dump {
padding: 4px;
border-radius: 4px;
font-size: 13px;
font-family: Menlo, Monaco, Consolas, monospace;
}
.dumper-dump .dumper-head {
display: flex;
Expand All @@ -21,9 +23,6 @@ export function createStyleSheet() {
text-overflow: ellipsis;
padding: 0 10px;
}
.dumper-dump pre, .dumper-dump code {
font-family: Menlo, Monaco, Consolas, monospace;
}
.dumper-dump pre {
line-height: 24px;
font-size: 15px;
Expand Down
10 changes: 5 additions & 5 deletions formatters/html/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
* file that was distributed with this source code.
*/

import { Parser } from '../../src/parser.js'
import { HTMLFormatter } from './formatter.js'
import type { HTMLDumpConfig } from './types.js'

export * from './head.js'
export { themes } from './themes.js'
export * as helpers from './helpers.js'
import { Parser } from '../../src/parser.js'
import { HTMLFormatter } from './formatter.js'
export { HTMLFormatter } from './formatter.js'
import { HTMLFormatterConfig } from './types.js'
import { ParserConfig } from '../../src/types.js'
export { HTMLPrinters } from './printers/main.js'

/**
Expand All @@ -40,7 +40,7 @@ export { HTMLPrinters } from './printers/main.js'
* })
* ```
*/
export function dump(value: any, config?: ParserConfig & HTMLFormatterConfig) {
export function dump(value: any, config?: HTMLDumpConfig) {
const parser = new Parser(config)
parser.parse(value)
return new HTMLFormatter(config).format(parser.flush())
Expand Down
8 changes: 7 additions & 1 deletion formatters/html/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* file that was distributed with this source code.
*/

import type { TokensMap } from '../../src/types.js'
import type { ParserConfig, TokensMap } from '../../src/types.js'
import type { HTMLFormatter } from './main.js'

/**
Expand Down Expand Up @@ -163,3 +163,9 @@ export type HTMLFormatterConfig = {
}
}
}

/**
* Configuration accepted by the "dump" method exported
* by the html sub-module.
*/
export type HTMLDumpConfig = ParserConfig & HTMLFormatterConfig

0 comments on commit 6b41c26

Please sign in to comment.