Skip to content

Fix multiline footnote body extraction/rendering for indented continuations#103

Draft
Copilot wants to merge 5 commits into
mainfrom
copilot/fix-multiline-footnote-rendering-again
Draft

Fix multiline footnote body extraction/rendering for indented continuations#103
Copilot wants to merge 5 commits into
mainfrom
copilot/fix-multiline-footnote-rendering-again

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 17, 2026

Multiline footnote definitions were being reduced to empty/near-empty entries in the rendered footnote list (showing only [n] ←), with continuation paragraphs dropped after blank lines. This PR updates the footnote extraction/render path so full multiline bodies (including inline markdown) are preserved.

  • Footnote parser: continuation block handling

    • Added explicit continuation-line detection and indent normalization for footnote definitions.
    • Continued parsing across blank lines when followed by indented continuation content, so multi-paragraph bodies stay attached to the same [^id]: definition.
  • Footnote renderer: robust paragraph/body handling

    • Normalized paragraph splitting for mixed newline styles (LF/CRLF).
    • Avoided emitting empty footnote entries by storing/rendering only non-empty extracted definition content.
    • Preserved inline back-reference placement at the end of rendered footnote content.
  • Codebase consistency

    • Applied identical logic in both mirrored frontend scripts:
      • script.js
      • desktop-app/resources/js/script.js
function isFootnoteContinuationLine(line, baseIndent) {
  if (!line.startsWith(baseIndent)) return false;
  const lineAfterBase = line.slice(baseIndent.length);
  return /^(?: {2,}|\t)/.test(lineAfterBase);
}

function stripFootnoteContinuationIndent(line, baseIndent) {
  const lineAfterBase = line.slice(baseIndent.length);
  if (lineAfterBase.startsWith("\t")) return lineAfterBase.slice(1);
  return lineAfterBase.replace(/^ {2}/, "");
}

Copilot AI and others added 5 commits May 17, 2026 17:10
Agent-Logs-Url: https://github.com/ThisIs-Developer/Markdown-Viewer/sessions/1c8baaa9-207e-4a31-acf6-fa1007139c51

Co-authored-by: ThisIs-Developer <109382325+ThisIs-Developer@users.noreply.github.com>
Agent-Logs-Url: https://github.com/ThisIs-Developer/Markdown-Viewer/sessions/1c8baaa9-207e-4a31-acf6-fa1007139c51

Co-authored-by: ThisIs-Developer <109382325+ThisIs-Developer@users.noreply.github.com>
Agent-Logs-Url: https://github.com/ThisIs-Developer/Markdown-Viewer/sessions/1c8baaa9-207e-4a31-acf6-fa1007139c51

Co-authored-by: ThisIs-Developer <109382325+ThisIs-Developer@users.noreply.github.com>
Agent-Logs-Url: https://github.com/ThisIs-Developer/Markdown-Viewer/sessions/1c8baaa9-207e-4a31-acf6-fa1007139c51

Co-authored-by: ThisIs-Developer <109382325+ThisIs-Developer@users.noreply.github.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented May 17, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
markdown-viwer Ready Ready Preview, Comment May 17, 2026 5:17pm

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.

2 participants