Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTML tag Bug #104

Open
rinrab opened this issue Aug 5, 2023 · 0 comments
Open

HTML tag Bug #104

rinrab opened this issue Aug 5, 2023 · 0 comments
Labels
documentation Improvements or additions to documentation

Comments

@rinrab
Copy link

rinrab commented Aug 5, 2023

There is a problem in custom highlight:

If I type <a/> it will be removed because is is HTML tag.

You can fix demo:

import {CodeJar} from 'codejar';

const node = document.querySelector('.editor');

const my = editor => {
-  let code = editor.textContent;
+  let code = editor.textContent.replace(/&/g, "&amp;").replace(/</g, "&lt;")
+      .replace(/>/g, "&gt;").replace(/"/g, "&quot;");

  code = code.replace(
    /\((\w+?)(\b)/g,
    '(<font color="#8a2be2">$1</font>$2'
  );
  editor.innerHTML = code;
};

const jar = CodeJar(node, my);
@rinrab rinrab changed the title HTML tag Bug HTML tag Bug[bug] Aug 5, 2023
@rinrab rinrab changed the title HTML tag Bug[bug] HTML tag Bug (bug) Aug 5, 2023
@rinrab rinrab changed the title HTML tag Bug (bug) HTML tag Bug [bug] Aug 5, 2023
@rinrab rinrab changed the title HTML tag Bug [bug] HTML tag Bug Aug 5, 2023
@antonmedv antonmedv added the documentation Improvements or additions to documentation label Dec 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants