Skip to content

Extracts highlight annotations from a PDF file and prints them as Markdown quotes

License

Notifications You must be signed in to change notification settings

interstateone/highlights-to-markdown

Repository files navigation

highlights-to-markdown

Swift 5.1 Supported Platforms: macOS

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.

Usage

swift run h2m $PDF_PATH

or after installing somewhere in your $PATH:

h2m $PDF_PATH

Example Output

# 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

Installation

Homebrew

brew install interstateone/formulae/highlights-to-markdown

Manually

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

Finder Integration

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

About

Extracts highlight annotations from a PDF file and prints them as Markdown quotes

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published