Skip to content

Add Download Markdown link with proper filename generation#2876

Open
mich-elle-luna wants to merge 1 commit intomainfrom
md-files
Open

Add Download Markdown link with proper filename generation#2876
mich-elle-luna wants to merge 1 commit intomainfrom
md-files

Conversation

@mich-elle-luna
Copy link
Collaborator

@mich-elle-luna mich-elle-luna commented Mar 10, 2026

  • Added download link in the page meta-links sidebar
  • Generates unique filename based on page path/title
  • Uses JavaScript fetch to download with custom filename
  • Positioned alongside Edit and Create Issue links

Note

Low Risk
Small UI/template change that adds a client-side download action; risk is limited to potential CSP/browser quirks or missing markdown output format on some pages.

Overview
Adds a Download Markdown action to the page meta-links sidebar alongside Edit/Issue links.

The partial now detects the page’s markdown alternative output URL, generates a sanitized .md filename (prefer page path, fallback to title), and uses an inline fetch+Blob helper to download the rendered Markdown when available.

Written by Cursor Bugbot for commit 479c0b4. This will update automatically on new commits. Configure here.

- Added download link in the page meta-links sidebar
- Generates unique filename based on page path/title
- Uses JavaScript fetch to download with custom filename
- Positioned alongside Edit and Create Issue links
@mich-elle-luna mich-elle-luna requested a review from a team March 10, 2026 19:33
@jit-ci
Copy link

jit-ci bot commented Mar 10, 2026

🛡️ Jit Security Scan Results

CRITICAL HIGH MEDIUM

✅ No security findings were detected in this PR


Security scan by Jit

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

<script>
function downloadMarkdown(url, filename) {
fetch(url)
.then(response => response.blob())
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fetch doesn't check response status before downloading

Medium Severity

The fetch call pipes response.blob() without checking response.ok first. If the server returns a non-2xx status (e.g., 404 or 500), the error page HTML body is silently converted to a blob and downloaded as a .md file. The user receives a file that appears valid but contains HTML error content instead of the expected markdown.

Fix in Cursor Fix in Web

@dwdougherty
Copy link
Collaborator

dwdougherty commented Mar 10, 2026

[Confused response deleted.]

Oh... I see. There's a bunch of JSON metadata, followed by the actually page content in Markdown.

@mich-elle-luna
Copy link
Collaborator Author

Thanks David, yes it is a bit confusing, the idea is that a person could download an entire file and put it into the context window of their coding assistant using these links.

Copy link
Collaborator

@dwdougherty dwdougherty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the additional context, @mich-elle-luna. The proposed changes seem to do what you intended, but I haven't done extensive testing; just a few pages here and there. That said, I'll go ahead and approve.

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