I'm using R, blowdown and Hugo to build a html site.
There is text specified in the .yml file which should have a single underscore at the end like header1_. The line should be in color, while the text is black.
In the YAML the text is specified as
title: "header1<span style=\"color:#ff5740\">_</span>"
In the corresponding html file the title is set using:
<h1 style="color:white">{{ .title | markdownify }}</h1>
This works very well
Now I want a second new line with the same style. Thus, I wrote in the YAML:
title: "header1<span style=\"color:#ff5740\">_</span><br>header2<span style=\"color:#ff5740\">_</span>"
Here the _ makes the second header italic...as expected in markdown.
Of course I can escape the line. But \_ or \__ are not working.The line don't show up or is separated by a space from the text. And using ```` changes the style somehow...the underscore is bold and the color ist different (compare it to the box at the bottom & figure 1).
Any ideas?
Related
i have a string stored in database which contains line break, it should looks like following when displaying on page:
abc
def
hkg
now i need to add this string to an email dialog as email content and its format should be:
my thymeleaf text template to generate email content looks like:
Test: [# th:each="g : ${gList}"]
Description:
[(${g.descr})]
However, after i added the template content to a textarea, it is:
that is there is no indent from line 2, this is not what i want.
how can i get the format like following for one string which contains multiple lines?
Test:
Description:
abc
def
hkg
The html code to show the email content in dialog is :
<div class="row">
<label class="col-2 text-right">Content:</label>
<textarea id="emailContent" class="col-9" v-model="email.content" >
</textarea>
</div>
another question is : what if this string is long but no line break, it only has spaces between words. in this case, it still display the rest of this string from line 2 without indent.
The string stored in the database is abc\ndef\nhkg therefore when you print it out you are getting:
Test:\n
....Description:\n
........abc\n
def\n
hkg
Since this is plain text and you don't have any of the formatting capabilities of html, you're going to have to modify the string itself. Basically, you need to replace your newlines \n with 8 spaces and a new line. You want the string to look like:
abc\n........def\n........hkg
As for what that looks like in Thymeleaf. Kind of ugly, but I think this should work for you:
Test: [# th:each="g : ${gList}" th:with="newline=${T(System).getProperty('line.separator')}"]
Description:
[(${#strings.replace(g.descr, newline, newline + ' ')})]
Since markdown does not have any options for centering text, but does allow html inline, I've added a tag which works fine for converting to html, but not to pdf using the pandoc-convert package in atom. How do I convert this file to pdf using pandoc-convert in atom while preserving the centered text.
---
geometry: margin=1.5cm
---
<center>
<h1> My name</h1>
My Address
myemail.com, my2ndemail.com
+1 (999) 999-9999 (cell)
</center>
#### Markdown Title
>Some block quoted text.
The advice from the comment above worked. In general, it appears the pandoc-convert in atom-editor works with latex commands for formatting the text. Looks like I need to learn more LaTeX. This is the code that worked for me in the end.
---
geometry: margin=1.5cm
---
\begin{center}
\Huge My Name
\\ \small My Address
\\ myemail.com, my2ndemail.com
\\ +1 (999) 999-9999 (cell)
\end{center}
#### Markdown title
>Some block quoted text.
I'm converting linebreaks and extra spaces.
def simple_format_plus(string)
(h(string).gsub(/\n/, '<br/>').gsub(' ', "\t")).html_safe
end
In my views I'm calling:
<p><%= simple_format_plus(post.content) %></p>
However the html output doesn't show the "\t" part. I've even tried disabling the css, but the problem still persists. For some reason I can't display more than one space in succession.
There are 3 spaces instead of 1 in this line .
still displays as:
There are 3 spaces instead of 1 in this line .
If I inspect the <p> element the extra spaces show up in the developer console however, but not in the browser.
tab can't be interpreted in HTML. You can use   for three or the number of times you want. The helper method can be re-written like
def simple_format_plus(string)
(h(string).gsub(/\n/, '<br/>').gsub(' ', "   ")).html_safe
end
Consecutive space characters are interpreted in HTML as a single space. If you want to display each space character as is in the source HTML file, then surround that part with <pre> ... </pre>.
I'm trying to create a two-line <h1> in Markdown, something along the lines of:
<h1>Title<br/>byline</h1>
The Markdown docs say:
When you do want to insert a <br /> break tag using Markdown, you end a line with two or more spaces, then type return.
Unfortunately, this only seems to work for paragraphs -- if I try it with an <h1> (dots · indicate spaces):
#·Title··
byline
the trailing spaces are ignored and I just get:
<h1>Title</h1>
<p>byline</p>
Can anyone tell me a workaround for this?
P.S. I'm using vanilla Markdown 1.0.1 from the command line.
Turns out the answer is just "use <br/>."
# Title <br/> byline
produces
<h1>Title <br/> byline</h1>
** facepalm **
Just use the alternative syntax for <h1>:
Title··
byline
========
You can also do double space at the end of the line.
For example, this text appears in the same line even though I've written it on the next line.
This appears on a new line.
The thing is there are 2 blank spaces after next line... (Consider those two dots as spaces)
Hope this helps. This also seems better than </BR>.
Reference: http://markdown-guide.readthedocs.io/en/latest/basics.html
I'm using Maruku (Ruby) to parse some Markdown formatted text. I have a problem when trying to format a block of code like such:
This is a normal line
# pretend this line is empty
printf("First line of code is OK");
printf("Second line of code (or any line thereafter) appears indented by an extra level, which is incorrect!");
So my first line of code (which I've indented in my md file by 4 spaces (or a tab), renders just as I'd expect. However, my second line of code (indented by exactly the same number of spaces) ends up being indented by an extra 4 spaces when the HTML is generated.
The output looks like this:
This is a normal line
<pre><code>printf("First line of code is OK");
printf("Second line of code (or any line thereafter) appears indented by an extra level, which is incorrect!");</code></pre>
I've tested my Markdown input with Gruber's "Dingus", and it renders as I'd expect (that is, both lines of code in a single block, both indented at the same level). But with Maruku, it's bunk.
I've also tried with RDiscount, but I get the same effect. I'm using Maruku because I need definition lists.
How SO formats it:
This is a normal line
printf("First line of code is OK\n");
printf("Second line of code (or any line thereafter) appears indented by an extra level, which is incorrect!");
It turns out this was not a Maruku problem but a HAML problem.
HAML is fussy when it comes to whitespace and preserving it. The solution was needing to use = preserve #my_html_string when rendering it.
For example, given layout.haml:
!!! 5
%html
%body
= yield
and index.haml
%article
= preserve #my_html_fragment_with_pre_and_code
Then it would render correctly for me.