Is there an open-source library or code-sample in C#, that will re-indent a string of HTML code?
For example, convert this:
<li>
this
</li><li>that
</li>
To this:
<li>
this
</li>
<li>
that
</li>
Note: I don't want any of the HTML to be altered or moved around the way HTML Tidy does.
I only want the markup to be re-indented, nothing else.
Using Notepad++ if you paste your sample in and choose Language | Html and then Text FX | Text FX Html Tidy | Tidy Reindent Xml ...
Your sample becomes:
<li>
this
</li>
<li>
that
</li>
Related
I am using google fonts in html and I want to put a google font (chevron_icon) at the front of a link but the problem is that it is placing it under the link instead of front. Here is my code.
<div class="mobile-navigation">
<ul id = "mobile-nav" class="side-nav">
<li>
Fashion <i class="material-icons">chevron_right</i>
<ul id = "submenu1">
<li>Shirts</li>
<li>Jackets</li>
<li>Jeans</li>
<li>T-Shirts</li>
<li>Underwear</li>
</ul>
</li>
<li>
Electronics
</li>
</ul>
</div>
The output that it shows is something like this.
File
>
Electronics
I want the following output.
File>
Electronics
You are placing the chevron in the wrong place, you need to put it like so:
Fashion <i class="material-icons">> (chevron_right)</i>
Here is a working fiddle: https://jsfiddle.net/vtkLy29r/1/
Try this instead
Fashion <i class="material-icons">chevron_right</i>
I have an eBay shop and when I make a listing I have a pre made template and I just import information to this template.
I have a short description, features, and specifications. And I need to add automatically <li></li> to every line and a pre made HTML table with custom style, Which will know how to separate with "/" symbol like I have in my private listing tool.
Is this even possible? And if it is any idea how?
I do not believe Magento works in that manner however there is an easy efficient way to accomplish this manually.
Try putting the code in Sumblime text 3 with teh Emmet plugin.
From there you can type a command like ul>li*8 (the 8 is the # of items or <li></li> tags) and then press the tab key.
the results will be
<ul>
<li> </li>
<li> </li>
<li> </li>
<li> </li>
<li> </li>
<li> </li>
<li> </li>
<li> </li>
</ul>
From there you can fill in the blanks between the <li></li>.
I'm trying to write this code:
<ul>
<li> 1
<li> 2
<li> 3
Whithout </li>.
How would this html code look on the Jade lang?
I don't think you should do this.
But here's a way (a really dirty hack. Not recommended!) - writing li/ would mean that li is self closing. So if you have doctype html, it would generate the desired output.
doctype html
...
ul
li/
| 1
li/
| 2
The output:
<ul>
<li> 1
<li> 2
</ul>
Again, you shouldn't do this. Just close the goddamn tag.
My markdown page contains these lines:
- [Section1](#section1)
- [Subsection1](#subsection1)
- [Subsection2](#subsection2)
- [Section2](#section2)
- [Section3](#section3)
- [Section4](#section4)
The expected output (assume each bullet is a hyperlink):
Section1
Subsection1
Subsection2
Section2
Section3
Section4
The actual output (assume each bullet is a hyperlink):
Section1
Subsection1
Subsection2
Section2
Section3
Section4
I don't know why Github/Jekyll server doesn't generate the expected output.
When I viewed the source in the browser (Chrome), I found this (which is not expected):
<ul>
<li>
<p><a href='#section1'>Section1</a></p>
<ul>
<li><a href='#subsection1'>Subsection1</a></li>
<li><a href='#subsection2'>Subsection2</a></li>
</ul>
</li>
<li>
<p><a href='#section2'>Section2</a></p>
</li>
<li>
<p><a href='#section3'>Section3</a></p>
</li>
<li>
<p><a href='#section4'>Section4</a></p>
</li>
</ul>
Why do I see <p> tags here? Something wrong with the generator or my markdown code?
How should I fix it?
I have just run a few tests and it looks like it is the markdown processing engine that is causing the issue.
With the Maruku markdown engine the blank lines are added.
With the redcarpet markdown engine no additional lines are added.
With the kramdown markdown engine no additional lines are added.
(Can't test with rdiscount as it doesn't install on Windows)
In visual studio, when I paste an html snippet into the source window of an aspx/ascx file the IDE re-indents the contents. For instance, if I paste this ...
<div><ul><li>Item 1</li><li>
Item 2</li><li>Item 3</li></ul>/div>
.. the ide will reformat the text to ....
<div>
<ul>
<li>Item 1</li><li>Item 2</li><li>Item 3</li></ul>
</div>
But really, I want the html formatted like this ...
<div>
<ul>
<li>
Item 1
</li>
<li>
Item 2
</li>
<li>
Item 3
</li>
</ul>
</div>
How do I change the way VS indents html to the above?
You can change this by introducing custom formatting for the text (HTML) editor, got to:
Options -> Text Editor -> HTML -> Formatting -> Tag Specific Options (Button)
-> Client HTML Tags -> a -> Set Line breaks dropdown to Before and after
Do this for all the tags you want formatted differently.
Ctrl+K then Ctrl+D, will format the current document.
Ctrl+K then Ctrl+F, will format the selected text.