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.html115
1 files changed, 65 insertions, 50 deletions
diff --git a/build/macos-convert-to-html/index.html b/build/macos-convert-to-html/index.html
index f5a6cb9..86b9db8 100644
--- a/build/macos-convert-to-html/index.html
+++ b/build/macos-convert-to-html/index.html
@@ -1,97 +1,112 @@
<!doctype html>
-<html lang="en" id="top">
+<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" href="data:,">
<title>Convert Files to HTML with macOS Automator Quick Actions</title>
- <link href="https://bt.ht/atom.xml" type="application/atom+xml" rel="alternate" title="Atom feed for blog posts" />
- <style>*{box-sizing:border-box;}body{font-family:sans-serif;margin:0 auto;max-width:650px;padding:1rem;}img{max-width:100%;}pre{overflow:auto;}table{text-align:left;width:100%;}</style>
+ <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>
</head>
<nav>
- <a href="#menu">Menu &darr;</a>
+ <a href="#menu">Menu &darr;</a>
</nav>
<main>
-<h1>Convert Files to HTML with macOS Automator Quick Actions</h1>
+<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>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's get started!</p>
-<h2>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>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>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>
+
+<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>/bin/bash -c &quot;$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)&quot;
+
+<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'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>Installing Pandoc</h2>
+
+<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're done!</p>
-<h2>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><figure>
- <img src="/public/images/new-automator.png" alt="Toggle prompt for new automation in macOS Automator">
- <figcaption>After opening Automator, select "Quick Action" from the menu (<a href="/public/images/new-automator.webp">link to hi-res image</a>)</figcaption>
-</figure></p>
+
+<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 "Workflow receives current" to <strong>documents</strong> in <strong>any application</strong></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 <strong>/bin/bash</strong></li>
-<li>Set "Pass input" as <strong>as arguments</strong></li>
+<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>
+<li>Drag-and-drop the &#8220;Run Shell Script&#8221; from the left pane into the right pane</li>
+<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 "Run Shell Script" item:</p>
-<pre><code>for f in &quot;$@&quot;
+
+<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
-/opt/homebrew/bin/pandoc -o &quot;${f%.*}.html&quot; &quot;$f&quot;
+&#47;opt&#47;homebrew&#47;bin&#47;pandoc -o "${f%.*}.html" "$f"
done
</code></pre>
-<p>If you've done everything correctly it should look something like this:</p>
-<p><figure>
- <img src="/public/images/new-automator-2.png" alt="Automator quick action details for converting to HTML">
- <figcaption>This is what your finished Automator quick action should look like (<a href="/public/images/new-automator-2.webp">link to hi-res image</a>)</figcaption>
-</figure></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>Time to Convert</h2>
+
+<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><figure id="fig-1">
- <img src="/public/images/macos-convert-1.png" alt="A markdown file in macOS Finder">
- <figcaption><strong>Figure 1:</strong> Finding and right-clicking on your desired file (<a href="/public/images/macos-convert-1.webp">link to hi-res image</a>)</figcaption>
-</figure></p>
-<p><figure id="fig-2">
- <img src="/public/images/macos-convert-2.png" alt="Convert to HTML action selection">
- <figcaption><strong>Figure 2:</strong> From the "Quick Actions" menu, select "Convert to HTML" (<a href="/public/images/macos-convert-2.webp">link to hi-res image</a>)</figcaption>
-</figure></p>
+
<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>
-<p><figure>
- <img src="/public/images/macos-convert-3.png" alt="Finder window showing a Markdown file and an HTML file">
- <figcaption>Our converted document is now available in HTML. Absolutely glorious. (<a href="/public/images/macos-convert-3.webp">link to hi-res image</a>)</figcaption>
-</figure></p>
-<h2>No Limits</h2>
+
+<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>