Command-Line Tutorial ∞
Before you begin using polyglot you will need to populate some custom settings within the polyglot settings file.
To setup the default settings file at ~/.config/polyglot/polyglot.yaml
run the command:
polyglot init
This should create and open the settings file; follow the instructions in the file to populate the missing settings values (usually given an XXX
placeholder).
polyglot often relies on a bunch on other excellent tools to get it’s results like electron-pdf, pandoc and kidlegen. Depending on how you use polyglot, these tools may need to be install on your system.
To read the basic usage intructions just run polyglot -h
.
Webpage Article to HTML document ∞
To generate a parsed, cleaned local HTML document from a webpage at a given URL use polyglot’s html
command:
polyglot html https://en.wikipedia.org/wiki/Volkswagen
The filename for the output file is take from the webpage’s title and output in the current directory. Here’s the result.
To instead give both a destination output and a specified filename for the resulting document:
polyglot html https://en.wikipedia.org/wiki/Volkswagen ~/Desktop -f cars_and_stuff
To style the result with polyglots simple styling and easy to read fonts, use the -c
flag:
polyglot -c html https://en.wikipedia.org/wiki/Volkswagen -f Volkswagen_Styled
Webpage Article to PDF ∞
To instead print the webpage to PDF, you can either just print the original webpage:
polyglot pdf https://en.wikipedia.org/wiki/Volkswagen
with this result, or you can choose again to use polyglot’s styling:
polyglot -c pdf https://en.wikipedia.org/wiki/Volkswagen -f Volkswagen_Styled
Note if you are going to be running polyglot in a windowless environment, to generate the PDFs with electron-pdf <`https://github.com/fraserxu/electron-pdf
>`_ you will need to install xvfb. To install and setup do something similar to the following (depending on your flavour of OS):
sudo apt-get install xvfb
then in whatever bash scripts you write add this before any polyglot commands:
export DISPLAY=':99.0'
Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &
Webpage Article to eBook ∞
To generate an epub book from a webpage article run the command:
polyglot epub http://www.thespacedoctor.co.uk/blog/2016/09/26/mysqlSucker-index.html
Here is the output of this command.
If you prefer a mobi output, use the command:
polyglot mobi http://www.thespacedoctor.co.uk/blog/2016/09/26/mysqlSucker-index.html
To get this mobi book.
Send a Webpage Article Straight to Your Kindle ∞
Polyglot can go even further than creating a mobi ebook from the web-article; it can also send the ebook straight to your kindle device or smart phone app (or both at the same time) as long as you have the email settings populated in the polyglot settings file.
polyglot kindle http://www.thespacedoctor.co.uk/blog/2016/09/26/mysqlSucker-index.html
And here’s the book appearing on a smart phone kindle app:
Converting Kindle Notebook HTML Exports to Markdown ∞
On the Kindle app for iOS you can export an HTML document of your notes and annotations via email.
The colors of the annotation convert to markdown with the following color-key:
“blue”: “code”, “yellow”: “text”, “orange”: “quote”, “pink”: “header”
Todo
- add a tutorial to convert kindle annotations