diff options
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | README.gd | 65 | ||||
-rw-r--r-- | README.md | 80 | ||||
-rw-r--r-- | README.pdf | bin | 0 -> 29333 bytes | |||
-rwxr-xr-x | groffdown | 11 | ||||
-rw-r--r-- | sample.md | 24 |
6 files changed, 118 insertions, 63 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a136337 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +*.pdf diff --git a/README.gd b/README.gd new file mode 100644 index 0000000..df3d0d0 --- /dev/null +++ b/README.gd @@ -0,0 +1,65 @@ +--- +title: Groffdown +author: Benjamin Chausse +date: 2019-09-19 +Markdown syntax with GNU/Troff-like compilation speeds. +--- + + +# What is Groffdown? +Groffdown aims to take the already existing (and well-known) +markdown syntax and make it compile at speed similar to the +ones of groff. The main compiler for markdown to pdf usually +being `pandoc`, it can be quite long to compile a document (up +to four seconds for one page documents +in some cases) unlike Groff which is known +to usually compile very quickly (0.1 second on average for +one page documents). As a proof of concept, this *README* +pages can be fully compiled using groffdown to then be used by groff. + +# Example piping workflow +Groffdown is a script which when run on a markdown document, +will convert the most typical markdown syntax into groff +(using the `ms` macros) to then send it to standard output. +Therefore, it can be piped directly into groff (or +it's related software). Here is an example of a complete piping +command: + +- groffdown <filename>.gd | refer -PS -e "-p$REFERBIB" | groff -me -ms -kejpt -T pdf > <filename>.pdf + +# Syntax goals +- Speed +- Markdown Syntax (with yaml preamble) +- LaTeX where markdown lacks + + +## Existing Syntax + +### Commands similar to markdown +- Headers (1-5) +- *Italic* +- **Bold** +- ***Bold & Italic*** +- Bullet points +- `Code blocks (in a monospaced font)` + +### Commands similar to LaTeX +- Abstract +- Inline equations +- Centered equations +- Citations + +### Commands similar to YAML +- Titles +- Authors +- Dates +- Author's Institution + +# Current issues +- All text formatings need to be on the same line (you can't start bold + on one line and finish on the other) Doing otherwise seems to trigger + an unescapable recursive loop on the groff side of things. + +# Needed implementations +- Numbered lists +- multi-macro compatibility (mom macros for urls) @@ -1,7 +1,12 @@ -# Groffdown +--- +title: Groffdown +author: Benjamin Chausse +date: 2019-09-19 Markdown syntax with GNU/Troff-like compilation speeds. +--- ## What is Groffdown? + Groffdown aims to take the already existing (and well-known) markdown syntax and make it compile at speed similar to the ones of groff. The main compiler for markdown to pdf usually @@ -9,49 +14,52 @@ being `pandoc`, it can be quite long to compile a document (up to four seconds for one page documents in some cases) unlike Groff which is known to usually compile very quickly (0.1 second on average for -one page documents). +one page documents). As a proof of concept, this *README* +pages can be fully compiled using groffdown to then be used by groff. -Groffdown is a script that when ran on a markdown document, +# Example piping workflow +Groffdown is a script which when run on a markdown document, will convert the most typical markdown syntax into groff -(using the `ms` macros) to then output it to a `.ms` file. - -At a later stage, the goal will be to output groffdown -as standard output (sdout). Since I am not aware if the -`refer` groff pre-processor can accept standard input -(sdin), I prefer to keep it at that for the moment. +(using the `ms` macros) to then send it to standard output. +Therefore, it can be piped directly into groff (or +it's related software). Here is an example of a complete piping +command: -## Syntax goals +- groffdown <filename>.gd | refer -PS -e "-p$REFERBIB" | groff -me -ms -kejpt -T pdf > <filename>.pdf -1. Speed -2. Markdown Syntax (with yaml preamble) -3. LaTeX where markdown lacks +# Syntax goals +- Speed +- Markdown Syntax (with yaml preamble) +- LaTeX where markdown lacks ## Existing Syntax -| Description | Command | `.md` | `.tex` | `YAML-like` | -|----------------------|-------------------------------------|-------|--------|-------------| -| Headers (1-5) | `#`-`#####` | X | | | -| Italic | `*text*` | X | | | -| Bold | `**text**` | X | | | -| Bold & Italic | `***text***` | X | | | -| Bullet points | `- text` | X | | | -| Title | `title: `(in preamble) | | | X | -| Author | `author: `(in preamble) | | | X | -| Date | `date: `(in preamble) | | | X | -| Author's Institution | `institution: `(in preamble) | | | X | -| Abstract | `\begin{abstract}`-`\end{abstract}` | | X | | -| Inline equations | `$x+1$` | | X | | -| Centered equations | `\begin{equation}`-`\end{equation}` | | X | | -| Citations | `\cite{reference}` | | X | | - -## Current issues -- Indented bulletted list (sublists) don't work +### Commands similar to markdown +- Headers (1-5) +- *Italic* +- **Bold** +- ***Bold & Italic*** +- Bullet points +- `Code blocks (in a monospaced font)` + +### Commands similar to LaTeX +- Abstract +- Inline equations +- Centered equations +- Citations + +### Commands similar to YAML +- Titles +- Authors +- Dates +- Author's Institution + +# Current issues - All text formatings need to be on the same line (you can't start bold - on one line and finish on the other) + on one line and finish on the other) Doing otherwise seems to trigger + an unescapable recursive loop on the groff side of things. -## Needed implementations +# Needed implementations - Numbered lists -- Tables -- multi-macro compatibility (mom macros for urls) -- Optional output to `sdout` +- multi-macro compatibility (mom macros for urls)
\ No newline at end of file diff --git a/README.pdf b/README.pdf Binary files differnew file mode 100644 index 0000000..cf39aba --- /dev/null +++ b/README.pdf @@ -35,15 +35,20 @@ output=$( sed -e '1,1d s/`\(.*\)`\(.\)$/\n\.CW\ \"\1\"\ \"\2\"/g s/`\(.*\)`\(.\)/\n\.CW\ \"\1\"\ \"\2\"\n/g + s/^\ ...............-\ /.IP\ \\(bu\ 10\n/g + s/^\ ...........-\ /.IP\ \\(bu\ 8\n/g + s/^\ .......-\ /.IP\ \\(bu\ 6\n/g + s/^\ ...-\ /.IP\ \\(bu\ 4\n/g s/^-\ /.IP\ \\(bu\ 2\n/g + s/^\ .*-\ /.IP\ \\(bu\ 12\n/g ' $1) # echo "$output" | groff -me -ms -kejpt -T pdf > $base.pdf -echo "$output" > $base.ms -groff -ms $base.ms -T pdf > $base.pdf +# echo "$output" > $base.ms +# groff -ms $base.ms -T pdf > $base.pdf -# echo "$output" +echo "$output" # $output >> output.ms # s/\*\*\*.*\*\*\*/Hi\1hi/g diff --git a/sample.md b/sample.md deleted file mode 100644 index 437b6d6..0000000 --- a/sample.md +++ /dev/null @@ -1,24 +0,0 @@ ---- -title: The Flight of the Bumblebee -author: Benjamin Chausse -date: 21 Septembre 2042 ---- - -# Heading 1 -This is a test paragraph which is meant to be relatively long -for what it is meant to express. I expect it -to contain (at least) some *italic* text, but -perhaps some text that is **bold**! -Perhaps even, if I'm lucky, I may, **very well** -want to integrate some ***Bold and italic*** text! -*Even* at the **beggining of line**... -This is an amazing alternative!!! - -## Assistant to the Regional Heading -Yes this was a *The Office* joke... - -### I will now - -#### Got up to.... - -##### FIVE! YAAAY! |