Skip to content

Commit

Permalink
📝 Add conversion to reST
Browse files Browse the repository at this point in the history
  • Loading branch information
veit committed Oct 29, 2024
1 parent ccda3a2 commit 0993d5e
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ emergencies when we need to start branches for older versions.
`Unreleased <https://github.com/veit/python-basics-tutorial/compare/24.3.0...HEAD>`_
------------------------------------------------------------------------------------

Added
~~~~~
* 📝 Add conversion to reST

Changed
~~~~~~~

Expand Down
66 changes: 66 additions & 0 deletions docs/document/sphinx/convert.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
Convert
=======

Other file formats can be converted to :doc:`rest` with Pandoc.

Installation of Pandoc
----------------------

`Pandoc <https://pandoc.org/installing.html>`_ is a powerful document conversion
utility. We use it for simple conversions, but it is capable of much more.

Installation
------------

You can install Pandoc for the different platforms:

.. tab:: Debian/Ubuntu

.. code-block:: console
$ sudo apt install pandoc
.. tab:: macOS

.. code-block:: console
$ brew install pandoc
.. tab:: Windows

.. code-block:: ps1
$ choco install pandoc
.. seealso::
* `Installing pandoc <https://pandoc.org/installing.html>`_

Convert
-------

In the terminal, navigate to the directory containing the documents to be
converted. Then enter the command :samp:`pandoc -s --toc -f {INPUT_FORMAT} -t
rst {MYDOC}.{SUFFIX}`:

``-s``
creates an independent document
``--toc``
creates a table of contents (optional)
``-t``
creates a reStructuredText output
``-f``
tells Pandoc the input format. You can find an overview of the available
input formats in `General options
<https://pandoc.org/MANUAL.html#general-options>`_.

Correcting the converted document
---------------------------------

The extent of the correction for the converted document depends on the file
format you are converting from. Here are a few things you should pay attention
to:

* Multi-line titles must be converted to single-line titles
* Independent ``**`` characters
* :samp:`***BOLD***` should be :samp:`**BOLD**`
* Incorrect tables

0 comments on commit 0993d5e

Please sign in to comment.