W
W
web-developer20192019-04-13 21:40:30
HTML
web-developer2019, 2019-04-13 21:40:30

How can HTML code written in one line be converted into several lines depending on the depth of nesting of tags?

It is necessary that when a keyboard shortcut is pressed, the selected HTML code, written in one line, is converted into several lines according to the template, depending on the depth of nesting of the tags.
For example:
Before

<ul>
    <li><label for=""></label><input type="text"></li>
    <li><label for=""></label><input type="text"></li>
    <li><label for=""></label><input type="text"></li>
</ul>

After
<ul>
    <li>
         <label for=""></label>
         <input type="text">
    </li>
    <li>
        <label for=""></label>
        <input type="text">
    </li>
    <li>
        <label for=""></label>
        <input type="text">
    </li>
</ul>

Example 2
<p class="appointment-item"><input type="text" name="time" id="" placeholder="10:00" value=""></p>

<p class="appointment-item">
    <input type="text" name="date" id="" placeholder="08.10.2017" value="">
</p>

Etc.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Emil Rakhmatullin, 2019-04-13
@Emchik

Sublime Text 3 has a plugin: auto format html
Download it via Package Control and enjoy ;)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question