Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

239
Visualizações
How to implement github like markup converter and add html

I am creating the text editor and I want to implement a GitHub mark like syntax ([text|link]) and convert this to <a heref="link">text</a>.

I am using the below code:

let range = timeline.contentWindow.getSelection().getRangeAt(0).toString();
      let info = null;
      info = range.match(/\[*(.*)\|\s*(.*)]/);
      let html =
        "<a  href=" +
        (info !== null ? info[2] : range) +
        ">" +
        (info !== null ? info[1] : range) +
        "</a>";
      innerDoc.execCommand('insertHTML', false, html);

So I have implemented this on button click but I need to achieve this in keyDown event for example if the user hit enters I want to get the last line and parse the link and add the anchor tag.

Basically I want to implement something like this gif:

gif

Can you please help me to achieve this functionality as soon as the user types [text|link] and hits enter?

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda