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

Fix mermaid highlight #300

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dirkkelly
Copy link

@dirkkelly dirkkelly commented Jun 11, 2019

Resolves #235

Attempted to use https://github.com/vjeantet/hugo-theme-docdock/pull/113/files but that wasn't working

@matalo33
Copy link
Contributor

matalo33 commented Jul 30, 2019

This seems to still be happening for me on the preview website. Searching for Alice is erasing that term from the sequence chart.
https://deploy-preview-300--learn.netlify.com/en/shortcodes/mermaid/

(Firefox 68)

@matalo33 matalo33 modified the milestones: v2.3.0, v2.4.0 Jul 30, 2019
@matalo33 matalo33 modified the milestones: v2.4.0, v2.5.0 Sep 4, 2019
@EdBondArcher
Copy link

Searching for Alice on this doesn't break it and actually works. The scope of this change seems fairly benign is there any reason this doesn't make life better for people instead of breaking pages?

@EdBondArcher
Copy link

EdBondArcher commented May 19, 2020

something like this might work better to allow for subgraphs

if (match) {
                if (
                    $(node).parents(".language-mermaid").length > 0 ||
                    $(node).parents(".mermaid").length > 0
                ) {
                    return 0;
                }
                var highlight = document.createElement(nodeName || 'span');
                highlight.className = className || 'highlight';

                var wordNode = node.splitText(match.index);
                wordNode.splitText(match[0].length);
                var wordClone = wordNode.cloneNode(true);
                highlight.appendChild(wordClone);
                wordNode.parentNode.replaceChild(highlight, wordNode);
                return 1; //skip added node in parent
            }

@matalo33 matalo33 removed this from the v2.5.0 milestone Jun 1, 2020
@McShelby
Copy link

I provided a different more robust solution in #451

maxatome pushed a commit to maxatome/hugo-theme-learn that referenced this pull request Jan 23, 2024
maxatome pushed a commit to maxatome/hugo-theme-learn that referenced this pull request Jan 23, 2024
maxatome pushed a commit to maxatome/hugo-theme-learn that referenced this pull request Jan 23, 2024
maxatome pushed a commit to maxatome/hugo-theme-learn that referenced this pull request Jan 23, 2024
maxatome pushed a commit to maxatome/hugo-theme-learn that referenced this pull request Jan 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Search highlighting makes text within Mermaid-rendered SVG diagrams disappear when matched
4 participants