From a8e06e87fbbbb7c7000b486f612586b507768ae5 Mon Sep 17 00:00:00 2001 From: giles Date: Sun, 1 Mar 2026 23:47:54 +0000 Subject: [PATCH] Fix extended-text/heading/quote nodes: treat as inline text when inside links Ghost's extended-text node can appear both as a block (with children) and inline (with text field). When used as a child of a link node, it has a text field and should produce a text literal, not a (p ...) wrapper. Co-Authored-By: Claude Opus 4.6 --- blog/bp/blog/ghost/lexical_to_sx.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/blog/bp/blog/ghost/lexical_to_sx.py b/blog/bp/blog/ghost/lexical_to_sx.py index e29b8bf..a816473 100644 --- a/blog/bp/blog/ghost/lexical_to_sx.py +++ b/blog/bp/blog/ghost/lexical_to_sx.py @@ -138,6 +138,10 @@ def _paragraph(node: dict) -> str: @_converter("extended-text") def _extended_text(node: dict) -> str: + # extended-text can be block-level (with children) or inline (with text). + # When it has a "text" field, treat it as a plain text node. + if "text" in node: + return _text(node) return _paragraph(node) @@ -152,6 +156,8 @@ def _heading(node: dict) -> str: @_converter("extended-heading") def _extended_heading(node: dict) -> str: + if "text" in node: + return _text(node) return _heading(node) @@ -163,6 +169,8 @@ def _quote(node: dict) -> str: @_converter("extended-quote") def _extended_quote(node: dict) -> str: + if "text" in node: + return _text(node) return _quote(node)