Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8971831
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T18:03:40+00:00 2026-06-15T18:03:40+00:00

Recently I wrote a simple webapp for handling telnet connections with routers. I am

  • 0

Recently I wrote a simple webapp for handling telnet connections with routers. I am using Node.js with Express and WebSockets. After setting up a connection, a stream from terminal goes through websocket as UTF-8 string.

And here is my problem: I wrote a simple displaying function that uses slice('\n') and adds an html paragraph, but I’m not satisfied with results, everything is a mess (towel.blinkenlights.nl telnet-based Star Wars doesn’t look even close to the version from terminal). When I display the data in the browser console it looks fine, but in my html it does not.

The main problem is probably caused by these all \n‘s \t‘s etc.

So now I’m looking for a solution/library/something that converts js string to html markup. Is there anything like that, maybe in jQuery or so?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T18:03:41+00:00Added an answer on June 15, 2026 at 6:03 pm

    Put your text into a pre block and it will preserve formatting:

    document.getElementsByTagName("pre")[0].textContent = "string1\n\tstring2";
    
    
    string1
        string2
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I recently wrote a program that used a simple producer/consumer pattern. It initially had
Hey, I recently wrote this fairly simple game of life in JavaScript. Within this
I have been looking at Reflection.Emit recently. I wrote a simple program that generates
recently I wrote a basic web application with only index.jsp and a simple servlet,
I recently wrote a simple bootloader in assembly for floppy disk booting. I used
Recently, I wrote a simple web application. I currently have. A static page which
I recently wrote a simple utility in Perl to count words in a file
I recently wrote up a simple Twitter app for Android to learn the ropes
I recently wrote a small script that made a simple show/hide manipulation to an
I have a simple Web App developed using Spring and recently I'm having some

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.