Live data from Hacker News

Pandoc

pandoc.org

221–230 of 298 posts

Re: Pandoc

#221

A question to experienced Pandoc users: I want to write a small book that I want to generate in 3 formats: HTML pages, EPUB and PDF. What is the best input format (source format) for the book? Pandoc Markdown? CommonMark? GFM? I'm a little hesitant to committing myself to Pandoc Markdown or any Markdown because they all have tiny differences with each other. Each is like its own standard. I considered Org-mode for so…

I'd just use Pandoc Markdown.

For simple things, you can easily write Markdown that is compatible with all dialects. Mainly, remember to indent your lists 4 spaces if you soft wrap.

But Pandoc Markdown has the most extensive support for other extensions, like footnotes, figures, etc. That's useful because it minimizes how much HTML or Latex you need to write, which in turn makes your documents more portable.

There are other formats that support more features, but in my experience the communities are smaller and the syntax is not as pretty. Ultimately you're betting on that format continuing to exist longer than Pandoc, which I think is not a great bet in most cases. The only format which I think might have better long-term support and compatibility is CommonMark, but it comes at the tradeoff of substantially fewer features. Which again means sacrificing portability because everything you can't do in the base language you need to do in HTML or Latex.

Re: Pandoc

#222

Earlier quoted context omitted.

I used to use Mutt, but now I don't because my email has its own special domain, and the email hosting service I use doesn't let me export IMAP and POP3 details unless I pay them. Currently, I just open vim in the terminal, write what I need, then copy the text. I open dmenu using a shortcut, type something like "unwr", which is sufficient for selecting the "unwrap-clipboard" script of mine, press enter, which unwrap…

I had a script that piped to curl to send, Mail.app for downloading via POP and Vim to read/write, but I gave up and ended up copy/pasting as well. Someday I may try that again, if email is still relevant by then. Vim and email would be my perfect set up.

You might find vim-anywhere what you need. Roughly speaking, in almost any text-entry field you can hit a hotkey, get a temporary macvim buffer, and when you wq the contents are pasted where you came from.

https://github.com/cknadler/vim-anywhere

Re: Pandoc

#223

Earlier quoted context omitted.

Good point, sigh...this is so true. I have created a 45 minute tutorial of 'how to use word properly' to address this exact pain point. I send a link to my students if their first draft commits any 'sins'. BTW, when I said tech people, I was thinking mostly about the computer savvy academics who use Latex for everything.

People use things like LaTeX exactly because of this problem. Word processing software brought the problem of inconsistent formatting and layout within the grasp of everyone and boy! ...did they grab it with both hands. Systems based on plain text allow the author to concentrate on content only, without the need to format. Personally I find LaTeX misses the mark. Too much markup is needed and it detracts. I'm a fan o…

My personal sweet-spot for writing technical documents these days is Asciidoctor with semantic line breaks [1]. There are some warts in the asciidoc syntax but it covers a lot more of the features I need for the types of documents I'm writing compared to Markdown.

[1] https://rhodesmill.org/brandon/2012/one-sentence-per-line/

Re: Pandoc

#224
post #35

Earlier quoted context omitted.

I'll probably lose some nerd cred: I do most of my writing in MS word, I find it easier to cut and paste and add footnotes and section headers. And then I use Pandoc to convert the docx into the format I want, usually HTML*. I used to do markdown in vim but I found that for most of what I do I prefer word. I do write code in vim... * I use this css file when converting: https://gist.github.com/killercup/5917178

I also use Word for all my writing too, so wanted to defend you. People (tech people at least) have lost sight of the fact that writing should happen in "word processing software", and Word is the best-in-class. To people who say "Word sux", I say "That just means you don't know how to use Word properly". Writing any markup or markdown syntax in an IDE is a disaster for the creative process. Jack Kerouac used to type…

If you're going to bring up Kerouac with his rolls of paper, you're better off talking about WordStar than Word. Word divides the document into discrete pages, while WordStar documents were long uninterrupted ribbons of text, just like Kerouac's rolls. Perhaps Kerouac "got it," but so do George R.R. Martin and Robert Sawyer, writers who continue to use WordStar decades after its demise (Sawyer even talks about the benefits of this undivided waterfall of text on his website [0]. Text editors also similarly long ribbons of text, and are just as conducive to putting words down as any bloated word processor that is optimized to produce two page corporate memos or colorful party posters to be posted in the lunch room.

I've used Word professionally since the mid-1990s. I do know how to use it properly, and it still sucks.

"Writing" isn't meant to be done in a word processor, which was developed as a business tool, not a creative tool. Writing should be done in whatever tool one wants to write in.

Word is, be design, both a desktop publishing app and a secretarial tool. For book-length writing, it works poorly with long files, the file format is subject to corruption. The docx format is also proprietary and subject to Microsoft's whim; any conversion scheme is a hack (though Pandoc and many others do work adequately). Unless you learn the ins and outs of Word's style scheme (and sometimes even if you do) and follow it slavishly, formatting is often inconsistent and there's no certainty that the styles you apply to make your document to make it look a certain way ensure it looks that way on someone else's machine.

There's no doubt, though, that a Word-compatible word processor needs to be in every writers' toolkit, since it is the standard in the publishing world.

[0] https://www.sfwriter.com/wordstar.htm, scroll down or search for THE LONG-HAND PAGE METAPHOR.

Re: Pandoc

#225

Earlier quoted context omitted.

So what you're saying is that the problem with Word is that it makes it easy to write unpolished and unprofessional documents? In your opinion, is that the fault of the word processor or the user? [0] [0]: Not a rhetoric question that implies one answer to be the only "right" one.

IMO entirely user. Word (and similar text processors) is a toolset. All it gives you are tools. Word lets you define formatting rulesets, lets you apply formatting rules and create rulesets from applied rules. Some evangelists may say that "safe" text processor would only allow application of rulesets, because direct application of rules leads to "spaghetti formatting". However that is one of the powers of WYSIWYG te…

But what of the potential lack of a compatible toolset on the other end of this pipeline? Even embedding styles in a Word document offers no assurance the document will appear as you intend when they receive it, much less if they offer edits and comments and send it back.

Re: Pandoc

#226
post #7

I wrote pretty much all my university work in Markdown with inline Latex, using Pandoc to generate a pdf. I'm sure there are things you can do in "pure" latex that you can't do this way, but for most normal cases, it's so much easier. You just use the simple Markdown syntax for basic text formatting, and then can use the power of Latex when you need to display mathematics, graphs, tables or similar.

I do the same thing, except using org mode instead of markdown. I've really come to love org mode for writing.

Re: Pandoc

#227

Earlier quoted context omitted.

> slowed me down and distracted me from actually writing It's a bit of a matter of perspective. The distinction between looking at a document in markdown versus Word is a bit analogous to the distinction between looking at a movie in its textual form as a screenplay versus looking at a movie as a piece of video: Text is capable of abstraction in a way that video is not. In the screenplay, it might say "table", but wh…

I know you're just font as an example, but doesn't your markdown editor also shove a font in your face? You can adjust default behavior in Word just as well as in another editor. Anyway, to work within your analogy, I would say that Word lets the write do a bit of a 'mockup' of the set with nearly 0 effort. Like "I want a table here", so 2-3 clicks and you have it. Then you can "let the director" take your mock up an…

Obviously everything that puts text on a screen puts a font in the user's face. But Word also presents you with styles, which make what you see changeable from the whitespace on up. Not only can one paragraph look different than the next, one word in a paragraph can look different from the word following it.

It's true that many document elements, such as tables, are easy to create in Word. This puts it over the edge into desktop publishing territory. In itself, that's not especially a bad thing, especially if your target is a printed file or a PDF. That still makes it a publishing tool, not especially a writing tool.

Re: Pandoc

#228
post #186

Earlier quoted context omitted.

+1 strong agree. I like Google Docs’ realtime collaborative editing, but the wysiwyg formatting (even if one has memorized the keyboard shortcuts) makes it hard to be fast the way I am in a Markdown-aware editor or vim. Plus I miss my vim motions!

I'd settle for a Markdown import. You could do your editing and writing of raw text in whatever you feel happy with, and then have gdocs transform it to its supposedly native format on upload. Gdocs would then really only need to support the same semantics with underscores, asterisks, octothorpe heading levels and title sizes.

[deleted]

Re: Pandoc

#229
post #186

Earlier quoted context omitted.

+1 strong agree. I like Google Docs’ realtime collaborative editing, but the wysiwyg formatting (even if one has memorized the keyboard shortcuts) makes it hard to be fast the way I am in a Markdown-aware editor or vim. Plus I miss my vim motions!

I'd settle for a Markdown import. You could do your editing and writing of raw text in whatever you feel happy with, and then have gdocs transform it to its supposedly native format on upload. Gdocs would then really only need to support the same semantics with underscores, asterisks, octothorpe heading levels and title sizes.

Oh boy, do I have a treat for you. Try saving the following as `input.md`:

    # Hello *world*
    
    ## Math
    
    $$x = 2 \cdot y^3$$
    
    - foo
    - bar
    - baz
    
    1. Yes
    2. No
    3. Maybe
    
    ---
    
      Right     Left     Center     Default
    -------     ------ ----------   -------
         12     12        12            12
        123     123       123          123
          1     1          1             1
    
    Table:  Demonstration of simple table syntax.
Then run

    pandoc -t html input.md | xclip -selection clipboard -t 'text/html'
And paste into a Google doc.

Re: Pandoc

#230

Earlier quoted context omitted.

> To people who say "Word sux", I say "That just means you don't know how to use Word properly". Or maybe those people just have eyes which can spot the differences in spacing between documents created with different Word versions, the mediocre kerning, and a multitude of other typographical annoyances. Even a website is easier to replicate exactly in another browser than a Word document to be replicated from scratch…

Yes, anyone who's ever learned LaTeX and why it was invented immediately sees how absolutely awful Word is at its rendering. Funny that a trillion-dollar company can't seem to figure out a better algorithm than Donald Knuth mocked up in Pascal decades ago. I think of this as another version of enshittification -- the acceptance of poor performance as the "standard". And don't get me started on math equations in Word…

Seriously, Word (and other word processing software) and TeX come from two separate lines of evolution. Knuth is a computer science guru, and invented TeX to effectively and precisely output technical and scientific documents. Word and other word processors (before and after) came from the creative and business worlds. The two didn't have any influence on each other for many years -- you can write a novel in LaTeX, and you can write a scientific paper in Word, but those aren't what the program was written for, and it shows in the awful editing and rendering of equations in Word. (I can't make a similar assertion for LaTeX...being based on plain, rather than formatted, text, it's easier to separate content in a LaTeX document from the end format, while in Word the content and formatting are inextricably bound together.)
Post reply on HN