/** * `ui.runtimeOptions.markdown` through renderToolTemplate: applied to a Markdown template, refused * on a template that isn't Markdown. */ import { describeRenderOptionProblems, prepareRenderOptions } from '../render-options'; import { renderToolTemplate } from '../template-renderer'; const SOURCE = '| a | b |\n|---|---|\n| 1 | 2 |\n\n```ts\nconst x = 1;\n```'; function body(template: unknown, markdown?: { gfm?: boolean; highlightTheme?: string }, contentSecurity?: object) { const page = renderToolTemplate({ toolName: 'report', input: {}, output: {}, template, markdown, contentSecurity, }).html; return /]*>([\s\S]*)<\/body>/.exec(page)?.[1] ?? ''; } describe('runtimeOptions.markdown', () => { it('converts GitHub-flavored Markdown with gfm', () => { expect(body(SOURCE, { gfm: true })).toContain(''); expect(body(SOURCE)).toContain('

| a | b | |---|---| | 1 | 2 |

'); }); it('highlights fenced code and puts the theme stylesheet in the page with highlightTheme', () => { const markup = body(SOURCE, { highlightTheme: 'github' }); expect(markup).toMatch(/^\s*
ab