2
Answers

Html code readablity

vijay mani

vijay mani

9y
1.3k
1
How do I format the html source code (I have my html code in string format) for readability using C#?
I have to give alignment and spacing using code (indent for all child html elements) as similar to Visual studio.
My input:"<html><head></head><body><div><div>sample</div></div></body></html>"
Output should be:"
<html>
<head></head>
<body>
        <div>
             <div>
                    sample
             </div>
      </div>
</body>
</html>"
Answers (2)