public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
* How to programmatically enforcing a pandoc markdown style
@ 2016-10-22  9:09 Kolen Cheung
       [not found] ` <e82e943f-604e-4a5b-a621-4b3dd82e42c0-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 39+ messages in thread
From: Kolen Cheung @ 2016-10-22  9:09 UTC (permalink / raw)
  To: pandoc-discuss


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



Hi, all,
pandoc from markdown to markdown 

Ever since I read issue #2814 <https://github.com/jgm/pandoc/issues/2814>, 
I find it a very useful trick.

I am now working on a project, that starting from next semester will open 
up to about 100 GSIs to collaboratively update a series of workbooks. I 
want to incorporate the said trick as a cleanup tool to normalize the 
source code (in pandoc markdown with minimal raw LaTeX).

Most things works very well, but however I find a few problems. I don’t 
know if there’s any way to get around these?

   1. ### Main Goals {-} becomes ### Main Goals {#main-goals .unnumbered}: 
   I want to keep using {-} for 2 reasons: shorter, and does not depends on 
   the header (which will gets repeated after cat). 
   2. 1. abcd... becomes 1. abcd...: it seems that pandoc enforce 2 spaces 
   after the enumerated list/bullet list. Are there ways to change this 
   behavior? I suppose I could use a regex to transform it back but it seems 
   to prone to error. 
   3. inline footnotes: I found that pandoc would convert inline footnotes 
   to explicit footnotes with [^1], [^2].... And the use of inline_notes 
   cannot be enforced. I opened an issue in #3172 
   <https://github.com/jgm/pandoc/issues/3172>. I suppose I can change the 
   source code to use explicit footnotes only. But it seems difficult to 
   enforce it and tell people not to use inline footnotes. 
   4. &trade; becomes ™: after studying how trademark should be typeset, 
   considering I aim at HTML+LaTeX output and no non-ascii characters in the 
   source code, I chose &trade;. But pandoc would happily convert that to ™ 
   without my consent. I suppose other such HTML characters might behave 
   similarly. (by the way, input &trade; from markdown would output ™ in 
   TeX, and pdflatex has no problem with that. The resultant PDF looks 
   identical as if I use \texttrademark. Does anyone knows why? I thought 
   pdflatex don’t like unicode.) 
   5. pipe tables becomes HTML tables: I believe it is a bug so I opened issue 
   #3171 <https://github.com/jgm/pandoc/issues/3171>. Even more 
   interestingly, the pipe tables were obtained by a .docx to .md 
   conversion. 

The command I used to enforce “pandoc style” is:

find . -maxdepth 2 -mindepth 2 -iname "*.md" -exec pandoc -f markdown+abbreviations+autolink_bare_uris+markdown_attribute+mmd_header_identifiers+mmd_link_attributes+mmd_title_block+tex_math_double_backslash-latex_macros -t markdown+raw_tex-native_spans-simple_tables-multiline_tables-grid_tables-latex_macros --normalize -s --wrap=none --atx-headers -o {} {} \;

“pandoc lint” 

By the way, does anyone know how to do some sort of “pandoc lint”? 
Currently I checked the TeX output by chktex -q and lacheck, which 
sometimes gives useful typographical hints on what to correct.

And I remembered I read somewhere @jgm mentioned something about a random 
string should be a valid markdown syntax (part of the markdown philosophy 
kind of thing). In this sense it seems very difficult to enforce a “right” 
syntax in markdown.
cat a lot of markdown files into one 

Lastly, there’s a very minor issue: if I cat lots of markdown files into 
one, then between the end of one file to the beginning of another, the lack 
of enough newlines between them might make it a wrong markdown syntax. (
*e.g.* the beginning of a file starts with a heading, some text editors (
*e.g.* Atom) normalized my trailing newline without my consent to 1 empty 
line. So then the heading would start immediately after the last paragraph, 
which pandoc will not parse it as a heading.)

I currently get around this problem with a script to normalize every files 
with exactly 2 trailing empty lines.

I suppose cating markdown files would be a very common process. How 
normally would others do it?

Thanks in advance,
Kolen
​

-- 
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 post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/e82e943f-604e-4a5b-a621-4b3dd82e42c0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

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

^ permalink raw reply	[flat|nested] 39+ messages in thread

end of thread, other threads:[~2017-02-07 22:36 UTC | newest]

Thread overview: 39+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-22  9:09 How to programmatically enforcing a pandoc markdown style Kolen Cheung
     [not found] ` <e82e943f-604e-4a5b-a621-4b3dd82e42c0-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2016-10-22 20:54   ` John MacFarlane
     [not found]     ` <20161022205406.GB83446-jF64zX8BO091tJRe0FUodcM6rOWSkUom@public.gmane.org>
2016-10-22 22:41       ` Kolen Cheung
     [not found]         ` <964c8fc2-834a-4f4c-8390-091177a82562-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2016-10-23  2:36           ` Sergio Correia
     [not found]             ` <e7bd4eba-c43a-4f20-8536-5fa0926b857b-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2016-10-23 21:39               ` John MacFarlane
2016-10-24  7:59               ` Kolen Cheung
2016-10-24  8:42       ` Kolen Cheung
2016-10-27  7:05       ` Kolen Cheung
     [not found]         ` <0f0bc668-c454-4119-a62b-307e318553f8-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2016-10-27 19:02           ` John MacFarlane
     [not found]             ` <20161027190242.GD1044-jF64zX8BO091tJRe0FUodcM6rOWSkUom@public.gmane.org>
2016-10-28  0:58               ` Kolen Cheung
     [not found]                 ` <cbf3c105-241b-45de-8519-8962cadda270-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2016-10-28 13:15                   ` BP Jonsson
     [not found]                     ` <CAFC_yuSXMWATCa0GFO0Y94H0PpFXcShGMLwEEaHBqutpxuLSiw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-10-28 20:45                       ` Kolen Cheung
     [not found]                         ` <10bddc3d-e533-44bd-8d8c-5b132e56a57f-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2016-10-29  6:19                           ` John MacFarlane
     [not found]                             ` <20161029061904.GF7496-jF64zX8BO091tJRe0FUodcM6rOWSkUom@public.gmane.org>
2016-10-29  6:53                               ` Kolen Cheung
     [not found]                                 ` <45d24e60-5523-4bbe-8c9f-a49e53583198-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2016-10-29  7:01                                   ` Kolen Cheung
2016-10-28  3:45               ` Kolen Cheung
     [not found]                 ` <6a504fbe-45c3-4221-ab15-0dc47b4591c7-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2016-10-28  8:25                   ` John MacFarlane
2016-10-29  9:33               ` Kolen Cheung
     [not found]                 ` <565f0a35-b5d3-45b3-8cde-e0c9dfe0ca3b-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2016-10-29 18:54                   ` John MacFarlane
     [not found]                     ` <20161029185445.GE5364-jF64zX8BO091tJRe0FUodcM6rOWSkUom@public.gmane.org>
2016-10-29 19:27                       ` Kolen Cheung
     [not found]                         ` <af7d7c17-b985-4370-b5c7-872433996afd-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2016-10-29 21:03                           ` Melroch
     [not found]                             ` <CADAJKhDsYm4yaCen61Q4kKXpgL9oKgToMn=hT71g5UZrwDeWSA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-10-29 21:44                               ` Kolen Cheung
2016-10-30  9:42                           ` John MacFarlane
     [not found]                             ` <20161030094223.GH6690-jF64zX8BO091tJRe0FUodcM6rOWSkUom@public.gmane.org>
2016-10-31  1:50                               ` Kolen Cheung
2016-11-30  2:46                               ` Kolen Cheung
     [not found]                                 ` <e29cd3d1-0cfb-42be-8cbe-c3c771efe125-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2016-11-30  3:05                                   ` Kolen Cheung
     [not found]                                     ` <1cf2f022-2a64-4a9e-94d3-f2da097709ba-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2016-11-30  4:18                                       ` Sergio Correia
     [not found]                                         ` <a679cf14-0eea-4a14-85b5-2506b61975fe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2016-11-30 11:59                                           ` John MacFarlane
2016-11-30 11:59                                           ` John MacFarlane
     [not found]                                             ` <20161130115945.GF15143-BKjuZOBx5Kn2N3qrpRCZGbhGAdq7xJNKhPhL2mjWHbk@public.gmane.org>
2016-11-30 14:29                                               ` Sergio Correia
2016-11-30 11:52                                       ` John MacFarlane
2016-11-08  7:25                           ` BP Jonsson
2016-10-29 18:55                   ` John MacFarlane
2016-10-27 19:10           ` Jesse Rosenthal
     [not found]             ` <87bmy5txp1.fsf-4GNroTWusrE@public.gmane.org>
2016-10-28  1:21               ` Kolen Cheung
     [not found]                 ` <7e8b352f-1df9-4a92-81df-10359475f869-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2016-10-28  1:31                   ` Sergio Correia
     [not found]                     ` <4e8bc6eb-5f42-4db1-bf6b-2b2fb44482c1-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2016-10-28  1:53                       ` Kolen Cheung
2016-10-28  8:23                       ` John MacFarlane
2017-02-07 22:36   ` Kolen Cheung

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).