Can we use HTML features in TinyTex (R Markdown) - html

everyone!
I'm VERY new to Rmarkdown, so this may be a silly question. I was able to use HTML tags when kniting html file. However, I'm wondering If I could also use them when kniting a pdf file? I'm a bit used to HTML, so it would really help me if I could keep on with the HTML tags for my pdf reports as well. This post helped me a bit, but not quite.
For Example, when kniting a html file it works just fine, I'd like to use the same labels with TinyTex...is it possible?
Thanks in advance
Maybe these packages and this IF may be useful, but, I still cannot use the proper html labels..

You can not use HTML in the Markdown document and then render it directly to PDF.
However you could render the document to html and later covert it to pdf manually from browser print method or automatically e.g. with ‘pagedown::chrome_print’ package.
When the rmarkdown output is a pdf_output then a markdown is translated to latex and then rendered to pdf. There is no process to translate a part of the text from html to what … sth understandable and similar in latex.

Related

VSCode HTML "pieces"

I use "pieces" to avoid confusion with the built-in "snippets" functionality.
The scenario is that I am rendering pages server-side in Nodejs, and as part of that I want to code portions of html in files that can be used to assemble an entire page. These are project-specific so the snippets functionality is really not useful here. Problem is if I write an html file that for example only has a section, VSCode tells me there is an error since that file does not start with <DOCTYPE>, etc.
The goal here is reusable pieces instead of duplicating for each page. E.g. define a header.html file that only defines the <header> section, and can then be inserted into each rendered page.
Has anyone done similar? How to tell VSCode to treat as HTML but without demanding a complete document and indicating an error?

Python jupyter notebook after converting to html , numbering of markdown disappeared

I used Table of Contents(2) of Nbextensions to create Table of Contents. And the titles were created using markdown.
Every thing is working fine. I mean , it looks pretty good in notebook modus.
But after I had converted the ipynb file to html file , then the number of each title dispeared . I used menu: File->Download as -> HTML to do this.
I tried to use another option "File->Download as ->HTML with toc" to convert to html. Although it generated desired numbering , this is still not what I want, because it will generate not only an html file but also multiple images file if there are some plots in the notebook.
Does anyone have a good idea?
I just need a SINGLE html file with everything embedded .
The numbering of the Nbextensions will be present if you'll download the notebook to PDF (after installing the relevant packages).
Regarding the HTML version, I didn't find an answer yet and will be happy for help either.
Notebook uses different formatting for the content. Exporting option only provide you to save your code. So, that you can send it to others.
Better save the data in the python notebook form itself to maintain formatting. Even exporting you to PDF won't provide you true formatting as the notebook does. But it will be better than HTML.
But if you still want the HTML format, you can format it manually as a webpage. May the formatting get improved in next version of nbconvert.

Automatically convert markdown to html on browser refresh

Paul Irish gave some amazing insight on web tooling this time during googleio 2013. So he was presenting some slides that had been parsed into html from a markdown source i.e a .md file.
However one thing that surprised me was when he edited the source markdown for the slides in the chrome dev tools sources panel and then hit refresh, the .md automatically compiled again into the html to be output on the browser. Now I understand that the changes he made to the markdown file in the chrome dev tools were made also on his local file saved on the computer, but how did the markdown file automatically get converted into the html file upon save and refreshing the browser?
I am a complete beginner with markdown and I would really like to have this functionality. Any help is deeply appreciated
The whole purpose of markdown is that it is both human readable and machine readable. It is designed to be converted to HTML.
Depending on the language you are using, there are markdown parsers that create HTML for you.
For example, for PHP.
So, as an example, to have your server show the contents of say, homepage.md, your index.php file could have something like this:
$filename = $_GET['file'];
$content = markdown( file_get_contents( "path_to_markdown/{$filename}.md" ) );
print $content;
And, to see it in your browser you would go to example.com/?file=homepage
I will do my best to answer this.
HTML Mark down is a shorthand syntax that can be interpreted by a web browser to format or render the page in html.
this is taken from Stack Overflow.
eg
The syntax is based on the way email programs
usually do quotations. You don't need to hard-wrap
the paragraphs in your blockquotes, but it looks much nicer if you do. Depends how lazy you feel.
So, like converting from a file in notepad ++ from text to html. The file will be formatted using the basic rules of that particular syntax.
It also must be remembered, that programs are not mind readers. If the mark down code is not valid, neither will the corresponding html code. Just as saving a text file that is "supposed" to be formatted in html. It won't save as a working html file if the syntax is incorrect.
Also, markdown is not a total replacement for real code. It cannot cover the breadth and depth of the true coding language. I could liken it to pseudocode, but that is more of a lateral example.
In answer to your latest comment, If a second file is created from a first file (and the format is altered) -( in this case from mark down to html) - If the first file is then edited, without overwriting the changes into the second file, it cannot expect to be altered.
This is a good link a fellow SO gave me:
https://stackoverflow.com/editing-help
Please feel free to edit, if I have made an error.
I haven't tried this extension for Chrome but it seems to automatically render markdown (.md) files in Chrome.
https://chrome.google.com/webstore/detail/markdown-preview/jmchmkecamhbiokiopfpnfgbidieafmd?hl=en
In Firefox, I use the following extension for the same functionality.
https://addons.mozilla.org/en-US/firefox/addon/markdown-viewer/
No need for a separate .html file, just save the text file with .md extension and open it in the browser.
Hope that helps.

Using IcePDF or PDFBox to generate HTML page from PDF

I want to use IcePDF or PDFBox to extract content from PDF. But I don't now the way to continue generating HTML web pages from the text and images extracted.
You can convert pdf to html with PDFBox. Try this link.
By adding -html as parameter when you extract text, you will get html of the pdf. But it will not contain any image, graphics and other details. It will be only the text extracted from the pdf in html format.
If you want to create the exact look and feel of the pdf, there is no single step method in PDFBox. In my knowledge no library provides this facility to create exact html of the pdf. But using PDFBox you can extract images, text and its details. Using these details you have to create a logic to produce the html. We have done a project to convert pdf to html for azzist.com. We have accomplished the conversion using PDFBox. In azzist we are converting the resume to html format. (Still some font issues are there).
Scribd, google, dropbox, zoho etc have accomplished this conversion in a better way. You can have a look at any of these sites to check how they have accomplished this. (You will not get the logic. You have to find it out).

Is there a way to use Acrobat Reader in Perl to save multiple PDF files as HTML files?

I am using Xpdf for extracting text from PDF files which works well with -raw option, but now we want to convert the PDF files to HTML files for extracting the HTML formating tags like bold <b>, italics <i> etc with the text. Xpdf with the -html option does work, I have also tried using pdf2html for this but did not find it reliable as tags like <sup> and <sub> where missing.
We are now using Acrobat Reader to save the PDF files as HTML files which gives us all the HTML formatting tags.
Is there a way to use Acrobat Reader in Perl to save multiple PDF files as HTML files?
Thank you.
PDF styling information is completely arbitrary and can't be reliably mapped to HTML in any meaningful way. One strategy that I've had some luck with is to use the -xml option to pdftohtml and then use LibXML to apply some heuristics to the output and come up with a reasonable HTML approximation of the original document.