Build a Markdown to HTML Converter - return tests failing

I am passing every test except for every single ‘should return this’ test even though my returned output is exactly correct when logged. Code below. I also don’t seem to know how to paste my code in a fancy window like other people :frowning:

const markDown = document.getElementById("markdown-input");
const html = document.getElementById("html-output");
const preview = document.getElementById("preview")

function convertMarkdown(input) {
  let output = input;

 if(/\>(.*)/g.test(output)){
  output = output.replace(/\>(.*)/g, `<blockquote>$1</blockquote>`)
 }
 

if(/(?:^|\s)(#{1,3}).*/g.test(output)){
  output = output.replace(/(?:^|\s)(#{1,3})\s(.+)/gm, (_, hash, text) => `<h${hash.length}>${text}</h${hash.length}>`)
  };
  

if(/(?:__|\*\*)(.+)(?:__|\*\*)/g.test(output)){
  output = output.replace(/(?:__|\*\*)(.+)(?:__|\*\*)/g, `<strong>$1</strong>`);
}


if(/(?:_|\*)(.+)(?:_|\*)/g.test(output)){
  output = output.replace(/(?:_|\*)(.+)(?:_|\*)/g, `<em>$1</em>`);
}


if(/!\[(.+)\]\((.+)\)/g.test(output)){
  output = output.replace(/!\[(.+)\]\((.+)\)/g, `<img src="$2" alt="$1">`);
}


if(/\[(.+)\]\((.+)\)/g.test(output)){
  output = output.replace(/\[(.+)\]\((.+)\)/g, `<a href="$2">$1</a>`);
}
 
  
  if(output !== input){
  html.textContent = output;
  preview.innerHTML = output;
  console.log(output);
  return output;
  } else {
    console.log(output);
    return "";
    }
  
   
  
}



markDown.addEventListener("input", () => convertMarkdown(markDown.value))

Hi @ajspeed and welcome to our community!

I’ve edited your post to improve the readability of the code. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (').

Thank you! I’ll remember this for next time (first post, sorry)

It helps if you provide a link to the project instructions as well, so we can also test.

You need to troubleshoot by finding out what input the tests are sending to your app. Use console.log() to send the input to the console and then run the tests.

Make sure your app is working for the exact input the tests are trying. They are likely trying something that you didn’t expect.