Open igorp74 opened 9 months ago
Thank you for reporting. I think that's still a quirk of the code blocks... Can you remember, @Waqar144?
Markdown:
```
(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])
```
(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])
`(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])`
Not code blocks, but link detection/conversion I think. The current code is too naive to handle cases like this properly.
Any chances of improving that?
Pretty naive indeed, the string replace has no concept of code blocks:
I'm not sure on how to improve that...
Yeah. A quick solution would be to:
highilghtCode
functionA proper solution would be to use the md4c api to find and process links like the md_html
function does.
Tricky, tricky, ...
Is one of the solutions something you are fancying doing, @Waqar144? 😊
If I find time, I can try to take a look
Yay, that would be wonderful! 🙏🏻🎉
Preview of a regex gives me the local links
Expected behaviour
In code block, I expected 1:1 of original text
Actual behaviour
https://quip.com/reaQAF9xHaB2/Regex
Steps to reproduce
In a new page, copy & paste this regex:
Output from the debug section in the settings dialog
Expand
QOwnNotes Debug Information =========================== ## General Info **Current Date**: `Sun Feb 4 16:33:00 2024` **Version**: `24.1.5` **Build date**: `Jan 31 2024` **Build number**: `1076` **Platform**: `linux` **Operating System**: `Manjaro Linux` **Build architecture**: `x86_64` **Current architecture**: `x86_64` **Release**: `AUR` **Qt Version (build)**: `5.15.12` **Qt Version (runtime)**: `5.15.12` **Portable mode**: `no` **Settings path / key**: `/home/igorp/.config/PBE/QOwnNotes.conf` **Application database path**: `/home/igorp/.local/share/PBE/QOwnNotes/QOwnNotes.sqlite` **Application arguments**: `/usr/bin/QOwnNotes`, `/usr/bin/QOwnNotes`, `/usr/bin/QOwnNotes`, `/usr/bin/QOwnNotes`, `/usr/bin/QOwnNotes`, `/usr/bin/QOwnNotes`, `/usr/bin/QOwnNotes`, `/usr/bin/QOwnNotes`, `/usr/bin/QOwnNotes`, `--allow-multiple-instances` **Qt Debug**: `0` **Locale (system)**: `en_US` **Locale (interface)**: *empty* **Primary screen resolution**: `1920x1080` **Screen resolution(s)**: `1920x1080, 1920x1080` **Icon theme**: `breeze` **Notes in current note folder**: `161` **Calendar items**: `0` **Enabled scripts**: `12` ## Server Info **serverUrl**: `https://wim.nl.tab.digital` **appIsValid**: `no` **notesPathExists**: `unknown` **connectionErrorMessage**: `Unknown error` ## Spellchecking **Enabled**: `false` **Selected language**: `auto` **Language codes**: `en_US, en_US-large` **Language names**: `American English (United States), American English (United States) [large]` **Application dictionaries path**: `/home/igorp/.local/share/PBE/QOwnNotes/dicts` ## Note folders **currentNoteFolderId**: `2` ### Note folder `default` **id**: `2` **isCurrent**: `yes` **activeTagId**: `-1` **localPath**: `/home/igorp/Documents/Knowledge` **remotePath**: `Notes` **cloudConnectionId**: `1` **isShowSubfolders**: `yes` **isUseGit**: `no` **allowDifferentNoteFileName**: `no` **activeNoteSubFolder name**: *empty* **database file**: `/home/igorp/Documents/Knowledge/notes.sqlite` ## Cloud connections ### Cloud connection `Default` **id**: `1` **isCurrent**: `yes` **serverUrl**: `https://wim.nl.tab.digital` **username**: `igorp.mailbox@gmail.com` **accountId**: `igorp.mailbox@gmail.com` ## Enabled scripts ### Script `Custom note preview styling` **id**: `1` **path**: `/home/igorp/.local/share/PBE/QOwnNotes/scripts/preview-styling/preview-styling.qml` **variablesJson**: ``` { "customStylesheet": "body {margin-left: 30px;margin-right: 30px;}\nh1 {margin-top: 30px;margin-bottom: 10px;}\nh2 {margin-top: 20px;margin-bottom: 5px;}\nh3 {margin-top: 15px;margin-bottom: 5px;}\ndiv {color: #1274ca; font-size: 21px; font-style: italic;}\nth {background-color: #DEEBF6;}\nt1 {color: #00557f; font-size: 21px;font-weight:bold;}\nt2 {color: #0074aa; font-size: 16px;font-weight: bold;}\nt3 {color: #e30000; font-size: 14px;font-weight: bold;}\nt4 {color: #fcfcfc; background-color: #0284C0;font-weight: bold;}\nt5 {color: #fcfcfc; background-color: #00428A;font-weight: bold;}\ncode {color: #CC2B59; background-color: #F9F2F4;}" } ``` **identifier**: `preview-styling` **version**: `0.0.5` **minAppVersion**: `20.6.0` ### Script `Duplicate note` **id**: `3` **path**: `/home/igorp/.local/share/PBE/QOwnNotes/scripts/duplicate-note/duplicate-note.qml` **variablesJson**: *empty* **identifier**: `duplicate-note` **version**: `0.0.1` **minAppVersion**: `20.10.7` ### Script `Export notes as one HTML file` **id**: `5` **path**: `/home/igorp/.local/share/PBE/QOwnNotes/scripts/export-notes-as-one-html/export-notes-as-one-html.qml` **variablesJson**: *empty* **identifier**: `export-notes-as-one-html` **version**: `1.0.0` **minAppVersion**: `18.03.7` ### Script `Merge selected notes` **id**: `6` **path**: `/home/igorp/.local/share/PBE/QOwnNotes/scripts/merge-notes/merge-notes.qml` **variablesJson**: ``` { "mergeToFirst": false, "pyCommand": "python3" } ``` **identifier**: `merge-notes` **version**: `0.0.3` **minAppVersion**: `17.08.5` ### Script `Add Multiple tags` **id**: `7` **path**: `/home/igorp/.local/share/PBE/QOwnNotes/scripts/add-multiple-tags/add-multiple-tags.qml` **variablesJson**: *empty* **identifier**: `add-multiple-tags` **version**: `0.0.1` **minAppVersion**: `17.06.2` ### Script `Text Highlights` **id**: `8` **path**: `/home/igorp/.local/share/PBE/QOwnNotes/scripts/text-highlights/text-highlights.qml` **variablesJson**: ``` { "backgroundColor": "#74fe35", "styleForEditor": "8", "styleInEditor": true } ``` **identifier**: `text-highlights` **version**: `0.0.6` **minAppVersion**: `22.4.1` ### Script `Note link to clipboard` **id**: `9` **path**: `/home/igorp/.local/share/PBE/QOwnNotes/scripts/note-link-to-clipboard/note-link-to-clipboard.qml` **variablesJson**: *empty* **identifier**: `note-link-to-clipboard` **version**: `0.0.2` **minAppVersion**: `17.02.4` ### Script `ATX Headline` **id**: `10` **path**: `/home/igorp/.local/share/PBE/QOwnNotes/scripts/atx-headline/atx-headline.qml` **variablesJson**: *empty* **identifier**: `atx-headline` **version**: `0.0.1` **minAppVersion**: `20.6.0` ### Script `Sort lines` **id**: `12` **path**: `/home/igorp/.local/share/PBE/QOwnNotes/scripts/sort-lines/sort-lines.qml` **variablesJson**: *empty* **identifier**: `sort-lines` **version**: `1.0.0` **minAppVersion**: `18.04.3` ### Script `Toggle comment` **id**: `13` **path**: `/home/igorp/.local/share/PBE/QOwnNotes/scripts/toggle-comment/toggle-comment.qml` **variablesJson**: *empty* **identifier**: `toggle-comment` **version**: `1.0` **minAppVersion**: `20.4.16` ### Script `Insert Table of Contents (TOC)` **id**: `14` **path**: `/home/igorp/.local/share/PBE/QOwnNotes/scripts/insert-toc/insert-toc.qml` **variablesJson**: ``` { "tocLinks": false, "tocTitle": "Table of Contents" } ``` **identifier**: `insert-toc` **version**: `0.0.3` **minAppVersion**: `17.06.2` ### Script `Image preview` **id**: `15` **path**: `/home/igorp/.local/share/PBE/QOwnNotes/scripts/image-preview/image-preview.qml` **variablesJson**: ``` { "maxWidth": 640 } ``` **identifier**: `image-preview` **version**: `1.0.1` **minAppVersion**: `20.6.0` ## Settings **AboutDialog/geometry** (QByteArray): `