Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

240
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!