我如何格式化 HTML 文档(一些标签被分成两行)

How can i format HTML document (some tags are breaked into two lines)

  Cli:=THTTPClient.Create;
  Result:=Cli.Get(URL).ContentAsString;
  Cli.Free;
  Memo1.Text:=Result;

它工作正常,但一些标签被破坏了。我明白了:

</div></div><div class="masthead_main container row"><div class="masthead_logo_search"><di
v class="masthead_logo"><a href="/">FAQs</a></div><div class="masthead_search"><form class="search" method="get" action="/search"

我需要这样的东西:

...
</div>
</div>
<div class="masthead_main container row">
<div class="masthead_logo_search">
<div class="masthead_logo">
<a href="/">FAQs</a>
</div>
<div class="masthead_search">
<form class="search" method="get" action="/search">
...

我不需要破坏标签。如何格式化 HTML?

我创建了函数!它对我有用:

function RestoreTags(Source:String):String;
var
 TagString:String;
 I:Integer;
 PosS:Integer;
 Opened:Boolean;
begin
 Opened:=False;
 Result:='';

 for I:=1 to Length(Source)-1 do
   begin
    if Source[I]='<' then
    begin
     Opened:=True;
     PosS:=I;
    end
    else if Source[I]='>' then
    begin
     Opened:=False;
     TagString:=Copy(Source,PosS,I-PosS+1);
     TagString:=StripChars(TagString,[#9, #10, #13]);
     Result:=Result+TagString;
    end
    else if Opened=False then
    begin
     Result:=Result+Source[I];
    end
   end;


end;