After downloading a website as HTML with cURL or any other workflow, you can convert the HTML code to the Markdown syntax with pandoc
.
pandoc -o output.md input.html
Here's how I installed pandoc
on my MacBook Pro (13–inch, M1, 2020) to run with Rosetta 2 — not natively, but on the x86_64
architecture — until a universal binary for macOS is built that supports the arm64
architecture in new Appple Silicon Macs.
This guide may be used to install other non-universal brew packages.
# Install Homebrew for x86_64 architecture
# https://soffes.blog/homebrew-on-apple-silicon
arch -x86_64 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
# Install pandoc using that version of Homebrew
arch -x86_64 /usr/local/bin/brew install pandoc
Outputs
==> Downloading https://homebrew.bintray.com/bottles/pandoc-2.11.4.big_sur.bottle.tar.gz
Already downloaded: /Users/nono/Library/Caches/Homebrew/downloads/34e1528919e624583d70b1ef24381db17f730fc69e59144bf48abedc63656678--pandoc-2.11.4.big_sur.bottle.tar.gz
==> Pouring pandoc-2.11.4.big_sur.bottle.tar.gz
🍺 /usr/local/Cellar/pandoc/2.11.4: 10 files, 146.0MB
# Check pandoc's version
arch -x86_64 pandoc --version
Outputs
pandoc 2.11.4
Compiled with pandoc-types 1.22, texmath 0.12.1, skylighting 0.10.2,
citeproc 0.3.0.5, ipynb 0.1.0.1
User data directory: /Users/nono/.local/share/pandoc or /Users/nono/.pandoc
Copyright (C) 2006-2021 John MacFarlane. Web: https://pandoc.org
This is free software; see the source for copying conditions. There is no
warranty, not even for merchantability or fitness for a particular purpose.
arch -x86_64 pandoc sample.md -o sample.html
Contents of sample.md:
# Hello, Apple Silicon!
- Pandoc
- seems
- to
- work.
Contents of sample.html:
<h1 id="hello-apple-silicon">Hello, Apple Silicon!</h1>
<ul>
<li>Pandoc</li>
<li>seems</li>
<li>to</li>
<li>work.</li>
</ul>