NOTE or WARNING from package check when README.md includes images
The current preferred solution (at least as used by ggplot2
) is to store the images in man/figures/
. So in the README.Rmd
file, include something like the following setup chunk.
```{r, echo = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-"
)
```
That keeps the images tucked away in a place that won't generate cran check errors, but they are still part of the package. So you don't have to store them elsewhere or use calls to png::readPNG
.
Non-standard file/directory found at top level: 'README.Rmd' persists even after implementing suggested solutions
To exclude the file README.Rmd
from the tarball created by R, add
^README.Rmd
to the file .Rbuildignore
you already have. "Writing R Extensions" has more, should you need it.
How to add images to README.md on GitHub?
Try this markdown:
![alt text](http://url/to/img.png)
I think you can link directly to the raw version of an image if it's stored in your repository. i.e.
![alt text](https://github.com/[username]/[reponame]/blob/[branch]/image.jpg?raw=true)
How can I create a text box for a note in markdown?
What I usually do for putting alert box (e.g. Note or Warning) in markdown texts (not only when using pandoc but also every where that markdown is supported) is surrounding the content with two horizontal lines:
---
**NOTE**
It works with almost all markdown flavours (the below blank line matters).
---
which would be something like this:
NOTE
It works with all markdown flavours (the below blank line matters).
The good thing is that you don't need to worry about which markdown flavour is supported or which extension is installed or enabled.
EDIT: As @filups21 has mentioned in the comments, it seems that a horizontal line is represented by ***
in RMarkdown. So, the solution mentioned before does not work with all markdown flavours as it was originally claimed.
How to add screenshot to READMEs in github repository?
If you use Markdown (README.md):
Provided that you have the image in your repo, you can use a relative URL:
![Alt text](/relative/path/to/img.jpg?raw=true "Optional Title")
If you need to embed an image that's hosted elsewhere, you can use a full URL
![Alt text](http://full/path/to/img.jpg "Optional title")
GitHub recommend that you use relative links with the ?raw=true
parameter to ensure forked repos point correctly.
The raw=true
parameter is there in order to ensure the image you link to, will be rendered as is. That means that only the image will be linked to, not the whole GitHub interface for that respective file. See this comment for more details.
Check out an example: https://raw.github.com/altercation/solarized/master/README.md
If you use SVGs then you'll need to set the sanitize attribute to true
as well: ?raw=true&sanitize=true
. (Thanks @EliSherer)
Also, the documentation on relative links in README files: https://help.github.com/articles/relative-links-in-readmes
And of course the markdown docs: http://daringfireball.net/projects/markdown/syntax
Additionally, if you create a new branch screenshots
to store the images you can avoid them being in the master
working tree
You can then embed them using:
![Alt text](/../<branch name>/path/to/image.png?raw=true "Optional Title")
How to disable code inspection errors in README.md file in Android Studio
After doing some further research I come to conclusion that these errors are not from Android Studio itself but there are plugins for markdown
format like Markdown Navigator
and Markdown Support
if any of them is installed and enabled then you will see above errors in README.md
file.
I think this spell check is built in feature of these plugins and can not be controlled from Android Studio.
One option what I think is to disable these plugins and you are good to go.
You can disable these plugins from (Android Studio 3.1.4 MacOS) Preferences > Plugins
(or File > Settings > Plugins
in Linux) by unchecking them and restart (don't forget it) your Android Studio:
Include my markdown README into Sphinx
You need to edit your readme_link.rst
as follows:
Readme File
===========
.. mdinclude:: ../../README.md
Note that the section header is designated with =
characters rather than -
characters.
There are two factors that contribute to that.
How include works
Standard include
(not mdinclude
) actually reads the content of the source file and simply copies the raw text in place of the directive. M2R's mdinclude
first converts the source Markdown text to rst
, and then, like include
, copies that test in place of the directive.
Therefore, by the time the rst
document is parsed, you have one complete rst
document from both the parent and included files. That one complete document needs to be a valid rst
document, which takes us to the second point...
Header levels must be consistent.
As a reminder, the reStructuredText Spec explains:
Rather than imposing a fixed number and order of section title adornment styles, the order enforced will be the order as encountered. The first style encountered will be an outermost title (like HTML H1), the second style will be a subtitle, the third will be a subsubtitle, and so on.
...
All section title styles need not be used, nor need any specific section title style be used. However, a document must be consistent in its use of section titles: once a hierarchy of title styles is established, sections must use that hierarchy.
Therefore, the header levels in the included child must be consistent with the header levels in the parent. As M2R generates a rst
document, you (as the end user) don't get to specificity which character is used to define each section level. Therefore, to maintain consistency, you need to use the scheme defined by M2R:
- Rst heading marks are currently hard-coded and unchangeable.
- H1:
=
, H2:-
, H3:^
, H4:~
, H5:"
, H6:#
As you can see, level 1 headers use the =
character and level 2 headers use the -
character. Therefore, the same scheme needs to be used in the parent readme_link.rst
file (you were using the reverse).
An alternate solution
The reStructuredText spec also states:
Underline-only adornment styles are distinct from overline-and-underline styles that use the same character.
Therefore, you could use overline-and-underline styles in your parent document and it wouldn't matter which characters you used for which level as M2R only appears to use underline-only styles. So this would have worked as well:
-----------
Readme File
-----------
.. mdinclude:: ../../README.md
This has the added benefit (or negative -- depending on your point of view) that all headers in the included child document will now be one level lower that they would on their own. Therefore, the child is more semantically "nested" in the parent (more than one h1
in a single HTML document is often considered to not be semantic although it is technically "valid"). Of course, this may or may not be what you want, which is why it is labeled an "alternate solution".
Related Topics
How to Place an Image in an R Shiny Title
R - Min, Max and Mean of Off-Diagonal Elements in a Matrix
How to Represent Polynomials with Numeric Vectors in R
Font Awesome in R, Loaded But Not Found by Waffle
Split a Data Frame Column Containing a List into Multiple Columns Using Dplyr (Or Otherwise)
Frustration Using Rjava to Call a Third Party Java Jar
R Shiny Action Button and Data Table Output
Copying List of Files from One Folder to Other in R
Add Hline with Population Median for Each Facet
Multiple Groups in Geom_Density() Plot
How to Use the Function Curve in [R] to Graph a Normal Curve
How to Write Data from R to Postgresql Tables with an Autoincrementing Primary Key
Ggplot2: How to Set the Default Fill-Colour of Geom_Bar() in a Theme
How to Plot a Boxplot from Previously-Calculated Statistics Easily (In R)