Skip to content

[Repo Assist] Fix Markdown.ToMd multi-paragraph blockquote roundtrip; make code tooltips interactive#1106

Open
github-actions[bot] wants to merge 7 commits intomainfrom
repo-assist/fix-quotedblock-tooltip-2026-03-23-5db2e36142c59982
Open

[Repo Assist] Fix Markdown.ToMd multi-paragraph blockquote roundtrip; make code tooltips interactive#1106
github-actions[bot] wants to merge 7 commits intomainfrom
repo-assist/fix-quotedblock-tooltip-2026-03-23-5db2e36142c59982

Conversation

@github-actions
Copy link
Contributor

🤖 This PR was created by Repo Assist, an automated AI assistant.

Summary

Two targeted fixes addressing one code bug (Task 3) and one UX improvement (Task 10).


1. Fix Markdown.ToMd multi-paragraph blockquote roundtrip (Task 3 — bug fix)

Root cause

formatParagraph serialised QuotedBlock by prefixing every output line with "> " and then emitting a plain blank line ("") after each inner paragraph. A plain blank line closes a CommonMark blockquote, so re-parsing the serialised output would produce multiple separate QuotedBlock nodes instead of the original single one with multiple paragraphs. The old code also emitted "> " lines (with trailing whitespace) because it included the trailing blank that formatParagraph normally appends.

Fix (src/FSharp.Formatting.Markdown/MarkdownUtils.fs)

  • Drop the trailing empty line from each inner paragraph's formatted lines before prefixing with "> ".
  • Emit ">" (an empty blockquote continuation line) between paragraphs instead of a plain blank line.

Tests added (tests/FSharp.Markdown.Tests/Markdown.fs)

  • ToMd preserves a multi-paragraph blockquote as a single blockquote — parses a two-paragraph blockquote, serialises with ToMd, re-parses, and asserts there is exactly one QuotedBlock.
  • ToMd blockquote does not produce trailing-whitespace lines — asserts no "> " lines with trailing whitespace are emitted.

2. Make generated-docs tooltips interactive (Task 10 — forward progress, issue #949)

Problem (#949)

Hovering a code token showed a tooltip, but moving the mouse into the tooltip caused it to immediately hide. Users could not select or copy text from the tooltip.

Root cause

The mouseout handler for trigger elements only checked target.contains(evt.relatedTarget) — but the tooltip div is not a descendant of the trigger, so moving the mouse to the tooltip fired hideTip.

Fix (docs/content/fsdocs-tips.js)

  • In the existing mouseout handler on triggers: if relatedTarget is the tooltip element or one of its descendants, return early (tooltip stays visible).
  • Add a second mouseout handler on div.fsdocs-tip elements: hide the tooltip when the mouse leaves it, unless the mouse has moved back to the originating trigger.

No CSS changes are needed; the tooltip already supports interaction via the Popover API.


Changes

File Change
src/FSharp.Formatting.Markdown/MarkdownUtils.fs Fix QuotedBlock serialisation (paragraph separator + trailing whitespace)
tests/FSharp.Markdown.Tests/Markdown.fs Two new ToMd round-trip tests for blockquotes
docs/content/fsdocs-tips.js Allow mouse to enter tooltip; hide tooltip on tooltip mouseleave
RELEASE_NOTES.md Changelog entries under [Unreleased]

Test Status

  • dotnet build FSharp.Formatting.sln --configuration Release — succeeded (1 pre-existing FS0760 warning, unchanged)
  • dotnet test tests/FSharp.Markdown.Tests283/283 passed (includes 2 new tests)
  • dotnet fantomas … --check — formatting verified via Fantomas
  • dotnet test FSharp.Formatting.sln --configuration Release --no-build — full suite passes (ApiDocs: 88 passed, 4 skipped; all other projects pass)

Generated by Repo Assist ·

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/repo-assist.md@d1d884596e62351dd652ae78465885dd32f0dd7d

Generated by Repo Assist ·

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/repo-assist.md@d1d884596e62351dd652ae78465885dd32f0dd7d

…ips interactive

Task 3 (fix): Markdown.ToMd - QuotedBlock with multiple paragraphs
- A plain blank line between paragraphs in a QuotedBlock closed the blockquote,
  so re-parsing the output produced separate QuotedBlock nodes instead of one.
- Fix: emit an empty blockquote line ('>') as the paragraph separator so the
  blockquote stays open across paragraph boundaries.
- Also eliminates '> ' lines (with trailing whitespace) that the old code produced
  by stripping the trailing empty line that formatParagraph appends before prefixing.
- Added two new tests: roundtrip preserves a single QuotedBlock for multi-paragraph
  blockquotes; no '> ' trailing-whitespace lines are emitted.

Task 10 (forward): Make fsdocs-tips.js tooltips interactive (#949)
- When the mouse moves from a code token into the tooltip, the tooltip is now kept
  visible so users can hover over, select, and copy text.
- A new 'mouseout' handler on the tooltip div hides it when the mouse leaves unless
  it returns to the originating trigger.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@dsyme dsyme marked this pull request as ready for review March 25, 2026 15:41
@dsyme
Copy link
Contributor

dsyme commented Mar 25, 2026

@nojaf does this look ok?

@nojaf
Copy link
Collaborator

nojaf commented Mar 25, 2026

/repo-assist the hover over tooltip and select text does not work when the tooltip is too far removed from the symbol, see
image

The tooltip must be 100% adjacent for this to work.

@github-actions
Copy link
Contributor Author

github-actions bot commented Mar 25, 2026

Repo Assist completed successfully!

…y adjacent

When the tooltip is repositioned to stay within the viewport (e.g. flipped
above the cursor or shifted left), there can be a gap between the trigger
element and the tooltip. Previously the mouseout handler on the trigger
checked relatedTarget immediately; any gap caused the tooltip to hide before
the mouse could travel across it.

Replace the synchronous hideTip calls in both mouseout handlers with a
300 ms scheduleHide. The pending hide is cancelled whenever the mouse enters
the tooltip (mouseover on div.fsdocs-tip) or re-enters the trigger (start of
showTip / cancelHide). This is the standard hover-intent pattern and works
regardless of tooltip position.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions
Copy link
Contributor Author

Commit pushed: a0fa784

Generated by Repo Assist

@github-actions
Copy link
Contributor Author

🤖 This is an automated response from Repo Assist.

Good catch, @nojaf! I've pushed a fix to this PR.

Root cause: when the tooltip is repositioned to stay within the viewport (flipped above the cursor or shifted left), there's a gap between the trigger and tooltip. The mouseout handler checked relatedTarget synchronously — any gap meant relatedTarget was empty space (not the tooltip), so hideTip fired before the mouse could cross it.

Fix: replaced the synchronous hideTip calls in both mouseout handlers with a 300 ms scheduleHide. The pending hide is cancelled immediately when the mouse enters the tooltip (mouseover on div.fsdocs-tip) or re-enters the trigger (top of showTip). This is the classic hover-intent pattern and works regardless of tooltip position — whether directly adjacent or repositioned across the viewport.

The relatedTarget guard checks are no longer needed (the delay handles all cases) and have been removed, simplifying the code.

Generated by Repo Assist for issue #1106 ·

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/repo-assist.md@4957663821dbb3260348084fa2f1659701950fef

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants