tag:support.markedapp.com,2011-09-11:/discussions/questions/10240-how-to-preview-r-markdown-rmd-documentsMarked: Discussion 2020-09-25T16:22:49Ztag:support.markedapp.com,2011-09-11:Comment/485701432020-08-22T21:09:43Z2020-08-22T21:09:44ZHow to preview R Markdown (.rmd) Documents? <div><p>I've just started using R Markdown to get more control over my markdown generated documents. I'm checking to see if I can get Marked 2 to use an R Markdown processor to render the document.</p>
<p>To that end,</p>
<ol>
<li>I made a copy of the render script in this thread - <a href="http://support.markedapp.com/discussions/problems/60274-rmarkdownknitr-as-processor">http://support.markedapp.com/discussions/problems/60274-rmarkdownkn...</a><br></li>
<li>I enabled the custom processor<br></li>
<li>Put the path to the script in the processor settings.<br></li>
<li>Made the script executable<br></li>
<li>Updated permissions<br></li>
<li>Made the script executable<br></li>
</ol>
<p>My Markdown 2 document screen displays this when I select the custom processor</p>
<blockquote>
<blockquote>
<p>/usr/local/bin/pandoc +RTS -K512m -RTS input.utf8.md --to docx --from markdown+autolink_bare_uris+tex_math_single_backslash --output /var/folders/f6/nv5cjhps7ps4kz1b7l9l7b8r0000gn/T/output.loss2EUX --highlight-style tango --reference-doc svm-rmarkdown-word.docx --lua-filter /Library/Frameworks/R.framework/Versions/4.0/Resources/library/rmarkdown/rmd/lua/pagebreak.lua [WARNING] Could not parse YAML metadata at line 33 column 1: Lexical error near "<strong>Apps</strong> Confluence, Google Chrome, Jenkins, Jira, MS Office, Nagios, Op5, SecureCRT, SharePoint " pandoc: svm-rmarkdown-word.docx: openBinaryFile: does not exist (No such file or directory) Error: pandoc document conversion failed with error 1 Execution halted</p>
</blockquote>
</blockquote>
<p>I did a manual run using the suggested syntax from the thread above, and it worked.<br>
cat rmarkdownfile.rmd | /path/to/script.sh > outfile.html<br>
It seems that it cannot find a file, but I can't tell which one it cannot find from the output.</p>
<p>Has anyone gotten this to work that can shed some light on what I might be doing wrong?</p></div>johntag:support.markedapp.com,2011-09-11:Comment/485701432020-08-22T22:26:49Z2020-08-22T22:26:49ZHow to preview R Markdown (.rmd) Documents? <div><p>It looks like your —reference-doc parameter needs an absolute path to the docx file.</p>
<ul>
<li>Brett</li>
</ul></div>Bretttag:support.markedapp.com,2011-09-11:Comment/485701432020-08-23T00:58:56Z2020-08-23T00:58:56ZHow to preview R Markdown (.rmd) Documents? <div><p>Thanks. That fixed the error. The document doesn't at all different than with the built-in Github md processor.</p>
<p>In fact "knitr::opts_chunk$set(echo = TRUE)" appears as a code block, where R would normally run the command, not display it.</p>
<p>Curiously, I had "cd /path/to/project/folder" in the script , and the template file is in that folder.</p>
<p>What I was hoping for was the document to look like the Word document produced by the R markdown render command. eg<br>
<code>rmarkdown::render("/path/to/file.rmd", encoding = "UTF-8")</code></p>
<p>For now, I'll go back editing the rmd file and periodically create the MS Word document periodically to see what it looks like.</p></div>john