HUB
Sign inSign up
pandoc logo

devopstestlab/pandoc

By devopstestlab

•Updated almost 7 years ago

Image
0

354

devopstestlab/pandoc repository overview

⁠Image Docker docker-pandoc

⁠Build

docker build -t devopstestlab/pandoc .

⁠Usage

Créer un alias :

alias pandoc='docker run -ti --rm -v ${PWD}:/source --rm devopstestlab/pandoc'

Affichier la version de Pandoc :

pandoc -v

Vérifier que l'installation est correcte :

pandoc input/test.md -f markdown -t html -s -o output/test.html

pandoc input/test.md -s -o output/test.pdf

⁠Changer le template de markdown

Créer le template par défaut pour le markdown :

pandoc --print-default-template=markdown > generated/template.markdown
cat generated/template.markdown
pandoc -D html > generated/template.html

Pour ajouter un titre en haut de la table des matières, utilisez la variable de template toc-title dans le bloc "toc" du template :

$if(toc)$
$if(toc-title)$
# $toc-title$
$endif$
$toc$
$endif$

ls

pandoc --toc --toc-depth=3 --variable toc-title="Table des matières" --template=generated/template.markdown -o output/test-with-toc.txt input/test.txt

pandoc --toc -V "toc-title:Table desmatières" --template=generated/template.markdown -o output/test-with-toc.md input/test.md

La table des matières est maintenant générée avec le titre "Table des matières" :

example-with-toc.md file an auto-generated Table of Contents with a # Table of Contents title over it.

NOTE: if you also include some extra markdown contents with the --include-before-body option (eg: --include-before-body=somefile.md) the contents of the included file will go before the TOC (at least, with the template used in this example) and any headings it contains will not be included in the TOC — ie: the TOC only indexes what comes after the $toc$ template tag. This is useful if you'd like to include an Abstract before the TOC.

⁠Examples de conversions

Conversion en HTML :

pandoc -s --toc -c include/pandoc.css -A include/footer.html -o output/test.html input/test.txt

Conversion en RTF :

pandoc -s input/test.txt -o output/test.rtf

Conversion en Word :

pandoc input/test.txt -o output/test.docx

Conversion de Word en markdown :

pandoc -s input/test.docx -t markdown -o output/test.md

Conversion en epub :

pandoc input/test.txt -o output/test.epub

Conversion en Markdown Git :

pandoc -t gfm input/test.txt -o output/test.md

Conversion de slides :

pandoc -s --webtex -i -t revealjs input/slides.txt -o output/test.html

pandoc -t beamer input/slides.txt -o output/test.pdf

⁠Création de tableaux

| One | Two   |
|-----+-------|
| my  | table |
| is  | nice  |

-------     ------ ----------   -------
     12     12        12             12
    123     123       123           123
      1     1          1              1
-------     ------ ----------   -------

-------------------------------------------------------------
 Centered   Default           Right Left
  Header    Aligned         Aligned Aligned
----------- ------- --------------- -------------------------
   First    row                12.0 Example of a row that
                                    spans multiple lines.

  Second    row                 5.0 Here's another one. Note
                                    the blank line between
                                    rows.
-------------------------------------------------------------

Table: Here's the caption. It, too, may span
multiple lines.

fruit| price
-----|-----:
apple|2.05
pear|1.37
orange|3.09

Tag summary

Content type

Image

Digest

Size

2.1 GB

Last updated

almost 7 years ago

docker pull devopstestlab/pandoc