reflex-site-shared: keep inline markup in Markdown links and headings
Summary
The docs site's Markdown renderer flattened a link's text to the plain strings among its rendered children. Inline code (and bold or italics) is rendered as a component, so it was dropped, and a link like [`run_workflows`](/docs/...) rendered as an empty <a>. Reported by @masenf on #7379.
Links now render their children as components (rx.fragment), and keep a plain string when the text is plain, so ordinary links compile to exactly the same output as before. doclink2 accepts str | rx.Component for its text.
This is broader than code-only links: on main, 39 links across 30 pages have code or bold in their text and lose it, either rendering empty ([`rx.match`](...)) or dropping words (the [`match` component](...) shows as "the component"). Examples: api-reference/special_events.md, api-reference/var_system.md, components/conditional_rendering.md, database/queries.md, enterprise/event-handler-api.md, enterprise/auth/secure-by-default.md, library/tables-and-data-grids/table.md.
Headings
Headings had the same flattening: inline code in 91 headings (e.g. ### Templating: example_big_app/template.py``) rendered as plain text. A heading with markup now renders it via a new heading_comp, anchored on the same plain text, so ids and table-of-contents links are unchanged (checked in the browser: every TOC anchor on advanced-onboarding/code-structure resolves). Plain headings still go through the memoized h*_comp_xd and compile as before. Inline code in a heading is sized at 0.875em of the heading rather than the fixed body size. The per-level tag/margin/classes moved into one HEADING_STYLES table.
Test plan
- New
test_link_text_keeps_its_inline_markup(code, bold, and mixed link text, through bothrender_markdownandrender_inline_markdown) fails before the change and passes after. - New
test_heading_keeps_inline_code_and_its_plain_anchor(levels 1-4) fails before and passes after. -
tests/units/reflex_site_shared(138 passed) anddocs/apptests pass. - Plain-link output checked unchanged; pre-commit clean.