Both sides previous revisionPrevious revision | |
articles:digital-publishing [2025/06/10 13:00] – ipek | articles:digital-publishing [2025/06/10 20:47] (current) – wgp |
---|
**[[https://pandoc.org|Pandoc]]** is a tool to convert one file format to another, like markdown, html, docx, rtf, txt, epub, LaTeX, PDF and many others. | **[[https://pandoc.org|Pandoc]]** is a tool to convert one file format to another, like markdown, html, docx, rtf, txt, epub, LaTeX, PDF and many others. |
| |
[[https://pandoc.org/installing.html|Installing Pandoc]] | Pandoc is available for a wide range of operating systems like Linux, Windows, MacOS, BSD, and as a Docker image. For installing Pandoc, see [[https://pandoc.org/installing.html|installation instruction]] for your desired platform. |
| |
Pandoc is a command-line tool, not a graphic user interface. But there is also a graphic user interface, the [[https://panwriter.com|Pan Writer]] tool, where you can write and see how it looks like in real life (more or less) and most importantly you can also convert files via the interface without using the command-line. But you need to install Pandoc nevertheless. | Pandoc is a command-line tool, and does not have a graphic user interface (GUI). The [[https://panwriter.com|PanWriter]] tool for macOS, Windows and Linux uses Pandoc together with a GUI, where you can write and see how it looks like in real life—more or less—and most importantly you can also convert files via the interface without using the command-line. To use PanWriter, you need to install Pandoc nevertheless. |
| |
**Building a blog-like website with pandoc**: | **Building a blog-like website with Pandoc**: |
| |
Using pandoc to create a website might not be the best way, however it can be an easy start, a very DIY ✂️ way of making a website, which you can always edit later on. This guide will show you how to make a start. | Using Pandoc to create a website might not be the best way, however it can be an easy start, a very DIY ✂️ way of making a website, which you can always edit later on. This guide will show you how to start. |
| |
**1)** You will create a doc file with your usual text editor program, Libre Office for example. You can insert tables to make your menu or buttons, you can even fill the page entirely with tables. Save it as .docx locally in your computer. You can write plain text, link texts to external websites and insert images. | **1.** You will create a .doc file with your usual text editor program, LibreOffice for example. You can insert tables to make your menu or buttons, you can even fill the page entirely with tables. Save it as .docx locally on your computer. You can write plain text, link texts to external websites and insert images. |
| |
**2)** Converting the .docx file via command line: | **2.** Now convert the .docx file to markdown via command line: |
<code> pandoc --extract-media=. -s file_name.docx -t markdown -o file_name.md </code> | <code> pandoc --extract-media=. -s file_name.docx -t markdown -o file_name.md </code> |
| |
extract media enables to extract the images and makes a folder for them. -s is the common Pandoc template that is being used in the markdown format. | Extract media enables to extract the images and makes a folder for them. -s is the common Pandoc template that is being used in the markdown format. |
| |
**3a)** Converting the markdown file into html is possible via the command-line and also via the PanWriter. Via the command line: | **3a.** Converting the markdown file into HTML is possible via the command-line and also via the PanWriter. Via the command line: |
<code> pandoc file_name.md -f markdown -t html -s -o file_name.html </code> | <code> pandoc file_name.md -f markdown -t html -s -o file_name.html </code> |
| |
Or you can export the markdown file to html via PanWriter. | Or you can export the markdown file to HTML via PanWriter. |
| |
An example of a html file converted from a .docx file: | An example of a HTML file converted from a .docx file: |
{{: pandoc_converted_example.png?700|}} | {{: pandoc_converted_example.png?700|}} |
| |
You can build your site even entirely out of tables and style them in your html file, here some [[https://www.w3schools.com/html/html_tables.asp|intro to building tables]]. | You can build your site even entirely out of tables and style them in your HTML file, here you can find some [[https://www.w3schools.com/html/html_tables.asp|introduction to building tables]]. |
| |
[[https://www.youtube.com/watch?v=e62D-aayveY&list=PLP9IO4UYNF0VdAajP_5pYG-jG2JRrG72s|HTML - Tables]] | [[https://www.youtube.com/watch?v=e62D-aayveY&list=PLP9IO4UYNF0VdAajP_5pYG-jG2JRrG72s|HTML - Tables]] |
| |
You can also [[https://smallsharpsoftwaretools.com/tutorials/create-html-from-multiple-markdown-files/|create a html file out of multiple markdown files]]. | You can also [[https://smallsharpsoftwaretools.com/tutorials/create-html-from-multiple-markdown-files/|create an HTML file out of multiple markdown files]]. |
| |
**3b)** Once you have a markdown file, you can convert the markdown file using a custom css file, that you can create yourself. For this, you can use this command: | **3b.** Once you have a markdown file, you can convert it to HTML using a custom CSS file, that you can create yourself. For this, you can use this command: |
| |
<code> | <code> |
</code> | </code> |
| |
Download an example css file to try it out: | Download this CSS file example to try it out: |
| |
<file CSS file style.css> | <file CSS file style.css> |