Add ConvertToMarkdown Automator Quick Action
Finder service that converts files to Markdown using pandoc. Supports all pandoc input formats with macOS notifications. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
31
ConvertToMarkdown.workflow/Contents/Info.plist
Normal file
31
ConvertToMarkdown.workflow/Contents/Info.plist
Normal file
@@ -0,0 +1,31 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>NSServices</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>NSBackgroundColorName</key>
|
||||
<string>background</string>
|
||||
<key>NSIconName</key>
|
||||
<string>NSActionTemplate</string>
|
||||
<key>NSMenuItem</key>
|
||||
<dict>
|
||||
<key>default</key>
|
||||
<string>ConvertToMarkdown</string>
|
||||
</dict>
|
||||
<key>NSMessage</key>
|
||||
<string>runWorkflowAsService</string>
|
||||
<key>NSRequiredContext</key>
|
||||
<dict>
|
||||
<key>NSApplicationIdentifier</key>
|
||||
<string>com.apple.finder</string>
|
||||
</dict>
|
||||
<key>NSSendFileTypes</key>
|
||||
<array>
|
||||
<string>public.content</string>
|
||||
</array>
|
||||
</dict>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
||||
BIN
ConvertToMarkdown.workflow/Contents/QuickLook/Preview.png
Normal file
BIN
ConvertToMarkdown.workflow/Contents/QuickLook/Preview.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 160 KiB |
BIN
ConvertToMarkdown.workflow/Contents/QuickLook/Thumbnail.png
Normal file
BIN
ConvertToMarkdown.workflow/Contents/QuickLook/Thumbnail.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.5 KiB |
403
ConvertToMarkdown.workflow/Contents/document.wflow
Normal file
403
ConvertToMarkdown.workflow/Contents/document.wflow
Normal file
@@ -0,0 +1,403 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>AMApplicationBuild</key>
|
||||
<string>528</string>
|
||||
<key>AMApplicationVersion</key>
|
||||
<string>2.10</string>
|
||||
<key>AMDocumentVersion</key>
|
||||
<string>2</string>
|
||||
<key>actions</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>action</key>
|
||||
<dict>
|
||||
<key>AMAccepts</key>
|
||||
<dict>
|
||||
<key>Container</key>
|
||||
<string>List</string>
|
||||
<key>Optional</key>
|
||||
<true/>
|
||||
<key>Types</key>
|
||||
<array>
|
||||
<string>com.apple.cocoa.path</string>
|
||||
</array>
|
||||
</dict>
|
||||
<key>AMActionVersion</key>
|
||||
<string>1.1.2</string>
|
||||
<key>AMApplication</key>
|
||||
<array>
|
||||
<string>Finder</string>
|
||||
</array>
|
||||
<key>AMParameterProperties</key>
|
||||
<dict>
|
||||
<key>fileNames</key>
|
||||
<dict/>
|
||||
</dict>
|
||||
<key>AMProvides</key>
|
||||
<dict>
|
||||
<key>Container</key>
|
||||
<string>List</string>
|
||||
<key>Types</key>
|
||||
<array>
|
||||
<string>com.apple.cocoa.path</string>
|
||||
</array>
|
||||
</dict>
|
||||
<key>ActionBundlePath</key>
|
||||
<string>/System/Library/Automator/Get Specified Finder Items.action</string>
|
||||
<key>ActionName</key>
|
||||
<string>Get Specified Finder Items</string>
|
||||
<key>ActionParameters</key>
|
||||
<dict>
|
||||
<key>fileNames</key>
|
||||
<array>
|
||||
<string>~/Documents/git/all-to-md/SUPPLY AGREEMENT as of 4th Feb 2025 2.docx</string>
|
||||
</array>
|
||||
</dict>
|
||||
<key>BundleIdentifier</key>
|
||||
<string>com.apple.Automator.SpecifiedFiles</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1.1.2</string>
|
||||
<key>CanShowSelectedItemsWhenRun</key>
|
||||
<false/>
|
||||
<key>CanShowWhenRun</key>
|
||||
<true/>
|
||||
<key>Category</key>
|
||||
<array>
|
||||
<string>AMCategoryFilesAndFolders</string>
|
||||
</array>
|
||||
<key>Class Name</key>
|
||||
<string>SpecifiedFilesAction</string>
|
||||
<key>InputUUID</key>
|
||||
<string>F2C0BBD2-5ED4-4558-A428-93EB713B8828</string>
|
||||
<key>Keywords</key>
|
||||
<array>
|
||||
<string>File</string>
|
||||
<string>Choose</string>
|
||||
<string>Find</string>
|
||||
<string>Get</string>
|
||||
</array>
|
||||
<key>OutputUUID</key>
|
||||
<string>ACDCFBFA-A60E-4906-BC57-C7C3376F95F2</string>
|
||||
<key>UUID</key>
|
||||
<string>CC25BC39-428E-414D-9E88-949F159D465C</string>
|
||||
<key>UnlocalizedApplications</key>
|
||||
<array>
|
||||
<string>Finder</string>
|
||||
</array>
|
||||
<key>arguments</key>
|
||||
<dict>
|
||||
<key>0</key>
|
||||
<dict>
|
||||
<key>default value</key>
|
||||
<array/>
|
||||
<key>name</key>
|
||||
<string>fileNames</string>
|
||||
<key>required</key>
|
||||
<string>0</string>
|
||||
<key>type</key>
|
||||
<string>0</string>
|
||||
<key>uuid</key>
|
||||
<string>0</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>conversionLabel</key>
|
||||
<integer>0</integer>
|
||||
<key>isViewVisible</key>
|
||||
<integer>1</integer>
|
||||
<key>location</key>
|
||||
<string>406.000000:360.000000</string>
|
||||
<key>nibPath</key>
|
||||
<string>/System/Library/Automator/Get Specified Finder Items.action/Contents/Resources/Base.lproj/main.nib</string>
|
||||
</dict>
|
||||
<key>isViewVisible</key>
|
||||
<integer>1</integer>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>action</key>
|
||||
<dict>
|
||||
<key>AMAccepts</key>
|
||||
<dict>
|
||||
<key>Container</key>
|
||||
<string>List</string>
|
||||
<key>Optional</key>
|
||||
<true/>
|
||||
<key>Types</key>
|
||||
<array>
|
||||
<string>com.apple.cocoa.string</string>
|
||||
</array>
|
||||
</dict>
|
||||
<key>AMActionVersion</key>
|
||||
<string>2.0.3</string>
|
||||
<key>AMApplication</key>
|
||||
<array>
|
||||
<string>Automator</string>
|
||||
</array>
|
||||
<key>AMParameterProperties</key>
|
||||
<dict>
|
||||
<key>COMMAND_STRING</key>
|
||||
<dict/>
|
||||
<key>CheckedForUserDefaultShell</key>
|
||||
<dict/>
|
||||
<key>inputMethod</key>
|
||||
<dict/>
|
||||
<key>shell</key>
|
||||
<dict/>
|
||||
<key>source</key>
|
||||
<dict/>
|
||||
</dict>
|
||||
<key>AMProvides</key>
|
||||
<dict>
|
||||
<key>Container</key>
|
||||
<string>List</string>
|
||||
<key>Types</key>
|
||||
<array>
|
||||
<string>com.apple.cocoa.string</string>
|
||||
</array>
|
||||
</dict>
|
||||
<key>ActionBundlePath</key>
|
||||
<string>/System/Library/Automator/Run Shell Script.action</string>
|
||||
<key>ActionName</key>
|
||||
<string>Run Shell Script</string>
|
||||
<key>ActionParameters</key>
|
||||
<dict>
|
||||
<key>COMMAND_STRING</key>
|
||||
<string>export PATH="/opt/homebrew/bin:/usr/local/bin:$PATH"
|
||||
|
||||
SUPPORTED_EXTENSIONS=(
|
||||
adoc asciidoc asc
|
||||
bib
|
||||
creole
|
||||
csv tsv
|
||||
djot
|
||||
docx
|
||||
epub
|
||||
fb2
|
||||
htm html xhtml
|
||||
ipynb
|
||||
json
|
||||
tex latex ltx
|
||||
md markdown mkd mdown
|
||||
lhs
|
||||
muse
|
||||
odt
|
||||
opml
|
||||
org
|
||||
pod
|
||||
pptx
|
||||
ris
|
||||
rst
|
||||
rtf
|
||||
t2t
|
||||
textile
|
||||
typ
|
||||
xlsx
|
||||
xml dbk
|
||||
)
|
||||
|
||||
is_supported() {
|
||||
local ext="${${1##*.}:l}"
|
||||
for e in "${SUPPORTED_EXTENSIONS[@]}"; do
|
||||
[[ "$e" == "$ext" ]] && return 0
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
for f in "$@"; do
|
||||
dir=$(dirname "$f")
|
||||
base=$(basename "$f")
|
||||
name="${base%.*}"
|
||||
ext="${${base##*.}:l}"
|
||||
output="$dir/$name.md"
|
||||
|
||||
if [[ "$ext" == "md" || "$ext" == "markdown" ]]; then
|
||||
osascript -e "display notification \"Already Markdown: $base\" with title \"Convert to Markdown\""
|
||||
continue
|
||||
fi
|
||||
|
||||
if ! is_supported "$base"; then
|
||||
osascript -e "display notification \"Unsupported format: .$ext\" with title \"Convert to Markdown\""
|
||||
continue
|
||||
fi
|
||||
|
||||
if pandoc "$f" -o "$output" 2>/tmp/pandoc_err; then
|
||||
osascript -e "display notification \"Saved: $name.md\" with title \"Convert to Markdown\" sound name \"Glass\""
|
||||
else
|
||||
err=$(head -1 /tmp/pandoc_err)
|
||||
osascript -e "display notification \"Error: $err\" with title \"Convert to Markdown\""
|
||||
fi
|
||||
done
|
||||
</string>
|
||||
<key>CheckedForUserDefaultShell</key>
|
||||
<true/>
|
||||
<key>inputMethod</key>
|
||||
<integer>1</integer>
|
||||
<key>shell</key>
|
||||
<string>/bin/zsh</string>
|
||||
<key>source</key>
|
||||
<string></string>
|
||||
</dict>
|
||||
<key>BundleIdentifier</key>
|
||||
<string>com.apple.RunShellScript</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>2.0.3</string>
|
||||
<key>CanShowSelectedItemsWhenRun</key>
|
||||
<false/>
|
||||
<key>CanShowWhenRun</key>
|
||||
<true/>
|
||||
<key>Category</key>
|
||||
<array>
|
||||
<string>AMCategoryUtilities</string>
|
||||
</array>
|
||||
<key>Class Name</key>
|
||||
<string>RunShellScriptAction</string>
|
||||
<key>InputUUID</key>
|
||||
<string>B4A77AFE-5A69-4A47-9A73-29F1FD3F3CF2</string>
|
||||
<key>Keywords</key>
|
||||
<array>
|
||||
<string>Shell</string>
|
||||
<string>Script</string>
|
||||
<string>Command</string>
|
||||
<string>Run</string>
|
||||
<string>Unix</string>
|
||||
</array>
|
||||
<key>OutputUUID</key>
|
||||
<string>C8A9D9E2-1234-4567-8901-ABCDEF012345</string>
|
||||
<key>UUID</key>
|
||||
<string>A1B2C3D4-E5F6-7890-ABCD-EF1234567890</string>
|
||||
<key>UnlocalizedApplications</key>
|
||||
<array>
|
||||
<string>Automator</string>
|
||||
</array>
|
||||
<key>arguments</key>
|
||||
<dict>
|
||||
<key>0</key>
|
||||
<dict>
|
||||
<key>default value</key>
|
||||
<integer>0</integer>
|
||||
<key>name</key>
|
||||
<string>inputMethod</string>
|
||||
<key>required</key>
|
||||
<string>0</string>
|
||||
<key>type</key>
|
||||
<string>0</string>
|
||||
<key>uuid</key>
|
||||
<string>0</string>
|
||||
</dict>
|
||||
<key>1</key>
|
||||
<dict>
|
||||
<key>default value</key>
|
||||
<false/>
|
||||
<key>name</key>
|
||||
<string>CheckedForUserDefaultShell</string>
|
||||
<key>required</key>
|
||||
<string>0</string>
|
||||
<key>type</key>
|
||||
<string>0</string>
|
||||
<key>uuid</key>
|
||||
<string>1</string>
|
||||
</dict>
|
||||
<key>2</key>
|
||||
<dict>
|
||||
<key>default value</key>
|
||||
<string></string>
|
||||
<key>name</key>
|
||||
<string>source</string>
|
||||
<key>required</key>
|
||||
<string>0</string>
|
||||
<key>type</key>
|
||||
<string>0</string>
|
||||
<key>uuid</key>
|
||||
<string>2</string>
|
||||
</dict>
|
||||
<key>3</key>
|
||||
<dict>
|
||||
<key>default value</key>
|
||||
<string></string>
|
||||
<key>name</key>
|
||||
<string>COMMAND_STRING</string>
|
||||
<key>required</key>
|
||||
<string>0</string>
|
||||
<key>type</key>
|
||||
<string>0</string>
|
||||
<key>uuid</key>
|
||||
<string>3</string>
|
||||
</dict>
|
||||
<key>4</key>
|
||||
<dict>
|
||||
<key>default value</key>
|
||||
<string>/bin/sh</string>
|
||||
<key>name</key>
|
||||
<string>shell</string>
|
||||
<key>required</key>
|
||||
<string>0</string>
|
||||
<key>type</key>
|
||||
<string>0</string>
|
||||
<key>uuid</key>
|
||||
<string>4</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>isViewVisible</key>
|
||||
<true/>
|
||||
<key>location</key>
|
||||
<string>406.000000:542.000000</string>
|
||||
<key>nibPath</key>
|
||||
<string>/System/Library/Automator/Run Shell Script.action/Contents/Resources/Base.lproj/main.nib</string>
|
||||
</dict>
|
||||
<key>isViewVisible</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</array>
|
||||
<key>connectors</key>
|
||||
<dict>
|
||||
<key>ECA4817A-970E-4276-B8FC-E9D13303C0B2</key>
|
||||
<dict>
|
||||
<key>from</key>
|
||||
<string>CC25BC39-428E-414D-9E88-949F159D465C - CC25BC39-428E-414D-9E88-949F159D465C</string>
|
||||
<key>to</key>
|
||||
<string>A1B2C3D4-E5F6-7890-ABCD-EF1234567890 - A1B2C3D4-E5F6-7890-ABCD-EF1234567890</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>workflowMetaData</key>
|
||||
<dict>
|
||||
<key>applicationBundleID</key>
|
||||
<string>com.apple.finder</string>
|
||||
<key>applicationBundleIDsByPath</key>
|
||||
<dict>
|
||||
<key>/System/Library/CoreServices/Finder.app</key>
|
||||
<string>com.apple.finder</string>
|
||||
</dict>
|
||||
<key>applicationPath</key>
|
||||
<string>/System/Library/CoreServices/Finder.app</string>
|
||||
<key>applicationPaths</key>
|
||||
<array>
|
||||
<string>/System/Library/CoreServices/Finder.app</string>
|
||||
</array>
|
||||
<key>inputTypeIdentifier</key>
|
||||
<string>com.apple.Automator.fileSystemObject.document</string>
|
||||
<key>outputTypeIdentifier</key>
|
||||
<string>com.apple.Automator.nothing</string>
|
||||
<key>presentationMode</key>
|
||||
<integer>15</integer>
|
||||
<key>processesInput</key>
|
||||
<false/>
|
||||
<key>serviceApplicationBundleID</key>
|
||||
<string>com.apple.finder</string>
|
||||
<key>serviceApplicationPath</key>
|
||||
<string>/System/Library/CoreServices/Finder.app</string>
|
||||
<key>serviceInputTypeIdentifier</key>
|
||||
<string>com.apple.Automator.fileSystemObject.document</string>
|
||||
<key>serviceOutputTypeIdentifier</key>
|
||||
<string>com.apple.Automator.nothing</string>
|
||||
<key>serviceProcessesInput</key>
|
||||
<false/>
|
||||
<key>systemImageName</key>
|
||||
<string>NSActionTemplate</string>
|
||||
<key>useAutomaticInputType</key>
|
||||
<false/>
|
||||
<key>workflowTypeIdentifier</key>
|
||||
<string>com.apple.Automator.servicesMenu</string>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
||||
Reference in New Issue
Block a user