scripts icon indicating copy to clipboard operation
scripts copied to clipboard

In Text-Highlights script is it possible to highlight in the editor?

Open schultzter opened this issue 2 years ago • 8 comments

Script name

Text Highlights

Script authors

@mleo2003 , @ryliejamesthomas

Expected behaviour

Text in editor is highlighted, and == on either side of text greyed like other ** and _ markdowns.

Actual behaviour

There does not appear to be any formatting applied.

image

Steps to reproduce

Install the Text Highlights script

Enter the following text in a note: This is a ==highlight== in the text but this is **bold** and this _italic_ !

Output from the debug section in the settings dialog

Relevant log output in the Log panel

schultzter avatar Mar 29 '22 02:03 schultzter

You cannot script the editor highlighting, it's far too complex and optimized.

pbek avatar Mar 29 '22 04:03 pbek

Is it possible to add ==highlight== as a built-in Markdown extension?

schultzter avatar Mar 29 '22 07:03 schultzter

Is it possible to add ==highlight== as a built-in Markdown extension?

Why should that be added? 😅

pbek avatar Mar 29 '22 11:03 pbek

It's a common and popular markdown extension. I realise markdown is the quintessential so many standards to choose from situation but this is one I've seen repeatedly and many people will probably expect. It is popular enough that someone has created a script to render it.

schultzter avatar Mar 30 '22 14:03 schultzter

I've never seen it in the wild (where have you?) and if so, it even still it doesn't make a lot of sense to implement that into the highlighter, since not even md4c (the html generator for the preview) is supporting it and there already are "bold" and "italic".

pbek avatar Mar 30 '22 15:03 pbek

Good afternoon

I first saw it in Notejoy but there's also:

  • Typora
  • Obsidian
  • Quilt
  • IA Writer
  • Roam (^^ instead of == though)

Plus you support other non-standard/extensions like strike (~~) and tasks (- [ ]).

Thanks

-- Headed for the second star to the right and straight on 'til morning...

Eric Schultz

On Wed, Mar 30, 2022 at 11:44 AM Patrizio Bekerle @.***> wrote:

I've never seen it in the wild (where have you?) and if so, it even still it doesn't make a lot of sense to implement that into the highlighter, since not even md4c (the html generator for the preview) is supporting it and there already are "bold" and "italic".

— Reply to this email directly, view it on GitHub https://github.com/qownnotes/scripts/issues/165#issuecomment-1083308196, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAHRF7FYQLTAODTNBVGFPLVCRZEFANCNFSM5R45HANQ . You are receiving this because you authored the thread.Message ID: @.***>

schultzter avatar Mar 31 '22 20:03 schultzter

even still it doesn't make a lot of sense to implement that into the highlighter, since not even md4c (the html generator for the preview) is supporting it and there already are "bold" and "italic".

It does render a highlight in the preview.

ryliejamesthomas avatar Apr 01 '22 05:04 ryliejamesthomas

I would also find this useful, as currently I mostly use QON with the preview pane hidden.

ryliejamesthomas avatar Apr 01 '22 05:04 ryliejamesthomas

I would also find this useful, as currently I mostly use QON with the preview pane hidden.

You should be able to do it with a very simple script such as this one:

import QtQml 2.0
import QOwnNotesTypes 1.0

QtObject {

    function init() {
        script.addHighlightingRule("==([^=]*)?==", "", 8, 1, -1);
    }
}

Or adding script.addHighlightingRule("==([^=]*)?==", "", 8, 1, -1); in the init of https://github.com/qownnotes/scripts/blob/master/text-highlights/text-highlights.qml#L37

Beurt avatar Feb 23 '23 22:02 Beurt

I think this issue is closed with https://github.com/qownnotes/scripts/commit/8a48f39afbe11a3c7eb35967e11f414a201aac3b

Beurt avatar Mar 02 '23 19:03 Beurt