import { renderToStaticMarkup } from 'react-dom/server'
import { createThemeCss } from '@tanstack/highlight/theme'
import { githubDarkTheme } from '@tanstack/highlight/themes/github-dark'
import { githubLightTheme } from '@tanstack/highlight/themes/github-light'
import { describe, expect, it } from 'vitest'
import { renderHtml } from '../src/html.js'
import { Markdown } from '../src/react.js'
import { normalizeStaticMarkup } from './helpers/normalize-html.js'
import { highlightMarkdownCode } from './helpers/tanstack-highlight.js'
describe('TanStack Highlight integration', () => {
it('renders escaped inner token markup inside Markdown-owned containers', () => {
const source = '```html {1}\n\n```'
const options = {
codeLineNumbers: true,
highlighter: highlightMarkdownCode,
}
const html = renderHtml(source, options)
const react = renderToStaticMarkup(
{
const html = renderHtml('```unknown\n\n```', {
highlighter: highlightMarkdownCode,
})
expect(html).toContain('class="language-unknown"')
expect(html).toContain('<script>alert(1)</script>')
expect(html).not.toContain('