Unbolden and italicize headers in RMarkdown - html

I'd like to create subheaders that are not bold and italicized in an RMarkdown file. When I try manually use html tags like this
<h2 style="font-weight: normal;">*Header Example*</h2>
it gets indented as if it's a new paragraph. I do not want the subheader to be indented.
I have the setting in my YAML:
header-includes:
- \setlength{\parindent}{30pt}
If I use the above approach, can I still control the line spacing between headers and paragraphs?
And there doesn't seem to be a difference between h1 and h2 tags with the above approach.

I used the HTML \small element to make the text smaller and \textnormal to unbold.
# HEADER EXAMPLE $(\small{\textnormal{subheader example}})$
This keeps the subheader on the same line as the header. You can also easily italicize with *s.
# HEADER EXAMPLE $(\small{\textnormal{*subheader example*}})$
This way it doesn't get indented into a new line and you can still control the line spacing between headers and paragraphs.

Related

SSRS horizontal alignment in a straight line

I'm new to SSRS and I'm unable to align the sentence horizontally in a straight line in SSRS using HTML tag.
I've got a very long word and I want it to fit in a line. I tried using can grow in SSRS but it expands the text box in a vertical manner with the word moving to the next line. However, I want the words to fit in a horizontal line and the extra to be visible as long as the text box holds.
Is there any HTML tag/code in SSRS which would help me achieve the same?
SSRS only supports a very limited set of HTML tags, so HTML is often not that helpful to format your text.
From this MSDN article, the list of supported tags are:
Hyperlinks: <A HREF>
Fonts: <FONT>
Header, style and block elements: <H{n}>, <DIV>, <SPAN>, <P>, <HN>
Text format: <B>, <I>, <U>, <S>
List handling: <OL>, <UL>, <LI>
So we can achieve the result you are after (that is, show as much of the text as possible in the horizontal confines of the text box) by combining the <DIV> HTML element with non-breaking spaces.
To do this, follow these steps:
Set the cell's CanGrow property to False so it won't expand vertically
Set the cell's Markup Type to be HTML - Interpret HTML tags as styles
Enclose the field's text in <DIV> tags and replace the spaces in the text with non-breaking spaces by setting the cell's expression to:
="<DIV>" & Replace(Fields!FieldName.Value, " ", "&nbsp") & "</DIV>"

HTML rendered in the page looks ok, but the actual result is no [duplicate]

This question already has an answer here:
Why is a newline converted into a ' ' in any given .html file?
(1 answer)
Closed 6 years ago.
I am developing a page, I am returning data from the server (sharepoint), and displaying it in a paragraph element using $("#Fees").html();
The text should contain carriage return, it shows ok when I view it inside the rendered html itself like the following:
<p id="Fees">Fees should be like the following:
Main fees:
1- Fee1
2- Fee2</p>
As you can see, inside my paragraph, the carriage return is visible, however, on my page, it's not, as you can see below:
Fees should be lik the following: Main fees: 1- Fee1 2- Fee2
What should I do? Is it something related to code, or is it a known thing with paragraph tags? I tried it with div tag, and same result. Any idea would be great.
add the following CSS
#Fees {
white-space: pre
}
This will make that <p> tag behave like a pre tag, without all the other changes a <pre> tag has (like font for instance)
Multiple White Spaces and Line Breaks are read in HTML as a Single White Space. Use the <pre> tag if you want to preserve White Space, either that, or use to create Non-breaking White Spaces in conjunction with <br /> to create Block-level line breaks. The CSS solution to make White Space act like the <pre> tag would also work: p{white-space:pre;}.
I think you should translate your line feeds into <br> tags before putting your data into the paragraph. Regular line feeds inside html code don't get rendered.
For example, assuming you have your text inside a string before writing it in your <p>:
yourstring.replace(/(?:\r\n|\r|\n)/g, "<br>");
Then you move it into the <p> tag.

Why Aren't My <div> Tags Given Line Breaks?

I wrote a poem, and I re-wrote the poem in HTML so I could include it on my blog. However, even though I wrapped each stanza in <div> tags, there are no line breaks between them like there are supposed to be.
According to w3schools.com, "By default, browsers always place a line break before and after the <div> element. However, this can be changed with CSS."
You'll note I have no CSS in the code, however, so I don't know why it doesn't have line breaks.
JSFiddle: https://jsfiddle.net/43dn9tr9/2/
I suppose you want the stanzas to be separated by white space, which is not the same as line breaks.
You can achieve this by using <p> instead of <div>.
See https://jsfiddle.net/43dn9tr9/6/
This works because browsers give <p> a vertical margin by default. You can make <div> behave the same way using CSS.
<style>
div.stanza {
margin: 20px 0;
}
</style>
<div class="stanza">
This is Stanza 1, Line 1,<br>
This is Stanza 1, Line 2,<br>
This is Stanza 1, Line 3.<br>
This is Stanza 1, Line 4.
</div>
[...]
As a brief aside, w3schools is legendary for being abject shite. You may want to try something more reputable.
The output of your HTML is entirely correct- the divs are on new lines. The explanation that w3schools has given you is not really very descriptive, since it implies line breaks that don't really exist. In fact, it's best not to think of layout in terms of line breaks, because that's not how the model works at all.
It might be better to say that divs are blocks which are arranged vertically with respect to each other (ignoring CSS of course). In your output, the three divs are arranged vertically. A good demonstration of this is to replace your br tags with placing each line inside its own div, which achieves an identical result. https://jsfiddle.net/43dn9tr9/3/
Your div tags do have line breaks. Line breaks are the same thing as you get with your br tags. That's why br tags are called that, they are line break tags.
Without line breaks the line would just continue like this:
This is Stanza 1, Line 4. This is Stanza 2, Line 1,
I think you are looking for vertical margin between your stanzas. If you don't want to use CSS, the P tag has vertical margin by default, which approximates the spacing between stanzas of a poem.
See this question (but ignore the down-voted first, accepted answer).

CKEditor Header Styles - h1 is applied to entire paragraph block and not just the selected text

I'm using CKEditor in OpenCart 1.4.9.3. My problem is with the paragraph tags it automatically add and how it handles applying header tags. Say I have this text:
Example text here
This is some example text.
CKEditor has them both in the same paragraph block even though they're on different lines. I highlight Example text here and select h1. It makes both lines h1 instead of just my selected line.
How can I fix this? I imported over 1000 products so I can't very well go through and replace every p with a br, especially since in any new product, the editor will add p tags anyway. I am aware I can add the header styles in Source, but my coworkers can not handle html. They need to be able to highlight a line and change it to h1 or h2 without hassle.
Thanks!
Are you sure that it works if there's a br to make a linefeed, but not when there's a paragraph?
As I've figured, the h1 would apply to the whole paragraph, ie change the p to h1.
Try the same in your Word Processor, with linefeed (ctrl+enter) or new paragraph (enter).

HTML/CSS - Paragraphs display line breaks from the source code

For some reason my paragraphs are displaying line breaks when there is no <br/> tag being used! So if I type content into the HTML and hit return a few times it gets formatted that way.
How can I prevent that? Can I not just get it to flow?
Browsers will automatically render paragraph tags to have some padding unless you explicitly style it not to... is this the problem?
If so, p {padding: 0; margin:0;}
If not, try giving us some of your code and a better explanation of exactly what the problem is.
Put this into your stylesheet:
p {white-space:normal;}
The <pre> tag will cause white space to display. So will a CSS rule like this:
p {white-space: pre;}
Could either of those be the problem?
If the text is being broken to make it fit, you cannot / should not try to stop the text from breaking. However, if your problem is that the text is breaking at an undesirable point and you would rather have it break at a more appropriate point, use the following:
<nobr>... Unwanted break point here ...</nobr>
enclose the unwanted break point with nobr tags.
And, add the following at the appropriate break point:
... some text ... ​ Text on next line