Markdown & PDF viewers

Read Markdown with diagrams, math, alerts and footnotes, kept in step with the source editor, and PDFs with find, outline and thumbnails, right inside VS Code.

Ask AI about this page

Markdown reader

LocalPilot has a reading view for Markdown: specs, plans and reports the agent writes, long chat answers and any .md in your workspace. It renders with VS Code’s own Markdown engine, so it looks like the built-in preview, and lays it out as a calm reading column.

Opening it

Scroll sync

With the source open next to the reader, scrolling either side keeps the same block in view on the other. Double-click a paragraph, heading, list or code block in the reader to jump to that line in the source. Turn sync off with localpilot.markdownViewer.scrollSync.

What it renders

Outline and navigation

The outline lists headings down to localpilot.markdownViewer.outlineDepth (default h3) and follows your position. Long documents get a filter box. A paragraph that is just [[toc]] or [TOC] becomes a table of contents in the page.

Key Action
o Show or hide the outline
/ Filter the outline
w Wrap long code lines
+ / - Larger or smaller text
a Reading settings (width, font, line height, size)
Cmd/Ctrl+F Find in the page
Cmd/Ctrl+C (no selection) Copy the Markdown

Code blocks have Copy and, for files, path:line, which copies a reference such as docs/spec.md:42-50 you can paste into the chat.

Reading settings

Aa in the toolbar (or a) sets the column width (narrow, normal, wide or full), the font (sans, serif or the editor font), the line height and the text size. The choice is remembered and applies at once to every open reader.

Ask LocalPilot

The speech-bubble button attaches the file to the chat and starts a question about it; for an answer shown from the chat, the text is quoted into the draft instead. Select text in the reader and click the floating Ask LocalPilot to attach the file at that line and quote the selection. LocalPilot: Ask LocalPilot About This Document does the same from the Explorer (Markdown and PDF files), the editor title of the reader or the Command Palette.

Export

The ⋯ menu has Export HTML…, Export PDF… and Copy HTML, also available as LocalPilot: Export Markdown as HTML / as PDF.

Exports use light colours by default; set localpilot.markdownViewer.exportTheme to match to keep your editor theme.

Settings

Change these in Settings → Markdown & PDF (run LocalPilot: Settings, or choose Viewer settings… in the reader’s More menu), or in settings.json:

Setting Default Description
localpilot.markdownViewer.scrollSync true Keep the reader and the source editor scrolled together
localpilot.markdownViewer.outlineDepth 3 Deepest heading level in the outline and [[toc]]
localpilot.markdownViewer.frontMatter collapsed collapsed, expanded or hidden
localpilot.markdownViewer.mermaid true Draw Mermaid diagrams
localpilot.markdownViewer.exportTheme light Colours of exported HTML and PDF: light, or match for the current VS Code theme

The reader runs no scripts from the document: it allows only its own script, strips embedded frames, forms and event handlers, and loads no code from the network. Remote images in a document still load.

PDF viewer

LocalPilot opens PDFs in its own viewer, built on a bundled copy of pdf.js. Everything runs locally: the file never leaves VS Code and the viewer makes no network requests.

Opening a PDF

To make the viewer the default (or stop it being the default), set workbench.editorAssociations, for example { "*.pdf": "localpilot.pdfViewer" }, or right-click a PDF → Open With… → Configure default editor for ‘*.pdf’….

Key Action
n / j, p / k Next or previous page
PageDown / PageUp Scroll by a screen (by a page in Page fit)
Home / End First or last page
Cmd/Ctrl+G Go to a page
Cmd/Ctrl+F Find
Cmd/Ctrl+= / Cmd/Ctrl+- / Cmd/Ctrl+0 Zoom in, out, back to the default zoom (localpilot.pdfViewer.defaultZoom)
Cmd/Ctrl+’ Ask LocalPilot about the selected text, or about the PDF when nothing is selected
Cmd/Ctrl+scroll Zoom
r / Shift+r Rotate clockwise or counter-clockwise

The zoom menu has Auto, Page width, Page fit, Actual size and 50–400 %. Text can be selected and copied.

The sidebar shows the PDF’s Outline (the current section is highlighted) or Pages thumbnails. With localpilot.pdfViewer.sidebar set to auto it shows the outline when there is one, otherwise thumbnails, and stays hidden when the view is narrower than 640 px.

Find highlights every match and counts them (“3 of 12”). It has Match case, Whole words and Highlight all; Enter goes to the next match, Shift+Enter to the previous one.

Page colours

The colour button switches between Auto, Original, Dark and Sepia (localpilot.pdfViewer.pageColors). Auto darkens pages in dark themes and draws them in the exact theme colours in high-contrast themes. Dark mode inverts photos too; ⋯ → Show original colours switches back.

Large and protected files

PDFs up to localpilot.pdfViewer.rangeThresholdMB (16 MB) load at once. Larger ones load page by page as you read, so a 500-page, 200 MB file opens quickly and memory stays bounded. Above localpilot.pdfViewer.maxFileSizeMB (1024 MB) the viewer asks first, with Open anyway (page by page), Open with system viewer and Change limit…. For a password-protected PDF it asks for the password; the password stays in the viewer and is never stored. A damaged file shows Not a valid PDF with Open with system viewer. If part of a large file cannot be read (after one retry), the viewer says so and offers Reload. The viewer reloads when the file changes on disk.

Using a PDF with the agent

Security

The viewer never runs JavaScript inside a PDF: pdf.js scripting is off and its sandbox is not shipped. XFA forms are off, form fields are drawn flat and embedded attachments are not exposed. Links open outside VS Code only for http, https and mailto; file:, javascript: and launch actions are dropped. The webview’s content security policy allows only the viewer’s own scripts and WebAssembly decoders, and reads nothing from disk except the PDF the host sends it.

Settings

Change these in Settings → Markdown & PDF (or Viewer settings… in the viewer’s menu), or in settings.json. The same page holds the limits for PDFs the agent reads, localpilot.pdf.maxReadSizeMB and localpilot.pdf.maxChars. When you ask about a PDF larger than the agent may read, LocalPilot still attaches it and offers to attach the current page as an image or to raise the limit.

Setting Default Description
localpilot.pdfViewer.pageColors auto auto, original, dark or sepia
localpilot.pdfViewer.sidebar auto auto, outline, thumbnails or hidden
localpilot.pdfViewer.defaultZoom auto auto, page-width, page-fit or page-actual for files opened for the first time
localpilot.pdfViewer.rangeThresholdMB 16 Larger PDFs load page by page
localpilot.pdfViewer.maxFileSizeMB 1024 Ask before opening larger PDFs