How to copy a file as a fenced Markdown code block on Mac
You can do this with Note My in one step. Here is what lands on the clipboard — the fence, the contents and, when you want it, the path — instead of the six keystrokes you would otherwise type around it.
You want to show someone a file — a colleague on a review, an issue tracker, an AI chat. The code needs to arrive fenced, so it is not reflowed into a paragraph, and labelled, so nobody has to ask which file it came from. By hand that is open, select all, copy, paste, type the backticks, type the path above them. A lot of keystrokes for something you do fifteen times a day.
The Finder extension that ships with Note My does it from the right-click menu, without opening the file at all.
The item is called Copy for AI, but nothing is sent anywhere. It all happens on your Mac: nothing is uploaded, there is no account, and your files never leave the machine. The command shapes your clipboard; what you do with it after that is your business.
Copy a file as a fenced block
-
Make sure the Finder extension is on
Extensions are off until you allow them. Turn it on from System Settings, or from the Finder extension card on page 8 of the welcome carousel, which shows a green On badge when it is enabled and an Enable… button when it is not. The app describes it plainly: it adds a Note My ▸ submenu to the right-click menu, and you control it any time in System Settings.
-
Right-click exactly one file
Select a single file in the Finder and open Note My ▸. The menu shapes itself to what you have picked: one file gives you the three copy-the-contents items. Select more and it offers the multi-file verbs instead — Concatenate & Open, joined by Compare the 2 Files when the selection is exactly two.
-
Choose the shape you want
Copy as Markdown Code Block for the code alone, fenced. Copy for AI (path + fenced) when the reader also needs to know where the file lives. Copy Contents when you want the raw text with nothing wrapped around it.
-
Paste, then glance at the opening fence
Paste into the chat, the issue or the review. The fence is already around the code, and if you chose that item the path is already sitting above it. Where the destination renders Markdown and you want the language spelled out on the opening fence, add the word there — one word, one second, and everything else is in place.
What actually lands on the clipboard
Three items, three shapes, in the order they appear in the menu.
| Menu item | What you get | Use it when |
|---|---|---|
| Copy Contents | The file's text, unwrapped. | You are pasting into something that is already a code field. |
| Copy as Markdown Code Block | The same text, inside a fence. | The destination renders Markdown and will otherwise mangle indentation. |
| Copy for AI (path + fenced) | The path, then the fenced block. | The reader needs to know which file this is, not just what it says. |
Two neighbouring items are worth knowing, because half the time they are what you actually wanted: Copy Path gives you the full path on its own, and Copy Relative Path gives you a shorter form of it, for pasting somewhere the surrounding folder is already understood. Both hand you the location on its own, and both stay in the menu whatever you have selected, so you can reach for them with one file picked or twenty.
Why the path matters as much as the code
A fenced block with no path is a puzzle with a piece missing. The reader has to work out the language from the syntax, wonder whether this is the app target or the test target, and ask which of the four files called config.swift you meant. The path answers all three in one line.
It matters more with an AI chat than with a person, because a person will ask and a chat will not. Given a path, a reply can name the file and tell you where a change goes. Given a bare block, it can only describe the change in the abstract.
Copying from a file you already have open
The Finder route is for files you have not opened. Once a file is a tab, the same jobs live on the tab's right-click menu and in the File menu:
- Copy to Clipboard on the tab context menu puts the document's text on the clipboard.
- Copy Path — ⌥⇧⌘C — puts the file's path there instead.
- Copy File Name and Copy Containing Folder Path cover the two narrower cases.
The three path items work on any file that has been saved: save an untitled tab once and all three light up for it. Copy to Clipboard asks even less of you — it is there on an untitled tab from the first character you type, and gives you whatever is in that tab at the moment you choose it, saved or not.
For several files at once, select the ones you want in the Finder and choose Concatenate & Open. They arrive as one document in a single tab, and Copy to Clipboard then takes the lot in one go — the whole selection on your clipboard in a single pass, rather than nine trips back to the Finder. Because it lands in a tab first, you can read it through and trim what the other person does not need before you copy it. It is the quickest way to hand somebody a set of related files at once.
Pasting the answer back in
Text that comes back out of a chat window rarely arrives clean. It brings debris with it: zero-width characters, non-breaking spaces, soft hyphens, stray bidirectional controls. None of it is visible. All of it turns up later in a diff, a failing search, or a build error on an identifier that reads perfectly on screen.
Note My's answer is one command with no dialog: Clean ▸ Clean AI Copy/Paste Markers, from the Clean button in the toolbar. It is also in the editor's own right-click menu, where the title reads …in Selection if you have text selected. With a selection it works on the selection; without one, on the whole document.
What it removes is deliberately narrow. It strips only artefacts that cannot change visible rendering, wording, tone, punctuation, indentation or emoji structure. Anything that would need a judgement call is counted, reported, and left exactly as it is. It reports back in a short toast, and there are four of them:
- "No hidden copy/paste markers found."
- "Some advanced Unicode markers were found but left unchanged for safety." — only judgement calls turned up, so nothing was changed.
- "Cleaned N hidden marker(s). Your text was not rewritten."
- "Cleaned N safe marker(s). R risky marker(s) left unchanged."
One ⌘Z puts the whole cleanup back, so you can run it, look at the result, and still change your mind. Line endings are tidied in one direction only: stray Windows line endings are brought into line with the rest of the file. It never converts LF to CRLF.
If you want to see everything rather than just the safe subset, Clean ▸ Clean Invisible / Special Characters… opens the Review All sheet — 21 categories, a preset pop-up carrying the four presets plus Custom, every finding listed by line, column and code point, and nothing applied until you press Apply. Our hidden-character scanner covers the whole document, whatever its size, so nothing is left off the list.
Reach for that sheet when the quick command says it has left something alone and you want to know what. Each finding is shown in place, so you can decide one at a time.
Cleaning on paste is off by default, and pasted text always arrives as plain characters rather than styled text — so a paste never brings formatting with it, and never silently rewrites what you pasted.
Troubleshooting
Bringing the "Note My ▸" submenu into the right-click menu
Switch the Finder extension on and the submenu is there. macOS keeps third-party Finder extensions off until you allow them, and a system update can switch one back off. Enable it in System Settings, or use the Enable… button on the Finder extension card in the welcome carousel — the badge flips to a green On as soon as the change takes, with no need to restart anything.
The submenu is showing the multi-file items
Copy Contents, Copy as Markdown Code Block and Copy for AI are the single-file commands, and the menu swaps in the multi-file verbs — Concatenate & Open, plus Compare the 2 Files when there are exactly two — as soon as your selection grows past one. Click once on the file you want and the three copy items are back where you left them.
The fence shows up as literal backticks
You have pasted into a field that treats Markdown as ordinary text. A fenced block is plain text with a convention attached, so a field that reads it literally shows the backticks. Use Copy Contents for those destinations and paste into whatever code field the tool provides — the same file, the same submenu, the first of the three copy items.
Pasting a very large answer back in
Our large-file engine handles the big ones, so even a very long answer lands whole. A very large paste shows a progress sheet with a Cancel button, so a paste you did not mean to start is one click away from stopping. With a very large document open, the status bar tells you that it is a large file; that note is there for information only, and there is nothing you need to do about it. If you are bringing back a long answer, paste it into a new tab rather than into the file you were working on.
The cleanup reported more than it changed
That is the design. Characters that are always wrong in a document go without asking. Characters whose meaning depends on the text around them are reported and left alone, because removing one can change what a line says. Open the Review All sheet if you want to work through those one at a time and decide yourself.
Taking the same file further
The clipboard is one destination among several. Open the file rather than copying from it and the rest of the app is there for it.
Our syntax engine colours 15 code languages, so a file you opened only to lift a few lines out of is readable the moment it arrives. That colouring travels, too. File ▸ Export As ▸ HTML with Syntax Highlighting… carries it out of the app intact, and RTF and PDF sit beside it in the same submenu. Reach for that route when the code has to look like code somewhere that is not a code field — a document, a deck, a page you are publishing, a print-out for a meeting.
If you would rather have the coloured markup on the clipboard itself, Copy as HTML and Copy as RTF are yours to switch on in the settings, and they take their place in the Edit menu as soon as you do. Left off, that menu stays short for the days when plain text is all you want; switched on, the coloured version is one menu item away, ready to drop into a document or a deck with its colouring intact. You decide which suits the way you work, and you can change your mind whenever the work changes.
When two files ought to match, select exactly two in the Finder and choose Compare the 2 Files. They open together in our comparison view, so you can see what moved before you copy anything at all — often the fastest way to work out which of the two is the one worth pasting. And when it is one passage you are after rather than a whole file, our find and replace puts you on it first, so the block that reaches the clipboard is the block you meant to send.
Frequently asked questions
Does "Copy for AI" send my file to an AI service?
It all happens on your Mac. Nothing is uploaded, there is no account, no telemetry and no service behind the app for anything to be sent to. The command puts text on your clipboard; every byte that leaves your Mac after that leaves because you pasted it somewhere.
Does copying change the file?
The file on disk is untouched: its modification date does not move, and nothing is written back to it. You get a copy of the text on your clipboard, and the original stays exactly as it was — which is why it is safe to use these commands on files you are not the owner of.
How do I copy several files at once?
Select them in the Finder and choose Concatenate & Open: they arrive as a single document in one tab. Copy to Clipboard from the tab's right-click menu then takes that document across in one paste — every file you picked, as a single run of text you can drop into a chat, an issue or a review.
How do I name the language on the opening fence?
Type it straight after the opening backticks once you have pasted — one word at the top of the block. The command is called "Copy for AI (path + fenced)" because the path and the fence are what it lays out for you, and most destinations read the block happily as it lands. Add the language tag when you want a particular dialect coloured a particular way.
How do I copy just the path of a file I already have open?
⌥⇧⌘C for Copy Path. Copy File Name and Copy Containing Folder Path sit beside it in the File menu and on the tab's right-click menu. Save an untitled tab once and all three are ready for it.
Does cleaning the pasted answer rewrite the wording?
Your wording comes through exactly as you pasted it. The command removes only characters that cannot change how the text renders — no wording, no tone, no punctuation, no indentation, no emoji structure. Anything else is counted and reported rather than touched. A single ⌘Z reverses the whole cleanup.