Skip to content

Fix InlineMultiQuestion: stop flex-wrapping text-only and blank-only paragraphs#1468

Draft
Copilot wants to merge 1 commit intomainfrom
copilot/fix-inline-question-rendering
Draft

Fix InlineMultiQuestion: stop flex-wrapping text-only and blank-only paragraphs#1468
Copilot wants to merge 1 commit intomainfrom
copilot/fix-inline-question-rendering

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 8, 2026

InlineMultiQuestion.get_question() unconditionally replaced every <p> tag with a Bootstrap input-group flex container, causing garbled rendering when [[blank]] markers appear on their own paragraph (separated from surrounding text by blank lines in markdown).

Root cause

The old approach was a blunt string replace:

question_html.replace("<p>", flex_div_start).replace("</p>", "</div>")

This produced flex containers around text-only paragraphs (breaking normal text flow) and split flex containers that straddled blank-only paragraphs (broken HTML structure around the form fields).

Fix

get_question() now uses re.sub with a per-paragraph callback that classifies each <p>…</p> block:

Content Before After
[[id]] only <div class="input-group …">[[id]]</div> [[id]] — block form field, no wrapper
text + [[id]] inline <div class="input-group …">…</div> unchanged — flex container preserved
text only <div class="input-group …">text</div> <p>text</p> — normal paragraph

The mb-4 spacing class is still applied to the last flex div when one exists.

Copilot AI linked an issue Apr 8, 2026 that may be closed by this pull request
Copilot AI changed the title [WIP] Fix inline question weird form rendering Fix InlineMultiQuestion: stop flex-wrapping text-only and blank-only paragraphs Apr 8, 2026
Copilot AI requested a review from inducer April 8, 2026 16:05
@inducer inducer force-pushed the copilot/fix-inline-question-rendering branch from 27ce6c0 to f6bf216 Compare April 8, 2026 16:18
…nk-only paragraphs

Agent-Logs-Url: https://github.com/inducer/relate/sessions/b158f964-365c-495e-ae0f-959d7bf5e5b3

Co-authored-by: inducer <352067+inducer@users.noreply.github.com>
@inducer inducer force-pushed the copilot/fix-inline-question-rendering branch from f6bf216 to ced2eab Compare April 9, 2026 19:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Inline question has weird form rendering

2 participants