using custom blocks defined and illustrated in bookdown book - r-markdown

The bookdown book illustrates a number of useful custom blocks such as notes and warning symbols. The cookbook talks about them again.
When you download the demo book to get started, there is no way to use these custom blocks, why is that? Whenever, I try to use them as illustrated in the books, they do not compile. Why aren't they just part of the basic implementation of the demo book?
Since they are not part of the basic demo book, can someone outline a step by step process for getting them to work if you are just using the demo book as a starting point for a rmarkdown book?

You need to add the classes to your css file:
.rmdcaution, .rmdimportant, .rmdnote, .rmdtip, .rmdwarning {
padding: 1em 1em 1em 4em;
margin-bottom: 10px;
background: #f5f5f5 5px center/3em no-repeat;
}
.rmdcaution {
background-image: url("../images/caution.png");
}
.rmdimportant {
background-image: url("../images/important.png");
}
.rmdnote {
background-image: url("../images/note.png");
}
.rmdtip {
background-image: url("../images/tip.png");
}
.rmdwarning {
background-image: url("../images/warning.png");
}
Put the images in the specified folder.

Related

WebStorm, is it possible to use GitHub markdown theme in preview while using overall dark theme?

Tried to follow this manual, but it doesn't work: https://www.jetbrains.com/help/webstorm/markdown.html#css
Is it possible at all? Did somebody succeed in this task?
Yes, it's possible.
Download one of the markdown css files from https://github.com/sindresorhus/github-markdown-css/.
In the Markdown prefs, set the custom css to point to that file (URLs don't work).
Paste this into the "Add CSS rules:" field:
.markdown-body {
box-sizing: border-box;
min-width: 200px;
max-width: 980px;
margin: 0 auto;
padding: 45px;
}
#media (max-width: 767px) {
.markdown-body {
padding: 15px;
}
}
At the top of your markdown file, insert this (the blank line is important):
<div class="markdown-body">
At the bottom of your markdown file, insert this:
</div>
That's it!

Ellipsis or indentation for overflowing text in Table of Contents Rmarkdown

My floating table of contents in Rmarkdown looks very messy now when the header overflows into the next line.
Can anyone help to truncate it with ellipsis but appears when mouse cursor hovers on it?
Alternatively, how can I adjust the indent of the overflowing line to align with 1.1? Thanks.
2 years late to this one, but I've been bothered by the same issue recently and just worked out a fix. Not sure about the ellipsis, but to fix the text wrapping and get clean indents, you can include the following somewhere in your .Rmd file, like after the YAML heading or at the very end of the document:
<style>
#TOC > ul.tocify-header > li:first-child {
text-indent: initial;
padding-left: 1em;
}
#TOC ul.tocify-subheader[data-tag="2"] > li.tocify-item {
text-indent: initial;
padding-left: 2em;
}
#TOC ul.tocify-subheader[data-tag="3"] > li.tocify-item {
text-indent: initial;
padding-left: 3em;
}
#TOC ul.tocify-subheader[data-tag="4"] > li.tocify-item {
text-indent: initial;
padding-left: 4em;
}
</style>
You can add or subtract subheaders as needed depending on how many nested levels you want. Alternatively, if you feel this clutters your .Rmd, you could save it separately in a .css file in the same folder as your .Rmd and call it in your YAML, e.g.,
title:
author:
date:
output:
html output:
css: header.css
toc: true
toc_depth: 4
toc_float:
collapsed: false

Django. Static files not load

I encountered such a problem, static files (pictures) are not loading in my Django project.
The most amazing thing is that I did not change anything, just yesterday, everything worked, and today the pictures are refusing to load.
If I follow a direct link to an object, the picture is and opens. However, if you register it in a CSS file, the path to the image is crossed out, and the inscription in the browser debugger "invalid property value"
This is weird, but it works. Maybe someone will be useful. The graphic files that were the background were not loaded.
The background was assigned through CSS according to this principle:
#showcase-inner {
background: url(../img/flowers.jpg) no-repeat top center fixed/cover;
position: relative;
overflow: hidden;
min-height: 350px; }
I repeat. Previously, everything worked, at what point everything went wrong, I did not follow. But when I changed CSS, the graphics started loading:
#showcase-inner {
background-size: cover cover;
background-repeat: no-repeat;
background-position: top center;
background-image: url(../img/building.jpg);
background-attachment: fixed;
position: relative;
overflow: hidden;
min-height: 350px; }

Bigcartel - availability as number instead of bar?

This is likely a very simple question that I am brainfarting on - Is there a way to have my shop with the Luna theme show an actual numerical quantity available rather than the simple bars?
I'm certain I have seen this done somewhere but I can't find an example of the code anywhere.
To show the quantity in your inventory bar area, head to Customize Design > Advanced > CSS and add this at the very bottom:
#product_inventory .bar span em {
display: block;
}
I know this question is old but I have changed the following in the Luna theme.css file to provide this functionality as the first answer no longer works.
Edit the css to replace display: none with display: block
.inventory-bars .inventory-label {
color: {{ theme.secondary_text_color }};
font-size: 12px;
display: block;
position: absolute;
right: 0;
top: -16px;
}
Numerical quality shown
[bigcartel]

How can I do a text gradient with a drop shadow on a gradient background?

Here's what I need to pull off in CSS (it's terribly ugly, but it shows my problem well as an example):
We've got a gradient over text with a drop shadow on a background that has a slight gradient.
I've tried every method I could find.
This method won't work with a text-shadow.
The PNG overlay method won't work because I don't have a solid color background.
This method won't work because it requires me putting the text string in the CSS and my text will be dynamic.
So, I'm stumped.
It doesn't need to work in every browser (I'm fine with ignoring IE, if necessary). If it only works in Webkit browsers, that'd be fine as well.
That should be the answer:
HTML
<h1><span>Filthy</span></h1>
CSS
h1 {
position: relative;
font-size: 300px;
line-height: 300px;
text-shadow: -3px 0 4px #006;
}
h1 span {
position: absolute;
top: 0;
z-index: 2;
color: #d12;
-webkit-mask-image: -webkit-gradient(linear, left top, left bottom, from(rgba(0,0,0,1)), to(rgba(0,0,0,0)));
}
h1:after {
content: attr(cssFilthyHack);
color: #000;
text-shadow: 3px 3px 1px #600;
}
JS
$('h1').each(function(i, e){
var el = $(e);
el.attr('cssFilthyHack', el.find('span').html());
});
The important thing is to use content: attr(cssFilthyHack); to extract the text from the h1 text. You could add the text a second time in html like this
<h1 cssFilthyHack="Filthy"><span>Filthy</span></h1>
Or you use the js jQuery method to do this automatically.
UPDATE
Replaced the a tag with span, added js function.
See the example here in action: http://jsfiddle.net/alligator/Gwd3k/