Skip to content

Add Download Markdown link with proper filename generation#2876

Merged
mich-elle-luna merged 1 commit intomainfrom
md-files
Mar 11, 2026
Merged

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

Conversation

@mich-elle-luna
Copy link
Copy Markdown
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
Copy Markdown

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
Copy Markdown

@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
Copy Markdown

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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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.

@andy-stark-redis
Copy link
Copy Markdown
Contributor

@mich-elle-luna I think this a really good idea, but just something to consider/discuss: is downloading the Markdown from the link the best way to make it available? I'm just thinking that browsers have a "Save linked file" or "Open link in new tab" option when you hover over a link, so you could maybe just have a link to the index.html.md page saying "View as AI-friendly Markdown", or something. As you say, people might often want to copy/paste the Markdown into a prompt, so another option might be "Copy text as AI-friendly Markdown" (or whatever) - possibly quicker than downloading and then requiring the user to find and attach the file? Anyway, just some thoughts, it's pretty good as it is :-)

@dwdougherty I think other people will have exactly the same reaction you did, so I'll investigate where all those extra blank lines are being added and remove them.

@mich-elle-luna
Copy link
Copy Markdown
Collaborator Author

For this request, it was specified to have downloadable pages, so I will keep it this way for now and we can revisit it as we get feedback. Thank you!

@mich-elle-luna mich-elle-luna merged commit f90e1c4 into main Mar 11, 2026
47 checks passed
@mich-elle-luna mich-elle-luna deleted the md-files branch March 11, 2026 14:57
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.

3 participants