I'm doing some tests on the Fetch function, and I'm using a txt file that should have like linebreaks/highlighted titles.
And when I imported the text and put into a variable, the console.log() showed up as it's supposed to. But using DOM to put into the HTML, the text just ignore everything but letters and spaces.
There's a way to correct that? Or I should try it another way?
Code below (only using the fetch function, the txt file is unnecessary I believe):
let basicText = ''
async function getBasicText(){
const resposta = await fetch('./textos/pctBasico.txt')
const texto = await resposta.text();
let basicText = document.getElementById('pctBasicoDetail')
basicText.innerHTML = texto
}
getBasicText()
Example:
*BOLD TITLE* Paragraph *ITALIC SENTENCE* *BOLD TITLE* Another paragraph
But it all goes one thing like:
TITLE PARAGRAPH SENTENCE TITLE PARAGRAPH