From cfb744f091be268e4d50bfd6acbec15b2b6054b4 Mon Sep 17 00:00:00 2001 From: Joakim Date: Thu, 11 Sep 2025 16:55:39 +0200 Subject: [PATCH] feat: enable markdown processing for span elements Backend changes: - Updated parser to treat elements as markdown by default - Changed span content type detection from ContentText to ContentMarkdown - Spans now support **bold**, *italic*, and [links](url) formatting Frontend changes: - Updated content type detection to match backend behavior - Frontend now treats spans as markdown elements for consistent processing - Editor preview behavior now matches server-side enhancement Benefits: - **bold** text now processes markdown correctly - Inline elements maintain all styling while supporting rich formatting - Complete frontend/backend consistency for span element handling - Expands markdown support to common inline wrapper elements Tested and verified: - Span elements preserve all classes, IDs, and styles - Bold, italic, and link formatting works in span elements - Content type properly detected as 'markdown' in both systems --- demo-site/index.html | 6 ++---- internal/parser/parser.go | 3 ++- lib/src/core/insertr.js | 2 ++ 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/demo-site/index.html b/demo-site/index.html index 93f2742..0808b98 100644 --- a/demo-site/index.html +++ b/demo-site/index.html @@ -23,8 +23,7 @@

Transform Your Business with Expert Consulting

-

We help small businesses grow through strategic planning, process optimization, and digital transformation. Our team brings 15+ years of experience to drive your success. Superb

-

+

We help small businesses grow through strategic planning, process optimization, and digital transformation. Our team brings 15+ years of experience to drive your success. Superb

Get Started Today?
@@ -75,8 +74,7 @@ diff --git a/internal/parser/parser.go b/internal/parser/parser.go index 036c50d..2736d14 100644 --- a/internal/parser/parser.go +++ b/internal/parser/parser.go @@ -205,7 +205,8 @@ func (p *Parser) detectContentType(node *html.Node, classes []string) ContentTyp // Default divs/sections to markdown for rich content return ContentMarkdown case "span": - return ContentText + // Default spans to markdown for rich inline content + return ContentMarkdown default: return ContentText } diff --git a/lib/src/core/insertr.js b/lib/src/core/insertr.js index 4c7a9ee..e2e8c4e 100644 --- a/lib/src/core/insertr.js +++ b/lib/src/core/insertr.js @@ -339,6 +339,8 @@ export class InsertrCore { return 'link'; case 'div': case 'section': return 'markdown'; + case 'span': + return 'markdown'; // Match backend: spans support inline markdown default: return 'text'; }