{"id":1029,"date":"2017-11-03T10:19:26","date_gmt":"2017-11-03T18:19:26","guid":{"rendered":"https:\/\/accretiondisc.com\/blog\/?p=1029"},"modified":"2017-11-03T10:19:26","modified_gmt":"2017-11-03T18:19:26","slug":"pandoc-for-word-document-conversion","status":"publish","type":"post","link":"https:\/\/accretiondisc.com\/blog\/2017\/11\/03\/pandoc-for-word-document-conversion\/","title":{"rendered":"Pandoc for Word Document conversion"},"content":{"rendered":"<p>I just discovered <a href=\"http:\/\/pandoc.org\/\">pandoc<\/a>. Well, I first bookmarked it in 2008, and again in 2016, so I guess I rediscovered it. But what I mean is that I finally discovered what to use it for: converting <a href=\"https:\/\/en.wikipedia.org\/wiki\/Microsoft_Word#File_formats\">Word files<\/a> to <a href=\"http:\/\/commonmark.org\/help\/\">Markdown<\/a>. It&#8217;s dead easy:<\/p>\n<blockquote><p>$ pandoc -f docx -t markdown sample.docx &gt; sample.md<\/p><\/blockquote>\n<p>I&#8217;ve been using <a href=\"http:\/\/www.winfield.demon.nl\/index.html\">Antiword<\/a> for years to convert Word 2006 (DOC) files to text, but it doesn&#8217;t do DOCX, and, instead of producing Markdown or something more neutral, it tries to recreate the DOC experience in text by centering lines, etc. Not complaining: it gets me plain text and I can take it from there, but Markdown is a big improvement. DOCX is even better, since, apart from pandoc, the only way I knew to read those at the command line was<a href=\"https:\/\/ask.libreoffice.org\/en\/question\/2641\/convert-to-command-line-parameter\/\"> via Libre\/OpenOffice<\/a>:<\/p>\n<blockquote><p>$ libreoffice &#8211;headless &#8211;convert-to &#8220;txt:Text (encoded):UTF8&#8221; sample.docx &gt; sample.txt<\/p><\/blockquote>\n<p>(I see &#8212; now, when it is too late &#8212; that there is also code to do this in ruby:<a href=\"https:\/\/github.com\/rainey\/antiword-xp-rb\/wiki\"> antiword-xp-rb<\/a>. I hope that&#8217;s an awesome tool, but it took me 9 years to figure out what to do with pandoc so don&#8217;t wait for me to tell you.)<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I just discovered pandoc. Well, I first bookmarked it in 2008, and again in 2016, so I guess I rediscovered it. But what I mean is that I finally discovered what to use it for: converting Word files to Markdown. It&#8217;s dead easy: $ pandoc -f docx -t markdown sample.docx &gt; sample.md I&#8217;ve been using [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[23,52],"tags":[972,970,971,973,975,120,974,969],"class_list":["post-1029","post","type-post","status-publish","format-standard","hentry","category-life","category-technology","tag-conversion","tag-file-format","tag-format","tag-libreoffice","tag-markdown","tag-microsoft-2","tag-openoffice","tag-word"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/paRqpr-gB","_links":{"self":[{"href":"https:\/\/accretiondisc.com\/blog\/wp-json\/wp\/v2\/posts\/1029","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/accretiondisc.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/accretiondisc.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/accretiondisc.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/accretiondisc.com\/blog\/wp-json\/wp\/v2\/comments?post=1029"}],"version-history":[{"count":0,"href":"https:\/\/accretiondisc.com\/blog\/wp-json\/wp\/v2\/posts\/1029\/revisions"}],"wp:attachment":[{"href":"https:\/\/accretiondisc.com\/blog\/wp-json\/wp\/v2\/media?parent=1029"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/accretiondisc.com\/blog\/wp-json\/wp\/v2\/categories?post=1029"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/accretiondisc.com\/blog\/wp-json\/wp\/v2\/tags?post=1029"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}