Not able to add <br> to value in web.config - web-config

I want to display some message and I want to store the value in web.config
<add key="Msg" value="Incompatible Format! <br> Please select Image file"></add>
here i get error in <br> and its considering the text after that as a different value
I tried using escape sequence /<br/>

You need to html encode the value
Incompatible Format! <br> Please select Image file

I found from asp.net forum that i need to use
<br>
which is equivalent to <br>

You need to escape such characters in XML/HTML. See here for more details.
For XML I would normally expect to be able to enclose the entire string in a CDATA section. However it appears (from the comments below) that this isn't an option for web.config

Related

How can i filter files which does not have current piece of code? Using VSC

i'm working with hunderts of files. Every file must include this piece of code. I know how to find files which have it included. How can i reverse it please? I use VSC
<p class="travelingRules">
Podmínky cestování do
<a
href="https://www.mzv.cz/jnp/cz/encyklopedie_statu/evropa/recko/cestovani/index.html"
title="Podmínky pro cestování do Řecka"
target="_blank"
><b>Řecka</b></a
>.
</p>
You can do it with this search:
Find:
(?<!\n)^(?![\s\S]*<p class="travelingRules">
Podmínky cestování do
<a
href="https://www.mzv.cz/jnp/cz/encyklopedie_statu/evropa/recko/cestovani/index.html"
title="Podmínky pro cestování do Řecka"
target="_blank"
><b>Řecka</b></a
>.
</p>)
(?<!\n)^ get the very first position in the file.
(?![\s\S]*...... a negative lookahead that will look at every character position for the following text - you can just copy and paste your text in the search across files find input after (?<!\n)^(?![\s\S]*. Only files that do not have that following text will be found.
No doubt performance is quite bad as I assume it goes character by character to see if the following is a match for your pasted text. You will have to see if performance is a problem in your specific case.

How to add empty spaces into MD markdown readme on GitHub?

I'm struggling to add empty spaces before the string starts to make my GitHub README.md looks something like this:
Right now it looks like this:
I tried adding <br /> tag to fix the new string start, now it works, but I don't understand how to add spaces before the string starts without changing everything to . Maybe there's a more elegant way to format it?
You can use <pre> to display all spaces & blanks you have typed. E.g.:
<pre>
hello, this is
just an example
....
</pre>
Markdown really changes everything to html and html collapses spaces so you really can't do anything about it. You have to use the for it. A funny example here that I'm writing in markdown and I'll use couple of here.
Above there are some without backticks
Instead of using HTML entities like and   (as others have suggested), you can use the Unicode em space (8195 in UTF-8) directly. Try copy-pasting the following into your README.md. The spaces at the start of the lines are em spaces.
The action of every agent <br />
  into the world <br />
starts <br />
  from their physical selves. <br />
I'm surprised no one mentioned the HTML entities   and   which produce horizontal white space equivalent to the characters n and m, respectively. If you want to accumulate horizontal white space quickly, those are more efficient than .
no space
 
  
  
Along with <space> and  , these are the five entities HTML provides for horizontal white space.
Note that except for , all entities allow breaking. Whatever text surrounds them will wrap to a new line if it would otherwise extend beyond the container boundary. With it would wrap to a new line as a block even if the text before could fit on the previous line.
Depending on your use case, that may be desired or undesired. For me, unless I'm dealing with things like names (John Doe), addresses or references (see eq. 5), breaking as a block is usually undesired.
Markdown gets converted into HTML/XHMTL.
John Gruber created the Markdown language in 2004 in collaboration with Aaron Swartz on the syntax, with the goal of enabling people to write using an easy-to-read, easy-to-write plain text format, and optionally convert it to structurally valid HTML (or XHTML).
HTML is completely based on using for adding extra spaces if it doesn't externally define/use JavaScript or CSS for elements.
Markdown is a lightweight markup language with plain text formatting syntax. It is designed so that it can be converted to HTML and many other formats using a tool by the same name.
If you want to use »
only one space » either use or just hit Spacebar (2nd one is good choice in this case)
more than one space » use +space (for 2 consecutive spaces)
eg. If you want to add 10 spaces contiguously then you should use
space space space space space
instead of using 10 one after one as the below one
For more details check
Adding multiple spaces between text in Markdown,
How to create extra space in HTML or web page.
After different tries, I end up to a solution since most markdown interpreter support Math environment.
The following adds one white space :
$~$
And here ten:
$~~~~~~~~~~~$
As a workaround, you can use a code block to render the code literally. Just surround your text with triple backticks ```. It will look like this:
2018-07-20 Wrote this answer
Can format it without
Also don't need <br /> for new line
Note that using <pre> and <code> you get slightly different behaviour: &nbsp and <br /> will be parsed rather than inserted literally.
<pre>:
2018-07-20 Wrote this answer
Can format it without
Also don't need for new line
<code>:
2018-07-20 Wrote this answer
Can format it without
Also don't need for new line
You can also use spaces from the known list:
  &hairsp;
'6-per-em space'  
'narrow no-break space'  
'thin space'    
'4-per-em space'   &emsp14;
'no breaking space'  
'punctuation space'   &puncsp;
'3-per-em space'   &emsp13;
'en space'    
'figure space'   &numsp;
'em space'    
I have tried so many methods on Github markdown.
Only starting the line with </br> with a normal empty line underneath works for me.
(so two line in total; one just </br> and one is empty)
One line of </br> will do the line break. The reason for the empty line underneath is that it won't mess up the formats of the content coming up.

HTML entities in attributes with tinymce

When I have doble marks encoded in my HTML attributes, tinymce breaks that attributes.
For example:
data-value="ab&quote;----&quote;"> will be seen in source code: <div data-type="more-posts" data-value="ab">Hello</div>
http://codepen.io/anon/pen/MKYrbJ
How can I fix this?
If you would have real double quotes here your HTML would not be valid anymore because attributes use them.
It will be best do handle those when you save that content to your database.
You could replace them with single quotes - those wouldn't break the markup.

Using mPDF to create a PDF from a HTML form

I want to use mpdf to create my PDF-files because I use norwegian letters such as ÆØÅ. The information on the PDF-file would mostly consist of text written by the user in a HTML form. But, I have some problems.
When using this code:
$mpdf->WriteHTML('Text with ÆØÅ');
The PDF will show the special characters.
But when using this:
<?php
include('mpdf/mpdf.php');
$name = 'Name - <b>' . $_POST['name'] . '</b>';
$mpdf = new mPDF();
$mpdf->WriteHTML($name);
$mpdf->Output();
exit;
?>
The special characters will not show.
The HTML form looks like this:
<form action="hidden.php" method="POST">
<p>Name:</p>
<input type="text" name="name">
<input type="submit" value="Send"><input type="reset" value="Clear">
</form>
Why won't the special characters show with this method? And which method should I use?
Since echoing the POST-data back onto the website does not show the characters as well, this clearly isn't an issue with mpdf. When using content including non-Ascii characters, special care about the websites character encoding has to be taken.
From the mpdf-documentation it can be seen that it supports UTF-8 encoding, so you might want to use that for your data. POST-data is received in the same encoding that is used by the website. So if the website is in latin-1, you will need to call utf8_encode() to convert the POST-data to unicode. If the website already uses UTF-8 you should be just fine.
If you don't set a specific encoding in the website header (which you should always to avoid this kind of trouble), encoding might depend on several factors such as the operating system and configuration on the server or the encoding of the original php sourcefile which, as it turns out, is influenced by your own OS configuration and choice of editor.

Only display one paragraph of text

You can set what the Facebook Share preview says. I would like it to be the first paragraph of my movable type entry. The people who make entries sometimes use
<p>
tags or they use the rich editor which puts in two
<br /><br />
tags to separate paragraphs.
Is there a way I can have movable type detect when the first paragraph end and only display the first paragraph? I would like to add that to my entry template so it will add some information to my head.
EntryBody has a lot of attributes to help format the output of the tag. You can use those to change the content so it shows up correctly in HTML, JavaScript, PHP, XML or other forms of output.
If you understand how to use regular expressions, you can use that and an additional language, say PHP, to break the body up into an array and only output the first paragraph or element of the array.
The simplest thing, though, I would think, would be to do something like
<mt:EntryBody words=100>
That will cut off the entry body after the first 100 words. You could also require users to upload an excerpt with the entry and use the entry excerpt for Facebook, instead.