Extracts highlight annotations from a PDF file and prints them as Markdown quotes.
The implementation is cross-platform but the h2m
executable is macOS-only.
swift run h2m $PDF_PATH
or after installing somewhere in your $PATH:
h2m $PDF_PATH
# Objectives and constraints
> You realize that things that seem grossly subopitmal are actually close to optimal when you consider the necessary constraints.
– Page 1
> If I ask “Why hasn’t someone done this before?” I’m skeptical if the answer is “Because I’m smarter than everyone else who has tried.” But if the answer is “Because constraints have changed” then I’m much more receptive.
– Page 2
brew install interstateone/formulae/highlights-to-markdown
git clone https://github.com/interstateone/highlights-to-markdown.git
cd highlights-to-markdown
make install
swift build -c release
cp `swift build -c release --show-bin-path`/h2m $DESTINATION
Create a Quick Action in Automator and invoke h2m with Applescript:
on run {input, parameters}
set pdf to POSIX path of input
set markdown to (do shell script "/path/to/h2m '" & pdf & "'")
set the clipboard to markdown
end run