Displaying YAML metadata in PDF file using Uberdoc - pdf

Is there a way to get Uberdoc to use the YAML block somehow? Uberdoc is a kind of build system on top of Pandoc, and Pandoc understands YAML. I'm generating a PDF on a mac like so:
uberdoc build -p
I know I can do a basic title page using % Some Title\n% Some author, but I was after YAML if it's possible.

Related

How can I convert specific web page to markdown or asciidoc with pandoc?

I want to convert java specification documentation to easily editable formats(markdown or asciidoc) and upload GitHub Gist and customize(adding my code experiences and notes.)
I want to convert to something like this
I use a tool called pandoc that allows us to convert from HTML to markdown.
I tried followings:
Technique 1
I tried to convert all table of components of java specification on index.html
pandoc -f html -t markdown -o test2.md
https://docs.orac le.com/javase/specs/jls/se10/html/index.html`
I got this:tes2.md
(I did not upload here because the file of contents is too long)
Problem 1:
This markdown file does not have contents of java specification documentation. I expected that I got markdown toc(table of components) and java specification documentation contents in markdown file like this`
Problem 2:
When click the links on this markdown file then I get 404 error page.
Technique 2(Better than technique 1)
I downloaded all HTML files of TOC with HTTrack and try to convert all files separately.
pandoc -f html-native_divs-native_spans -i jls-1.html -t markdown -o test2.md
Problem 1:
I got following markdown file which have the table of components links that cannot redirect to another section of the same document. When I click on this links, they return external GitHub page like that:https://gist.github.com/lostdinar2/jls-1.html#jls-1.1
which is not available.
test3.md
A demonstration of problem 1:
1)I want to convert this HTML internal id link(#) to the markdown internal link that redirects to another section of the same document
<dt><span class="section">2.2. The Lexical Grammar</span></dt>
[link text](#abcd)
2)But pandoc cannot convert this links to the markdown internal link.Pandoc create an external link like this:https://gist.github.com/lostdinar2/jls-1.html#jls-1.1
Is there a pandoc parameter to fix this? I make a search on pandoc documentation but I cannot do this feature.

How to Export Swagger documentation in PDF and XML files

I have generated swagger document for web api using below link:
http://wmpratt.com/swagger-and-asp-net-web-api-part-1/
Need to export document in PDF or XML file to send across handy.
Its .NET WEB API.
How to export swagger documentation ?
Thanks
Here's what I did today, since many of these other projects require laborious workarounds or extra libraries or some completely separate language.
Go to https://editor.swagger.io/ (Make sure it's the HTTPS version)
At the top, click File => Import File.
Select your Swagger JSON file.
At the top, click Generate Client => HTML2 and download the ZIP file.
This yields a static HTML page that you can then print (via the browser) to PDF using the built-in Microsoft Print to PDF printer, or Adobe Acrobat, or whatever else you might want to use.
You can use Swagger2Markup and AsciiDoc docker images:
docker run --rm -v $(pwd):/opt swagger2markup/swagger2markup convert -i "https://api.example.org/api/doc/swagger.json" -f /opt/swagger-doc
Creates asciidoc file named 'swagger-doc.adoc' in current folder.
docker run -it -v $(pwd):/documents/ asciidoctor/docker-asciidoctor asciidoctor-pdf swagger-doc.adoc
Creates a PDF file named 'swagger-doc.pdf' in current folder.
The Swagger2Markup project is on GitHub and some more information you'll find by using Google too.
Swagger2Markup converts a Swagger JSON or YAML file into several AsciiDoc or GitHub Flavored Markdown documents which can be combined with hand-written documentation.
AsciiDoc is preferable to Markdown as it has more features. AsciiDoc is a text document format for writing documentation, articles, books, ebooks, slideshows, web pages and blogs. AsciiDoc files can be converted to HTML, PDF and EPUB. AsciiDoc is much better suited for describing public APIs than JavaDoc or Annotations.
You can generate your HTML5, PDF and EPUB documentation via asciidoctorj or even better via the asciidoctor-gradle-plugin or asciidoctor-maven-plugin.
The project requires at least JDK 8.
See also RESTful API Documentation with Swagger and AsciiDoc
Their is no such tool or functionality to export swagger documentation into PDF or any other doc. You need to convert your swagger.json file to yaml file then u can get swagger as html doc form http://editor.swagger.io/.

How to avoid automatic appended file extensions to directory links when converting to pdf using pandoc?

I'm writing company internal documentation in R markdown and compiling using knitr in Rstudio. I'm trying to add a link pointing to a directory as follows:
[testdir](file:////c:/test/)
(this is following the convention described in here)
When I compile it to html, I get the following link.
testdir
and it works as expected in Internet explorer. However, when I try to convert to pdf straight from RStudio, an unwanted pdf extension is appended to the link. I tried dissecting the problem and it seems this change is happening within pandoc. Here are the details.
When I convert it to latex using pandoc,
>pandoc -f markdown -t latex testing.md -o test.tex
the link in the latex output file looks as follows:
\href{file:///c:/test/}{testdir}
Everything good so far. However, when I convert the latex output to pdf with pandoc,
>pandoc -f latex -t latex -o test.pdf test.tex
a .pdf extension is appended to the link. Here is a copy/paste of the pdf link output:
/c:/test/.pdf
is there a way to avoid this unwanted appended extension?
Perhaps I'm asking too much of pandoc, but I thought it might be worth asking since RStudio is becoming such a useful IDE to write my dynamic documents.
As you said, the .tex file pandoc generates is fine. So the problem is actually with LaTeX, specifically with the hyperref package which is used in pandoc's LaTeX template.
The problem with two possible solutions was described here. To prevent hyperref from being smart and adding a file extensions, try:
[testdir](file:///c:/test/.)
Or use ConTeXt instead of LaTeX:
$ pandoc -t context -s testing.md -o test.tex && context test.tex

Generate PDF/HTML from Doxygen's Docbook Output

Doxygen 1.8.4 included a patch which adds Docbook support. This can be enabled via GENERATE_DOCBOOK. I've tried it with an existing code base and I am able to generate a docbook directory containing xml files.
How can I generate a PDF file from that output?
How can I view the docbook output in a web browser? This question may not be relevant if the content will be identical to the standard doxygen output, but I'm curious.
The Dockbook specialization contains many XSL conversions including HTML and XSL FO to obtain PDF. I would suggest searching Docbook and download these.
A simple way:
Install Eclipse
Go to Eclipse Marketplace, search for docbook and install DEP4E from there
Create DocBook project
Replace the existing docbook with yours
Run build.xml - Ant will ask you in which formats to publish the book. Choose PDF.

How to convert a Markdown file to PDF

I have a Markdown file that I wish to convert to PDF so that I can upload it on Speakerdeck. I am using Pandoc to convert from markdown to PDF.
My problem is I can't specify what content should go on what page of the PDF, because Markdown doesn't provide any feature like that.
E.g., Markdown:
###Hello
* abc
* def
###Bye
* ghi
* jkl
Now I want Hello to be one slide and Bye to be on another slide on Speakerdeck. So, I will need them to be on different pages in the PDF that I generate using Pandoc.
But both Hello and Bye gets on the same page in the PDF.
How can I accomplish this?
Via the terminal (tested in 2020)
Download dependencies
sudo apt-get install pandoc texlive-latex-base texlive-fonts-recommended texlive-extra-utils texlive-latex-extra
Try to use
pandoc MANUAL.txt -o example13.pdf
pandoc MANUAL.md -o example13.pdf
Via a Visual Studio Code extension (tested in 2020)
Download the Yzane Markdown PDF extension
Right click inside a Markdown file (md)
The content below will appear
Select the Markdown PDF: Export (pdf) option
Note: Emojis are better in Windows than Linux (I don't know why)
2016 update:
NPM module: https://github.com/alanshaw/markdown-pdf
Has a command line interface: https://github.com/alanshaw/markdown-pdf#usage
npm install -g markdown-pdf
markdown-pdf <markdown-file-path>
Or, an online service: http://markdown2pdf.com
As SpeakerDeck only accepts PDF files, the easiest option is to use the Latex Beamer backend for pandoc:
pandoc -t beamer -o output.pdf yourInput.mkd
Note that you should have LaTeX Beamer installed for that.
In Ubuntu, you can do sudo apt-get install texlive-latex-recommended to install it. If you use Windows, you may try this answer.
You may also want to try the HTML/CSS output from Slidy:
pandoc --self-contained -t slidy -o output-slidy.html yourInput.mkd
It has a decent printing output, as you can check out trying to print the original.
Read more about slideshows with pandoc here.
Easy online solution: dillinger.io.
Just paste your Markdown content into the editor on the left and see the (html) preview on the right. Then click Export as on the top and chose pdf.
It's based on the open source dillinger editor.
Adding to elias' answer, if you want to separate text in slides, just put *** between the text you want to separate. For your example to be in several pages, write it like this:
### Hello
- abc
- def
***
### Bye
- ghi
- jkl
And then use elias' answer, pandoc -t beamer -o output.pdf yourInput.md.
I have UbuntuĀ 18.10 (Cosmic Cuttlefish) and installed the full package from texlive. It works for me.
Previously I had used the npm markdown-pdf answer. However, on a fresh install of UbuntuĀ 19.04 (Disco Dingo) I had issues getting it to install correctly.
Instead I started using the Visual Studio Code package: "Markdown PDF"
Details:
Name: Markdown PDF
Id: yzane.markdown-pdf
Description: Convert Markdown to PDF
Version: 1.2.0
Publisher: yzane
Visual Studio Marketplace link: https://marketplace.visualstudio.com/items?itemName=yzane.markdown-pdf
It has worked consistently well. If you've had issues getting other answers to work, I would recommend trying this.
I've managed to get a stable Markdown -> HTML > PDF pipeline working with the MarkReport project.
It is a bit more than what Pandoc will do though, since it is based on WeasyPrint and is therefore aimed for clean report publishing, with cover, headers, sections, ...
It also enriches the HTML with syntax highlighting and LaTeX equations.
Simple way with iOS:
Use Shortcuts app (by Apple)
Make Rich Text From Markdown: Clipboard
^
Make PDF from Rich Text From Markdown
^
Show [PDF] in Quick Look
Just copy text and run the shortcut. Press share in Quick Look (bottom left) to store or send it. I use this to quickly convert Joplin notes to pdf.
I found that many markdown-to-pdf converters produce files that I don't find exactly neat-looking. However there is a solution to this.
If you're using IntelliJ, you can use a plugin called "Markdown". The export function uses pandoc as an engine so you probably will need to install that along with pdf-latex. https://pandoc.org/installing.html
In IntelliJ, under Tools > Markdown Converter > Export Markdown File To...
And there you go, a clean looking document. Additional styling can be added via a .css stylesheet.