public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
From: Ophir Lifshitz <hangfromthefloor-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: pandoc-discuss <pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
Subject: Re: controlling smart typography with org or markdown
Date: Mon, 27 Sep 2021 17:04:01 -0700 (PDT)	[thread overview]
Message-ID: <95eec37d-58d5-4b05-be9f-a387ac9471f0n@googlegroups.com> (raw)
In-Reply-To: <4331fc4f-e662-4ea0-89c0-c62b0c0228e1n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>


[-- Attachment #1.1: Type: text/plain, Size: 6731 bytes --]

I must admit, I remember often getting confused too about how to use 
`smart`, and about how `+smart` and `-smart` would often do the opposite of 
what I'd expect.* (That expectation was probably influenced by other 
software that uses something like a `--smart` flag/switch to make 
typography fancier when converting input to rendered output in a single 
direction, instead of an extension model like modern Pandoc.) But the way 
you just explained it has truly helped me sort it out, so here's a thank 
you from me. Perhaps that explanation is something the docs could use!

Ophir

* I think I learned a "reverse psychology" mnemonic/habit for it eventually 
– to do precisely the opposite of what I expect. Naturally that's a great 
way to confuse yourself even more, as once you get used to "no, this is the 
right way" (becoming "yes, this is the right way") you can then easily 
second-guess yourself.
On Monday, September 27, 2021 at 7:35:08 PM UTC-4 John MacFarlane wrote:

> I'm not sure what's going on with org (2), but I can illuminate the other 
> mysteries.
>
> 1)  It's not a typo.  markdown_strict is the name of the format (really 
> shorthand for markdown with certain extension settings).
>
> 3) Why the reverse effect with `-t markdown-smart`?
>
> Think of it this way.  You're writing markdown for consumption by a 
> markdown processor which does not have "smart" support.  How, then, should 
> we render Str "\8211"?  Not as "--", because the target processor doesn't 
> support smart quotes; it will interpret "--" as two dashes.  Instead, as a 
> unicode en-dash.
>
> Another way to think of it is this:  'pandoc -f markdown+smart -t 
> markdown+smart' should be ideally be an identity, at least up to the 
> semantics.  (There might be changes in indentation, bullet markers, and 
> things like that, but we'd hope that the source and target would correspond 
> to the same AST.)  So, if '-f markdown+smart' changes "--" to "\8211", then 
> "-t markdown+smart" had better change "\8211" back to "--".
>
> 4) Hopefully it makes more sense now in light of the above.  I don't 
> really understand how you're using "smart markdown" here.  The way we use 
> it, "smart markdown" is a markdown dialect in which "--" gets parsed as Str 
> "\8211", and Str "\8211" gets rendered as "--".  That is, a dialect in 
> which the markdown string "--" *means* Str "\8211".
>
>
>
> On Sunday, September 26, 2021 at 12:41:00 PM UTC-7 Simon Michael wrote:
>
>> G'day all! 
>>
>> As someone documenting command line software, I never want `smart` 
>> typography. Still, Pandoc lets me control it, right ? In the end, yes.. 
>> but I must share some notes. Perhaps I'm getting confused between 
>> readers and writers ? Any comments welcome. 
>>
>>
>> 1. A small correction 
>> --------------------- 
>>
>> > https://pandoc.org/MANUAL.html#extensions: "For example, --from 
>> markdown_strict+footnotes is..." 
>>
>> The underscore is a typo I think. 
>>
>>
>> 2. With the org reader, smart can not be disabled 
>> ------------------------------------------------- 
>>
>> > https://pandoc.org/MANUAL.html#extension-smart: "Interpret straight 
>> quotes as curly quotes, --- as em-dashes, -- as en-dashes, and ... as 
>> ellipses. " 
>>
>> This suggests smart is disabled by default for org (reader, or so I 
>> think): 
>>
>> $ pandoc --version 
>> pandoc 2.14.2 
>> Compiled with pandoc-types 1.22, texmath 0.12.3.1, skylighting 0.11, 
>> citeproc 0.5, ipynb 0.1.0.1 
>> ... 
>> $ pandoc --list-extensions=org 
>> -ascii_identifiers 
>> +auto_identifiers 
>> +citations 
>> -east_asian_line_breaks 
>> -gfm_auto_identifiers 
>> -smart 
>>
>> But this shows it enabled by default: 
>>
>> $ echo '--version' | pandoc -f org -t native 
>> [Para [Str "\8211version"]] 
>>
>> And enabling/disabling the extension has no effect: 
>>
>> $ echo '--version' | pandoc -f org-smart -t native 
>> [Para [Str "\8211version"]] 
>> $ echo '--version' | pandoc -f org+smart -t native 
>> [Para [Str "\8211version"]] 
>>
>>
>> 3. With the markdown writer, smart is selected oppositely 
>> --------------------------------------------------------- 
>>
>> Since I am converting to markdown, maybe I could control it there. I was 
>> already disabling smart in the markdown writer I thought, but it was not 
>> working: 
>>
>> $ echo '--version' | pandoc -f org -t markdown-smart 
>> –version 
>>
>> Then I found this: 
>>
>> > "Note: If you are writing Markdown, then the smart extension has the 
>> reverse effect: what would have been curly quotes comes out straight." 
>>
>> Which indeed achieves my goal: 
>>
>> $ echo '--version' | pandoc -f org -t markdown+smart 
>> --version 
>>
>> But.. why the reverse effect ? There must be a reason, but I found this 
>> non-intuitive. 
>>
>>
>> 4. More 
>> --------------------------------------------------------- 
>>
>> So it seems I have been *enabling* smart in my markdown web docs (with 
>> -t markdown-smart) for years. But I haven't been seeing smart 
>> quotes/dashes; apparently they were still being suppressed by other 
>> means. I investigated: 
>>
>> With the markdown reader, smart is enabled by default, and disabled with 
>> -smart as one would expect (unlike the markdown writer): 
>>
>> $ echo '--version' | pandoc -f markdown -t native 
>> [Para [Str "\8211version"]] 
>> $ echo '--version' | pandoc -f markdown-smart -t native 
>> [Para [Str "--version"]] 
>>
>> Here are the combinations of the markdown reader and markdown writer, as 
>> I understand them. 
>>
>> A. from smart markdown to non-smart markdown: 
>>
>> $ echo '--version' | pandoc -f markdown -t markdown 
>> --version 
>>
>> B. from smart markdown to smart markdown: 
>>
>> $ echo '--version' | pandoc -f markdown -t markdown-smart 
>> –version 
>>
>> C. from non-smart markdown to non-smart markdown (why the backslash ?): 
>>
>> $ echo '--version' | pandoc -f markdown-smart -t markdown 
>> \--version 
>>
>> D. from non-smart markdown to smart markdown (why no en-dash here ?) 
>>
>> $ echo '--version' | pandoc -f markdown-smart -t markdown-smart 
>> --version 
>>
>>
>> And now I must go for a lie down. 
>>
>>

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/95eec37d-58d5-4b05-be9f-a387ac9471f0n%40googlegroups.com.

[-- Attachment #1.2: Type: text/html, Size: 8593 bytes --]

      parent reply	other threads:[~2021-09-28  0:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-26 19:40 Simon Michael
2021-09-26 20:36 ` Albert Krewinkel
2021-09-27 23:35 ` John MacFarlane
     [not found]   ` <4331fc4f-e662-4ea0-89c0-c62b0c0228e1n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2021-09-28  0:04     ` Ophir Lifshitz [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=95eec37d-58d5-4b05-be9f-a387ac9471f0n@googlegroups.com \
    --to=hangfromthefloor-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).