This means for example that some of the option used by R Markdown are not supported / known by Pandoc, and the otherway around. Rmarkdown is built on Pandoc feature but is not a thin wrapper on Pandoc. I believe that this might also be useful for other users, because they wouldn't have to create an R package with a custom function, but they would simply write a defaults file. I'd rather have a simple-to-use output format in R Markdown, the complete behavior of which is defined by the YAML defaults file. However, that would mean to duplicate the effort I have already put in my defaults files, and every time I change something in my defaults files I would have to do the corresponding changes in the R code. I am aware that I could probably achieve the equivalent of my defaults files by inheriting from an existing output format and overriding the right options. The -defaults command line argument is at the end, which makes Pandoc ignore it for the most part.Īs a question: What do I have to do in order to get the exact necessary Pandoc command to use my defaults file?Īs a feature request: In case that proves impossible, I propose that it is made possible. I tried the argument to = "pdf" – then I get a pdf file, but also a -to latex command line option. The output file is specified with extension. Well, I guess I could extract that, too, and set it explicitly. I don't mind autolink_bare_uris and tex_math_single_backslash, but I do prefer to have hard_line_breaks. 101-first-page#first-page becomes #first-page-first-page.Īfter it has run every markdown file through this filter individually and converted them to json files, it concatenates the json's and converts that to a PDF./usr/bin/pandoc +RTS -K512m -RTS -to beamer -from markdown+autolink_bare_uris+tex_math_single_backslash -output test.tex -defaults=beamer_pdf.yamlĪ default value of from has been used, which conflicts with my setting in the defaults file. It renames all links to other files such that the (assumed) prefix of the other files is taken into account, e.g.It renames all links to the same file such that the prefix is taken into account, e.g.It prepends that label to all other labels in the same file, e.g.It gets the label of the first level 1 header, e.g.The filter itself (together with the pandoc script) is available in this gist. the file 101-A file on the wiki.md should have a first level one header named A file on the wiki. Every file should start with a level 1 header that matches the filename (except for the number at the beginning).Solutionīy pre-processing all markdown files first individually via a pandoc filter, and then concatenating the resulting json files I was able to get all links working. The link from the second to the first page breaks as the link target is incorrect. Some text and (101-first-page#first-page). # Another section anchor=#another-section Below the concatenated file with the anchors in comments. When concatenating them to render as one document in pandoc, links between pages break as anchors change. # Another section // Gitlab automatically creates an anchor here named #another-sectionĪ link to the (#first-page)Īnd 102-second-page.md: # Second page // Gitlab automatically creates an anchor here named #second-page To explain my solution I'll have two test files, 101-first-page.md: # First page // Gitlab automatically creates an anchor here named #first-page I wrote a (finicky and fragile) pandoc filter that solved that problem for me, who knows it's useful to others. There links between pages look like filename-of-page#anchor-name and links within a page look like #anchor-name. I had a similar problem when trying to export a Gitlab wiki to PDF. In the comments of this question the bug is said to be fixed by a pull request in May. Pandoc command line parameters for resolving internal links But instead the link it created in the output file like it was in the input files. I would have asumed that when multiple files are processed and concatenated into the same output file, then the result should contain page internal links like anchor links for html-output. The result in html with this call to pandoc:Īs pdf a link is created but it does not work. Wenn converting markdown files with cross document links to html, docs or pdf the links get broken in the process.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |