diff options
author | Bradley Taunt <bt@btxx.org> | 2024-06-10 09:41:25 -0400 |
---|---|---|
committer | Bradley Taunt <bt@btxx.org> | 2024-06-10 09:41:25 -0400 |
commit | 07e4a2dafe248280b5610f8c7d09b0f30b530f54 (patch) | |
tree | 8a145d1d4d07e1278a837ff15dadccc322d27515 /build/macos-convert-to-html | |
parent | 16d28628aca9b2d356de31c319f5e7bc0f5b2b02 (diff) |
Initial modifications to rebuilt only changed files based on mod date, performance updates
Diffstat (limited to 'build/macos-convert-to-html')
-rw-r--r-- | build/macos-convert-to-html/index.html | 98 |
1 files changed, 0 insertions, 98 deletions
diff --git a/build/macos-convert-to-html/index.html b/build/macos-convert-to-html/index.html deleted file mode 100644 index b45f0a2..0000000 --- a/build/macos-convert-to-html/index.html +++ /dev/null @@ -1,98 +0,0 @@ -<!doctype html> -<html lang="en"> -<head> - <meta charset="utf-8"> - <meta name="viewport" content="width=device-width, initial-scale=1"> - <meta name="color-scheme" content="dark light"> - <link rel="icon" href="data:,"> - <title>Convert Files to HTML with macOS Automator Quick Actions</title> - <link href="/atom.xml" type="application/atom+xml" rel="alternate" title="Atom feed for blog posts" /> - <link href="/rss.xml" type="application/rss+xml" rel="alternate" title="RSS feed for blog posts" /> -<style>*{box-sizing:border-box;}body{font-family:sans-serif;line-height:1.33;margin:0 auto;max-width:650px;padding:1rem;}blockquote{background:rgba(0,0,0,0.1);border-left:4px solid;padding-left:5px;}img{max-width:100%;}pre{border:1px solid;overflow:auto;padding:5px;}table{text-align:left;width:100%;}.footnotes{font-size:90%;}</style> -</head> - -<nav> - <a href="#menu">Menu ↓</a> -</nav> - -<main> -<h1 id="convert-files-to-html-with-macos-automator-quick-actions">Convert Files to HTML with macOS Automator Quick Actions</h1> -<p>2022-01-28</p> -<p>Since a few people have reached out and thanked me for my previous post <a href="/batch-webp-conversion">Batch Converting Images to webp with macOS Automator</a>, I thought I would continue to share more of my own custom Automator Quick Actions. Today’s post will cover the ability to convert <em>any</em> text-based document into pure HTML.</p> -<p>I know - there are over 6 billion conversion apps that do this very same thing. But our way of doing it is <em>cooler</em>. Our conversion tool:</p> -<ul> -<li>Will run directly inside macOS Finder (right-click actions FTW)</li> -<li>Can batch convert multiple files at once</li> -<li>Can convert mixed files types at the same time</li> -</ul> -<p>And it can do all of this for free on your existing macOS system. No apps required. So, enough chit-chat, let’s get started!</p> -<h2 id="the-dependencies">The Dependencies</h2> -<p>Unfortunately, setting things up isn’t as simple as clicking a single <code>Install</code> button and calling it a day. But don’t start to panic! I assure you everything we’ll be doing is actually quite easy to breeze through - <em>trust me</em>.</p> -<p>Our main requirements will consistent of the following:</p> -<ul> -<li>Homebrew</li> -<li>Pandoc</li> -<li>Ability to open Terminal</li> -</ul> -<h2 id="installing-homebrew">Installing Homebrew</h2> -<p>Homebrew is a simple package manager for macOS. The beauty of having Homebrew is the flexibility in the future for installing other custom packages. Overall it’s just a nice piece of software to have on your machine.</p> -<p>If you have already installed Homebrew in the past, ignore this step and continue down the page. If not, simply open your Terminal and run:</p> -<pre><code>/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" -</code></pre> -<p>Let that finish and you’re done! Also feel free to read more about Homebrew on the <a href="https://brew.sh">official website</a>. Knowledge is power!</p> -<h2 id="installing-pandoc">Installing Pandoc</h2> -<p>The package that is going to be doing all the heavy-lifting for us is <a href="https://pandoc.org">pandoc</a>. Because we have Homebrew on our machine now, installing this package is as simple as opening our Terminal again and running:</p> -<pre><code>brew install pandoc -</code></pre> -<p>Wait for everything to finish and you’re done!</p> -<h2 id="our-custom-automator-quick-action">Our Custom Automator Quick Action</h2> -<p>Next you’ll want to open the macOS Automator app and create a new “Quick Action” when given the prompt to do so.</p> -<p>Now do the following (reference the image further below to make sure your parameters match):</p> -<ol> -<li>Set “Workflow receives current” to documents in any application</li> -<li>In the search bar type in “Run Shell Script”</li> -<li>Drag-and-drop the “Run Shell Script” from the left pane into the right pane</li> -<li>Set the “Shell” parameter to /bin/bash</li> -<li>Set “Pass input” as as arguments</li> -</ol> -<p>Once all that is done, simply paste the following in the open text field within the “Run Shell Script” item:</p> -<pre><code>for f in "$@" -do -/opt/homebrew/bin/pandoc -o "${f%.*}.html" "$f" -done -</code></pre> -<p>If you’ve done everything correctly it should look something like this:</p> -<p>Save this new Quick Action (Name is something like “Convert to HTML” to keep things simple). That’s it! Amazing, right?</p> -<h2 id="time-to-convert">Time to Convert</h2> -<p>Now it is finally time to see our Quick Action is <em>action</em>! Navigate to any document file in a Finder window and follow along.</p> -<ol> -<li>First, right-click on the file you wish to convert. (<a href="#fig-1">Figure 1</a>)</li> -<li>In the pop-up container, scroll down and hover over <code>Quick Actions</code>.</li> -<li>A secondary pop-out will appear. Look for the action <code>Convert File to HTML</code> and click it. (<a href="#fig-2">Figure 2</a>)</li> -</ol> -<p>If everything was set up properly (and depending on the size of the file) you should see your converted HTML file show up right next to your existing document. Time to celebrate!</p> -<p>Don’t forget - you can also <em>batch</em> convert multiple files and multiple file <em>types</em> at once. The possibilities are endless!</p> -<h2 id="no-limits">No Limits</h2> -<p>Although this article has mainly focused on converting documents to HTML, <code>pandoc</code> is so powerful you could do any number of conversions. Re-using these steps above, you have the ability to make as many different conversion quick actions as your heart desires!</p> -<p>Have fun converting!</p> -<footer role="contentinfo"> - <h2>Menu Navigation</h2> - <ul id="menu"> - <li><a href="/">Home</a></li> - <li><a href="/projects">Projects</a></li> - <li><a href="/uses">Uses</a></li> - <li><a href="/wiki">Wiki</a></li> - <li><a href="/resume">Resume</a></li> - <li><a href="/colophon">Colophon</a></li> - <li><a href="/now">Now</a></li> - <li><a href="/donate">Donate</a></li> - <li><a href="/atom.xml">RSS</a></li> - <li><a href="#top">↑ Top of the page</a></li> - </ul> - <small> - Built with <a href="https://git.sr.ht/~bt/barf">barf</a>. <br> - Maintained with ♥ for the web. <br> - Proud supporter of <a href="https://usefathom.com/ref/DKHJVX">Fathom</a> & <a href="https://nextdns.io/?from=74d3p3h8">NextDNS</a>. <br> - The content for this site is <a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>.<br> The <a href="https://git.sr.ht/~bt/bt.ht">code for this site</a> is <a href="https://git.sr.ht/~bt/bt.ht/tree/master/item/LICENSE">MIT</a>. - </small> -</footer>
\ No newline at end of file |