'DOMDocument removing comments syntax from a fetched file - Laravel PHP

I am using DOMDocument to read specific html (body code) from a file (I don't know much about DOMDocument), that file has comments in the code. When i echo the returned html on my page, I can see the comments text on my page, i mean DOMDocument playing with comments, it is uncommenting my comments.
Controller Code:

$file = storage_path('app/public/widgets/' . json_decode($currentWidget->file)->folderName . "/index.php");
$doc = new DOMDocument();
$doc->loadHTMLFile($file);
$html = $doc->getElementsByTagName('body');

Blade File Code:

@if (!is_null($html))
    @foreach ($html as $element)
        @php $nodes = $element->childNodes; @endphp
        @foreach ($nodes as $node)
            {!! $node->nodeValue !!}
        @endforeach
    @endforeach
@endif

My real html is like:
enter image description here

But see, it's removing the comments:
enter image description here

Does anyone knows the problem? and how can i fix this issue?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source