Search code examples
javascripthtmltext

HTML text to plain text in Javascript without imports or npm installs


Is there a way to convert HTML text to plain text in JS WITHOUT IMPORTING OR USING 'NPM INSTALL'. I am trying to, for example, put: <h1>Hello</h1> as <h1>Hello</h1> without it autocorrecting to

'Hello'.

Is this possible? Even if it can put it in blockquotes or multiple line blockquotes like

<h1>Hello</h1>
<h2>Hi</h2>

How do I do this does anyone know?

I would also be fine with figuring out how StackOverflow creates their blockquotes like:

<h2>Hello</h2>

Can someone help please!


Solution

  • This is a non-deprecated deprecated tag. <xmp>

    <xmp> is not an easy-to-find tag... I would recommend using it!

    It says its deprecated if you search it online... but after using it in a live display it is definitely a working tag!