aboutsummaryrefslogtreecommitdiff
path: root/build/macos-convert-to-html/index.html
diff options
context:
space:
mode:
Diffstat (limited to 'build/macos-convert-to-html/index.html')
-rw-r--r--build/macos-convert-to-html/index.html37
1 files changed, 2 insertions, 35 deletions
diff --git a/build/macos-convert-to-html/index.html b/build/macos-convert-to-html/index.html
index 86b9db8..b45f0a2 100644
--- a/build/macos-convert-to-html/index.html
+++ b/build/macos-convert-to-html/index.html
@@ -3,11 +3,12 @@
<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;}img{max-width:100%;}pre{border:1px solid;overflow:auto;padding:5px;}table{text-align:left;width:100%;}.footnotes{font-size:90%;}</style>
+<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>
@@ -16,59 +17,37 @@
<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&#8217;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&#8217;s get started!</p>
-
<h2 id="the-dependencies">The Dependencies</h2>
-
<p>Unfortunately, setting things up isn&#8217;t as simple as clicking a single <code>Install</code> button and calling it a day. But don&#8217;t start to panic! I assure you everything we&#8217;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&#8217;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>&#47;bin&#47;bash -c "$(curl -fsSL https:&#47;&#47;raw.githubusercontent.com&#47;Homebrew&#47;install&#47;HEAD&#47;install.sh)"
</code></pre>
-
<p>Let that finish and you&#8217;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&#8217;re done!</p>
-
<h2 id="our-custom-automator-quick-action">Our Custom Automator Quick Action</h2>
-
<p>Next you&#8217;ll want to open the macOS Automator app and create a new &#8220;Quick Action&#8221; 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 &#8220;Workflow receives current&#8221; to documents in any application</li>
<li>In the search bar type in &#8220;Run Shell Script&#8221;</li>
@@ -76,37 +55,25 @@
<li>Set the &#8220;Shell&#8221; parameter to &#47;bin&#47;bash</li>
<li>Set &#8220;Pass input&#8221; as as arguments</li>
</ol>
-
<p>Once all that is done, simply paste the following in the open text field within the &#8220;Run Shell Script&#8221; item:</p>
-
<pre><code>for f in "$@"
do
&#47;opt&#47;homebrew&#47;bin&#47;pandoc -o "${f%.*}.html" "$f"
done
</code></pre>
-
<p>If you&#8217;ve done everything correctly it should look something like this:</p>
-
<p>Save this new Quick Action (Name is something like &#8220;Convert to HTML&#8221; to keep things simple). That&#8217;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&#8217;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>