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

Facing issues while using custom regex #593

Open
johamada opened this issue Jun 10, 2024 · 0 comments
Open

Facing issues while using custom regex #593

johamada opened this issue Jun 10, 2024 · 0 comments

Comments

@johamada
Copy link

johamada commented Jun 10, 2024

While using custom regex (this one: #332) i am facing an issue with links inside my cards that never happened before. I guess since the update on the newest version of Obsidian.

1
2

It depends on this piece of code and does not happen with other card formattings (like the built in).

showdown.subParser('unhashHTMLSpans', function (text, options, globals) {
  text = globals.converter._dispatch('unhashHTMLSpans.before', text, options, globals);

  for (var i = 0; i < globals.gHtmlSpans.length; ++i) {
    var repText = globals.gHtmlSpans[i],
        // limiter to prevent infinite loop (assume 10 as limit for recurse)
        limit = 0;

    while (/¨C(\d+)C/.test(repText)) {
      var num = RegExp.$1;
      repText = repText.replace('¨C' + num + 'C', globals.gHtmlSpans[num]);
      if (limit === 10) {
        console.error('maximum nesting of 10 spans reached!!!');
        break;
      }
      ++limit;
    }
    text = text.replace('¨C' + i + 'C', repText);
  }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant