Skip to content

Add markdown-to-pdf extension#26550

Draft
shaynelarocque wants to merge 6 commits intoraycast:mainfrom
shaynelarocque:ext/markdown-to-pdf
Draft

Add markdown-to-pdf extension#26550
shaynelarocque wants to merge 6 commits intoraycast:mainfrom
shaynelarocque:ext/markdown-to-pdf

Conversation

@shaynelarocque
Copy link
Copy Markdown

@shaynelarocque shaynelarocque commented Mar 22, 2026

Description

An AI-tool extension that converts markdown into styled PDFs. Mention @markdown to PDF in Ask AI, AI Chat, or AI Commands with your markdown content.

Features:

  • Styled PDF output with headings, lists, tables, code blocks, blockquotes, and clickable hyperlinks
  • 5 built-in color themes (default, minimal, executive, ocean, warm)
  • Custom theme support via extension preferences
  • Layout controls: font (Helvetica/Times/Courier), font size, line spacing, and per-side margins
  • Pure pdf-lib rendering

Screencast

1 2 3 4

Checklist

@raycastbot raycastbot added new extension Label for PRs with new extensions AI Extension labels Mar 22, 2026
@raycastbot
Copy link
Copy Markdown
Collaborator

Congratulations on your new Raycast extension! 🚀

We're currently experiencing a high volume of incoming requests. As a result, the initial review may take up to 10-15 business days.

Once the PR is approved and merged, the extension will be available on our Store.

@shaynelarocque shaynelarocque marked this pull request as ready for review March 22, 2026 03:38
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Mar 22, 2026

Greptile Summary

This PR adds a new markdown-to-pdf extension that uses a custom pure-pdf-lib renderer to convert markdown into styled PDFs via Raycast's AI tool interface. The implementation is well-structured with good input validation, theme support, and font fallback handling. Two minor rendering issues are worth addressing before merge.

Confidence Score: 5/5

Safe to merge; both findings are P2 visual/UX issues that do not affect core functionality.

All remaining findings are P2: html: true causing silent content drop for embedded HTML (an edge case for typical markdown input) and missing table top-border on page breaks (a cosmetic defect). Neither blocks the primary user path.

extensions/markdown-to-pdf/src/lib/markdown.ts — html: true setting; extensions/markdown-to-pdf/src/lib/pdf/render.ts — table page-break border.

Vulnerabilities

No security concerns identified. PDF generation is local, link URLs are user-supplied and written directly to PDF annotations (expected behavior), and no secrets or credentials are handled.

Important Files Changed

Filename Overview
extensions/markdown-to-pdf/src/lib/markdown.ts Configures markdown-it with html: true, but the PDF renderer has no HTML token handler — raw HTML in markdown is silently dropped from output.
extensions/markdown-to-pdf/src/lib/pdf/render.ts Custom PDF rendering engine; table top-border is not redrawn when a page break occurs mid-table, leaving an incomplete frame on the continuation page.
extensions/markdown-to-pdf/src/lib/pdf/markdown-model.ts Markdown token parser that maps markdown-it output to typed PdfBlock structs; logic is sound and well-structured.
extensions/markdown-to-pdf/src/lib/normalization.ts Input normalization and validation; uses a require() workaround for Raycast preferences (flagged in prior review threads).
extensions/markdown-to-pdf/src/lib/conversion.ts Orchestrates content validation, layout normalization, directory creation, and PDF rendering; straightforward and correct.
extensions/markdown-to-pdf/src/tools/convert-markdown-to-doc.ts Raycast AI tool entry point with confirmation dialog; well-typed and correctly structured.
extensions/markdown-to-pdf/package.json Extension manifest with correct categories, Title Case preference labels, textfield types throughout, and all dependencies used.

Fix All in Codex Fix All in Cursor Fix All in Claude Code

Prompt To Fix All With AI
This is a comment left during a code review.
Path: extensions/markdown-to-pdf/src/lib/markdown.ts
Line: 3-7

Comment:
**HTML blocks silently dropped from PDF output**

`html: true` tells markdown-it to parse raw HTML tags in the markdown source, producing `html_block` and `html_inline` tokens. However, `parseMarkdownBlocks` in `markdown-model.ts` does not handle those token types, so any inline HTML the user includes (`<span>`, `<div>`, `<table>`, etc.) will be silently swallowed — no text reaches the PDF.

If HTML embedding is intentionally unsupported, set `html: false` so markdown-it treats `<…>` as literal text instead of silently discarding it:

```suggestion
export const markdown = new MarkdownIt({
  html: false,
  linkify: true,
  breaks: false,
});
```

How can I resolve this? If you propose a fix, please make it concise.

---

This is a comment left during a code review.
Path: extensions/markdown-to-pdf/src/lib/pdf/render.ts
Line: 392-395

Comment:
**Missing top border when table spans a page break**

`ensureVerticalSpace` can insert a new page in the middle of the table loop. The top border (`rowIndex === 0` guard) is never re-drawn on the new page, so the continuation of the table starts without a top edge, leaving a visually incomplete table frame.

Consider tracking whether the current row is the first on its page and drawing the top border whenever a new page starts mid-table.

How can I resolve this? If you propose a fix, please make it concise.

Reviews (2): Last reviewed commit: "Address Greptile review feedback" | Re-trigger Greptile

Comment thread extensions/markdown-to-pdf/src/lib/normalization.ts
Comment thread extensions/markdown-to-pdf/src/lib/normalization.ts Outdated
Comment thread extensions/markdown-to-pdf/CHANGELOG.md Outdated
@raycastbot
Copy link
Copy Markdown
Collaborator

This pull request has been automatically marked as stale because it did not have any recent activity.

It will be closed if no further activity occurs in the next 7 days to keep our backlog clean 😊

@raycastbot raycastbot added the status: stalled Stalled due inactivity label Apr 5, 2026
@shaynelarocque
Copy link
Copy Markdown
Author

Still active — all review feedback has been addressed in df33c7c.

@raycastbot raycastbot removed the status: stalled Stalled due inactivity label Apr 5, 2026
@0xdhrv 0xdhrv self-assigned this Apr 9, 2026
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Apr 9, 2026

Tip:

Greploop — Automatically fix all review issues by running /greploops in Claude Code. It iterates: fix, push, re-review, repeat until 5/5 confidence.

Use the Greptile plugin for Claude Code to query reviews, search comments, and manage custom context directly from your terminal.

"mode": "no-view"
}
],
"tools": [
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Contributor

@0xdhrv 0xdhrv left a comment

Choose a reason for hiding this comment

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

Hey @shaynelarocque 👋

I have added a few comments for you to address.

I'm looking forward to testing this extension again 🔥

Feel free to contact me here or at Slack if you have any questions.


I converted this PR into a draft until it's ready for the review, please press the button Ready for review when it's ready and we'll have a look 😊

@0xdhrv 0xdhrv marked this pull request as draft April 9, 2026 11:26
@raycastbot
Copy link
Copy Markdown
Collaborator

This pull request has been automatically marked as stale because it did not have any recent activity.

It will be closed if no further activity occurs in the next 7 days to keep our backlog clean 😊

@raycastbot raycastbot added the status: stalled Stalled due inactivity label Apr 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI Extension new extension Label for PRs with new extensions platform: macOS status: stalled Stalled due inactivity

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants