Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ FROM ubuntu:18.04
ENV DEBIAN_FRONTEND=noninteractive

RUN apt update && \
apt install wget texlive-luatex texlive-lang-cjk lmodern texlive-xetex -y && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
apt install wget texlive-luatex texlive-lang-cjk lmodern texlive-xetex -y && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

RUN wget https://github.com/jgm/pandoc/releases/download/2.7.2/pandoc-2.7.2-1-amd64.deb && \
dpkg -i pandoc-2.7.2-1-amd64.deb && \
Expand Down
21 changes: 20 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,36 +15,54 @@ You can see example markdown file and converted PDF file from the link below👇
## Getting Started

1. Pull docker image.

```bash
$ docker pull plass/mdtopdf
```

⚠️ This docker image size is **1.68GB**. I recommend pulling it using the fast Internet connection.

2. Generate PDF file.

```bash
$ docker run -it --rm -v `pwd`:/workdir plass/mdtopdf mdtopdf INPUT.md
```

## Advanced Usages

### Generate 2 columns PDF file

```bash
$ docker run -it --rm -v `pwd`:/workdir plass/mdtopdf mdtopdf-2cols INPUT.md
```

### Generate PDF file on save

```bash
$ docker run -it --rm -v `pwd`:/workdir plass/mdtopdf w-mdtopdf INPUT.md
```

### Generate 2 columns PDF file on save

```bash
$ docker run -it --rm -v `pwd`:/workdir plass/mdtopdf w-mdtopdf-2cols INPUT.md
```

### Set alias

You can decrease typing using `alias` command as below,

```bash
$ echo "alias mdtopdf='docker run -it --rm -v `pwd`:/workdir plass/mdtopdf mdtopdf'" >> ~/.bash_profile
$ echo "alias mdtopdf-2cols='docker run -it --rm -v `pwd`:/workdir plass/mdtopdf mdtopdf-2cols'" >> ~/.bash_profile
$ echo "alias w-mdtopdf='docker run -it --rm -v `pwd`:/workdir plass/mdtopdf w-mdtopdf'" >> ~/.bash_profile
$ echo "alias w-mdtopdf-2cols='docker run -it --rm -v `pwd`:/workdir plass/mdtopdf w-mdtopdf-2cols'" >> ~/.bash_profile
$ source ~/.bash_profile

$ mdtopdf INPUT.md
$ mdtopdf-2cols INPUT.md
$ w-mdtopdf INPUT.md
$ w-mdtopdf-2cols INPUT.md
```

**zsh** : Modify `.zshrc` instead of `.bash_profile`.
Expand All @@ -54,4 +72,5 @@ $ w-mdtopdf INPUT.md

```bash
$ docker run -it --rm -v `pwd`:/workdir plass/mdtopdf mdtotex INPUT.md
$ docker run -it --rm -v `pwd`:/workdir plass/mdtopdf mdtotex-2cols INPUT.md
```
7 changes: 7 additions & 0 deletions scripts/mdtopdf-2cols
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash
str=$1
pandoc -s -N ${str%.*}.md -o ${str%.*}.pdf -V documentclass=ltjarticle --pdf-engine=lualatex \
-F pandoc-crossref \
-M "crossrefYaml=/config/crossref_config.yaml" \
-V geometry:margin=1in \
-V classoption=twocolumn
Comment on lines +1 to +7
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

examples/example.md に対して mdtopdf-2cols を実行するとエラーになるので、2カラム用のexampleも一緒に用意しといてくれると嬉しい。

内容はほぼ一緒で構わないので、コンパイル通るようにしてほしい

🤔.oO( docker run -it --rm -v `pwd`:/workdir plass/mdtopdf mdtopdf-2cols example.md
Error producing PDF.
! Package longtable Error: longtable not in 1-column mode.

See the longtable package documentation for explanation.
Type  H <return>  for immediate help.
 ...                                              
                                                  
l.202 \begin{longtable}

7 changes: 7 additions & 0 deletions scripts/mdtotex-2cols
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash
str=$1
pandoc -s -N ${str%.*}.md -o ${str%.*}.tex -V documentclass=ltjarticle --pdf-engine=lualatex \
-F pandoc-crossref \
-M "crossrefYaml=/config/crossref_config.yaml" \
-V geometry:margin=1in \
-V classoption=twocolumn
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

最後改行されていない

3 changes: 3 additions & 0 deletions scripts/w-mdtopdf-2cols
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#! /bin/bash

watcher $1 mdtopdf-2cols $1
3 changes: 3 additions & 0 deletions scripts/w-mdtotex-2cols
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#! /bin/bash

watcher $1 mdtotex-2cols $1