/', () => {
const md = [
'| Plattform | Pris |',
'| --- | --- |',
'| Azure | Høy |',
'| Foundry | Lav |',
].join('\n');
const html = markdownToHtml(md);
assert.match(html, //);
assert.match(html, //);
assert.match(html, /| /);
// header cells render as | , body values as |
assert.match(html, / | Plattform<\/th>/);
assert.match(html, / | Azure<\/td>/);
// the separator row must NOT become a data row
assert.doesNotMatch(html, / | ---<\/td>/);
});
test('empty input produces no table', () => {
assert.doesNotMatch(markdownToHtml(''), //);
});
test('tolerates a malformed row (uneven cell count) without throwing', () => {
const md = [
'| a | b |',
'| --- | --- |',
'| only-one-cell |',
'| x | y |',
].join('\n');
let html;
assert.doesNotThrow(() => { html = markdownToHtml(md); });
assert.match(html, //);
assert.match(html, /x<\/td>/);
});
});
describe('markdownToHtml — heading levels # … #### (beslutning H)', () => {
test('# renders ', () => {
assert.match(markdownToHtml('# Tittel'), /Tittel<\/h1>/);
});
test('## renders ', () => {
assert.match(markdownToHtml('## Seksjon'), /Seksjon<\/h2>/);
});
test('### renders ', () => {
assert.match(markdownToHtml('### Under'), /Under<\/h3>/);
});
test('#### renders ', () => {
assert.match(markdownToHtml('#### Detalj'), /Detalj<\/h4>/);
});
});
describe('inline — backtick code span (beslutning H)', () => {
test('`code` renders ', () => {
assert.match(inline('bruk `npm install` her'), /npm install<\/code>/);
});
test('still handles **bold** and *italic*', () => {
assert.match(inline('**fet** og *kursiv*'), /fet<\/strong>/);
assert.match(inline('**fet** og *kursiv*'), /kursiv<\/em>/);
});
});
| | |