Visual Studio format document - how to write it in C #

I need to write C # code that overrides the Render System.Web.UI.Page method and then reformat the HTML before presenting it in a browser. This is purely experimental, so overhead is not a problem right now.

Perhaps I am a little versed in regular expression methods and would like to use them here, but I cannot imagine a real concise and elegant way to format an HTML document beautifully. I was able to completely minimize HTML using a regex, but as for the right indentation, I'm at a dead end.

So, if you had an HTML string using C #, how would you reformat it in the same way as the Document Studio Format Document function? Any ideas would be greatly appreciated.

+4
source share
1 answer

Use Tidy . I used this .net shell quite successfully.

+2
source

Source: https://habr.com/ru/post/1310865/


All Articles