@meistrari/tela-skills 1.6.1 → 1.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/skill/canvas.test.ts +11 -0
- package/skill/canvas.ts +9 -0
package/package.json
CHANGED
package/skill/canvas.test.ts
CHANGED
|
@@ -173,4 +173,15 @@ describe('canvas', () => {
|
|
|
173
173
|
expect(html).toContain('Literal sentinel: %%TELAVAR0%% ')
|
|
174
174
|
expect(html).toContain('<variable class="variable" data-variable="texto_publicacao">texto_publicacao</variable>')
|
|
175
175
|
})
|
|
176
|
+
|
|
177
|
+
test('renders markdown separator lines as horizontal rules', async () => {
|
|
178
|
+
const { markdownToHtml } = await import('./canvas.ts')
|
|
179
|
+
|
|
180
|
+
for (const separator of ['---', '***', '___']) {
|
|
181
|
+
const html = markdownToHtml(`# Contexto\n\n${separator}\n\n# Etapas`)
|
|
182
|
+
|
|
183
|
+
expect(html).toContain('<hr>')
|
|
184
|
+
expect(html).not.toContain(`<p>${separator}</p>`)
|
|
185
|
+
}
|
|
186
|
+
})
|
|
176
187
|
})
|
package/skill/canvas.ts
CHANGED
|
@@ -436,6 +436,15 @@ export function markdownToHtml(markdown: string): string {
|
|
|
436
436
|
htmlParts.push(`<h1>${trimmed.slice(2)}</h1>`)
|
|
437
437
|
isFirst = false
|
|
438
438
|
}
|
|
439
|
+
// Horizontal rule
|
|
440
|
+
else if (/^(?:-{3,}|\*{3,}|_{3,})$/.test(trimmed)) {
|
|
441
|
+
if (inList) {
|
|
442
|
+
htmlParts.push('</ul>')
|
|
443
|
+
inList = false
|
|
444
|
+
}
|
|
445
|
+
htmlParts.push('<hr>')
|
|
446
|
+
isFirst = false
|
|
447
|
+
}
|
|
439
448
|
// Bullet list
|
|
440
449
|
else if (trimmed.startsWith('- ')) {
|
|
441
450
|
if (!inList) {
|