简体   繁体   中英

Markdown R - Embedded image as logo

I'm trying to put an image as logo, on the right hand side next to the title and want it to work embedded in a single HTML file, but I'm not succeeding (for instance, to share only the HTML file and not both the HTML file and the image).

Here is the code I have:

 ---
title: "Title"
header-includes: \usepackage{graphicx}
author: "Team"
date: "Date"

output: 
  html_document

---

<script>
   $(document).ready(function() {
     $head = $('#header');
     $head.prepend('<img src="Image_I_Want.png\" style=\"float: right;width: 250px;\"/>')


   });
</script>   


<br>

## 1) Some nice title

Thank you in advance!

Here is the link to logo.jpg :
https://s-media-cache-ak0.pinimg.com/736x/a7/e8/fa/a7e8fa149fb23e4cbcfe9e8406b6b911.jpg

<script>
       $(document).ready(function() {
         $head = $('#header');
         $head.prepend('<img src=\"logo.jpg\" style=\"float: right;width: 150px;\"/>')
       });
    </script>
    ---
    title: "Title"
    header-includes: \usepackage{graphicx}
    author: "Team"
    date: "Date"

    output: 
      html_document
    ---

This is going to be hard to do using Markdown. Markdown trades simplicity for control. I don't know how it prints out the title where you want your logo to be.

Two possible alternatives:

  • Create the HTML using 'knit', then edit it manually.
  • Write an RHTML document just using pure HTML.

If you don't know HTML, use a WYSIWYG program (or find a web designer).

The HTML you want is going to be something like:

<h1>My company title</h1><img style='float:right;' src='myimage.png'>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM