Pandoc 3.0
pandoc.org
pandoc.org
[1]: Examples and animations: https://codebraid.org/presentations/scipy2022/. Installation for VS Code: https://marketplace.visualstudio.com/items?itemName=gpoore.c.... Installation for VSCodium: https://open-vsx.org/extension/gpoore/codebraid-preview.
this is awesome, thank you for your work.
In principle, it should be possible to create a PDF preview with proper SyncTeX support for synchronizing LaTeX source and PDF preview locations, but that gets complicated when Pandoc+LaTeX generate the PDF. It may be best to leave LaTeX-PDF previews to dedicated LaTeX previewers that don't involve Pandoc.
That would be extremely powerful, and also would allow you to differentiate your extension from the Quarto one.
https://github.com/atom-community/markdown-preview-plus/pull...
Old is new, the editor and the extension are now defunct. What was best about this exercise, I got so well versed with the markdown and Pandoc features at the time, that I didn’t need the preview at all.
1. I write markdown for my website and for the websites for my research projects and simply generate standalone html out of it. Done.
2. When we create electronic exams, the exam platform takes questions using a html-backed rich text editor. We write down our exam questions using markdown, create html document fragments, that we simply paste into the exam platform.
3. When students do electronic exams, we receive xml files from our exam platform. We use python to pass on submissions to different submission checkers (akin to autograders or static analysis) and create yaml files with the student submission and grading suggestions and static analysis annotations. We manually review and grade and comment within the yaml file (that works incredibly well), collect all the data using python and generate markdown reports for each student, including their submission, our comments and scoring. We pass this markdown through pandoc, creating well layouted pdfs which we either print and hand out or send out electronically.
Pandoc fits our yaml+markdown-based processes very well. Only for the actual research papers we still write LaTeX and build pdfs without pandoc.
Disclaimer: I'm the creator of MonsterWriter and very keen to receive feedback and learn about how universities and their students write papers, thesis, ...
For HN reading along, SetApp is a way to distribute apps and get paid outside the app store. Really, that exists.
// Disclosure: Unless you are disavowing your ability as author to offer a recommendation that can be trusted, you probably mean "Disclosure" not "Disclaimer". Disclosure = here is my potential bias. Disclaimer = YMMV, no warranties express or implied.
The table formatting is not good enough. It's not obvious how to left-justify a column. It's also not clear how to line a column up along "." (which I often use for numbers). Both of these are fairly easy in LaTeX.
The outputted LaTeX looks OK, but it's not obvious how to format -- most journals, and Universities (for PhDs) will have a fixed style you have to use. I suppose I could take the LaTeX and randomly hack it, but then I need to learn LaTeX to fix any issues that causes.
Regarding the outputted LaTeX, the idea is to grow the amount of supported templates. So there would be templates for every important journal. For now the focus is to make the thesis template flexible enough that it works for most bachelor/master thesis.
* It's not running on Linux. Nobody in our department runs windows or mac.
* We already have huge BibTex citation libraries that we use in papers and just reference the necessary papers. These citation library files grow and grow. I won't manually add citations for each paper.
* We collaborate and version through git. If collaborative writing and version control does not work at least as easy as our plaintext-git-handling, that's a hard no.
* You do know that for conference or journal submission word and LaTeX templates with given page limits in these templates are given, right? How would I use, say, LNCS in MonsterWriter? Writing seems not to be page-based. How do I know that I'm over the limit?
* My wife is a researcher in the social sciences, and they extensively use MS Word's change tracking and merging feature to write papers. If MonsterWriter does not support this in an accessible and visually appealing manner, it would be a hard no for her as well.
With your feature set, you're not really targeting researchers, even if you think you do.
I would believe the same goes for our own research static analysis and autotrading platform (in our case SQL) which probably every CS department also has quite a few of.
I wouldn't put my hopes up for anything publicly available that fits your platform and has a bus factor higher than 1.
Every now and then, I ponder putting some of my scripts together into something I could actually hand over to someone else, but have not yet had the time.
Plus, having a git history is a great boon.
pandoc --shift-heading-level-by=-1 input.md -o output.docx
This will promote level-2 headings to level-1, and promote a level-1 heading at the top of the document to the document's title.I write in markdown and export to PDF and using pygments for code syntax coloring, with .tex files to adjust layouts, tables, and the like.
If I'm writing markdown I use pandocs version as it has support for advanced tables.
Brilliant software.
Love the tool, but this is the most awful default setting I've seen in a program in a while, especially if you include any code that depends on quotes not being mangled.
- `pandoc foo.tex -t markdown foo.md` will not produce smart quotes.
- `pandoc foo.tex -t markdown-smart foo.md` will produce smart quotes.
https://pandoc.org/MANUAL.html#extension-smart
The meaning of the -smart extension on option names is inverted in some cases, and enabled by default on markdown output.
My only irritation -- while I understand why one would want to do it for neatness, it's annoying that the "pandoc" package no longer provides the "pandoc" program! Maybe instead introducing "pandoc-core" and renaming "pandoc-cli" to "pandoc" would be better (it would certainly avoid breaking existing scripts, like mine).
[1]: https://github.com/jgm/pandoc/blob/535bd0393fe7b2f287903b942...
For those who are a little less adventurous and who happen to be in the social sciences, humanities, journalism, etc., pandoc+msword is also definitely worth looking into. It's a much better tech stack than standalone msword. -- It's really only in the STEM fields that, in my mind, there really is no way around latex.
cf. https://github.com/adityaathalye/shite/blob/master/bin/templ...
__shite_templating_compile_source_to_html() {
# If content has front matter metadata, it is presumed to be in a format
# that the content compiler can safely process and elide or ignore.
local file_type=${1:?"Fail. We expect file type of content like html, org, md etc."}
case ${file_type} in
html )
pandoc -f html -t html
;;
md )
pandoc -f markdown -t html
;;
org )
pandoc -f org -t html
;;
esac
}That's part of the joy of using Pandoc. I can pipeline it, no problem.
Like this:
cf. https://github.com/adityaathalye/shite/blob/master/bin/templ...
cat "${watch_dir}/sources/${url_slug}" |
__shite_templating_compile_source_to_html ${file_type} |
__shite_templating_wrap_content_html ${content_type} ${watch_dir} |
__shite_templating_wrap_page_html \
> "${watch_dir}/public/${html_url_slug}"
Templates look like this. Notice the $(cat -) in the middle. That's how the HTML content produced by Pandoc gets injected in the middle of everything else. shite_template_common_default_page() {
local maybe_page_id=${shite_page_data[page_id]:+"id=\"${shite_page_data[page_id]}\""}
local maybe_canonical_url=${shite_page_data[canonical_url]:+"<link rel=\"canonical\" href=\"${shite_page_data[canonical_url]}\">"}
cat <<EOF
<!DOCTYPE html>
<html lang="en">
<head>
$(shite_template_common_meta)
$(shite_template_common_links)
${maybe_canonical_url}
</head>
<body ${maybe_page_id}>
<div id="the-very-top" class="stack center box">
$(shite_template_common_header)
<main id="main">
$(cat -)
</main>
$(shite_template_common_footer)
</div>
</body>
</html>
EOF
}
edit: substantiate Pandoc's role.I chose Pandoc because it does a reasonably OK job compiling orgmode, _and_ has good support for other formats I use from time to time (e.g. markdown, ASCIIDOC).
Before this, I was using hugo, with a compile cycle similar to your setup, viz. org -> markdown (via ox-hugo), and then hugo did the md -> HTML thing. hugo sort of supports org -> html, but their batteries-included compiler is not very good. Points for trying, though.
edit: typo, context
Though when it comes to annoyance with Markdown forks: AsciiDoctor is basically that to AsciiDoc. It's mostly compatible, but when it isn't, it really bites.
But more importantly, unlike the various Markdown flavors or AsciiDoc, it is incredibly extensible thanks to the combination of custom filters and the possibility to add HTML classes and attributes. One can write filters to leverage the class/attribute information and perform transformations at the AST level, which basically lets you define a DSL with an arbitrary number of custom elements.
I wrote a collection of filters for the publication of a large online legal playbook. Not only did Pandoc make it possible to introduce different kind of custom elements that don't exist in plain Markdown or AsciiDoc, but by using different filters it was possible to use a single Markdown source to generate both the book and various summaries such as a list of examples, a list of civil code clauses etc. I don't know Haskell that well so I used Rust for the filters, but that worked very well.
Pandoc is IMO a very underrated tool.
This is nebulous. Haskell's compiled binaries are not ideal, for a number of reasons.[^1] GHC does very little to optimise for many typical metrics of "efficient". The binaries it produces are enormous because it (unavoidably) bundles the runtime along with the program itself, and there is a lot of empty space in the binaries. Shrinking them can improve startup times significantly especially on spinning rust drives.
That said, Haskell programs are at least _compiled_, and they do result in binaries which, if well written, can result in running times comparable to (or, sometimes, shorter than) your average hand-rolled C code that achieves the same goals.
Of course, none of this casts any shadow on the fact that Pandoc is, indeed, an excellently engineered piece of software that stands as a testament to the value of Haskell for real-world business logic and problem solving.
[^1]: This problem is fairly well-understood in the Haskell community: https://dixonary.co.uk/small
Seems there's a long-standing (for the project) open issue where it's still being mulled over.
Imports are also very nice for writing longer texts--especially how AsciiDoc lets you +1 all of your headings so the heading hierarchy works as a standalone document and a part of a larger whole.
# Title
: key = value
```include
./examples/hello.rs
```
today and write a simple filter to extract meta from the first definition list and resolve includes.Here is how I made some reveal slides
(import [org.asciidoctor
Asciidoctor
OptionsBuilder
SafeMode])
(let [input-file (clojure.java.io/file
"path/to/adoc/file")
adoctor (org.asciidoctor.Asciidoctor$Factory/create)
reveal-option (doto
(org.asciidoctor.OptionsBuilder/options)
(.backend
"revealjs")
(.safe
org.asciidoctor.SafeMode/UNSAFE)
(.attributes
(.attribute
(org.asciidoctor.AttributesBuilder/attributes)
"revealjsdir"
"../reveal.js")))]
(.requireLibrary
adoctor
(into-array
String
["asciidoctor-revealjs"]))
(.convertFile
adoctor
input-file
reveal-option))
You get all the codez from Maven so you don't need to install anything on your system {'org.asciidoctor/asciidoctorj-revealjs {:mvn/version "5.0.0.rc1"}
'org.asciidoctor/asciidoctorj-pdf {:mvn/version "1.6.2"}
'org.asciidoctor/asciidoctorj {:mvn/version "2.5.3"}
The maintainers seem very responsive and active on Github. It's not as nice as a spec and multiple implementations - and I guess you're locked in to one library, but at least it's not as bad as Orgmode - where you're locked in to an editor as well