Closed sailKiteV closed 2 years ago
Great report, thank you! I'll look into this shortly.
Two questions. Which version of the plugin are you using? And can you export your dynamic highlighter and include it here?
Thanks for the speedy reply! As requested:
Plugin Version: 0.2.5 (Closed Sandbox Vault already but it should be the same version.)
Highlight JSON File (in ZIP because GitHub won't accept the JSON as attachment): dynamic-highlights-sail-JSON.zip
Highlight JSON As Text:
{ "quote-property": { "class": "quote-property", "color": "#42188000", "regex": false, "query": "quote:: ", "mark": [ "match" ], "css": ".quote-property {\n display: none;\n}\n\n.HyperMD-quote:hover .cm-quote > .quote-property {\n color: var(--text-faint);\n font-style: italic;\n display: inline;\n}" }, "relative-link-nuker": { "class": "relative-link-nuker", "color": "#1B801838", "regex": true, "query": "(?<=\[\[).?(?=(?:\]\]|#|\|))", "mark": [ "match" ], "css": "" }, "Mini-Linting": { "class": "Mini-Linting", "color": "#A70F0F38", "regex": true, "query": " {2,}(?!\|| |$)|- - |^\s- \n|^ +(?![0-9-`])", "mark": [ "match" ], "css": ".cm-line .Mini-Linting {\n background: none;\n}\n\n.cm-line:not(.cm-active) .Mini-Linting {\n outline: 1px solid var(--text-error);\n}" } }
Alright, so this is an issue with your relative link nuker regex. It has the possibility to create a match that is zero characters long (empty) which causes CodeMirror to try and mark a zero character range, which causes a crash. I can look into ignoring zero character matches on my side but for now, you can tune that regex to not have the possibility to match zero characters.
An initial test on your included file shows that this would work (?<=\[\[).*?(?=(?:\]\]|\|))
If you want to play around, use regex101 and make sure none of your matches show up as "null" https://regex101.com/r/PUobqQ/1
You are a hero! A hero! Thank you for catching the issue, and i'm glad to see it was a problem between my chair and keyboard, to little surprise! 😅
Best of luck, -sailKite
Overview
When scrolling through large files, it seems that otherwise functioning highlights will stop working at a certain point in the scroll. Highlights broken in this manner will no longer function even when scrolling or jumping back to the top of the page. If using a link from another file to immediately jump to a section of a page that is past the cutoff point, then highlights will not appear in any fashion. The issue appears to be related more to the size of the file in terms of content than the size of the file in terms of raw lines.
Information
Error
An error is thrown in the console whenever the issue occurs, taking the following form, to which i have added hyphens to represent the indentation that would normally be present in the console:
Debug
Running Obsidian's debug command produces the following:
Examples
i have attached two files that were tested in the Sandbox Vault to demonstrate the occurrence of the issue. 1) copy of playground.md 2) long file 1.md
The first file is one in which the issue is present (larger overall size with more content). The second file is one in which the issue is not present (smaller overall size, but lots of vertical rows).
Demonstration of first file
Demonstration of second file
Postscript
Thank you for your time, and if you require any other information please don't hesitate to ask.
Regards, -sailKite