Mara-Li / obsidian-regex-mark

MIT License
14 stars 0 forks source link

[FR]: Ability to enable/disable marking in source, live preview, and reading mode separately #5

Closed nuanjanP closed 2 months ago

nuanjanP commented 2 months ago

Issue validation

Is your feature related to a problem ?

I'm interested in using this plugin as an "invisible character revealer" in the source (and perhaps live preview) mode. For example, I could match just the U+200D zero width joiner character, and then add via css a visible element such as text like "ZWJ" in a box, to indicate there's a ZWJ there.

However, at the moment, in the reading mode, that ZWJ is also wrapped in <span>, preventing it from doing its normal job (for example, joining emojis in a ZWJ sequences).

What solution do you want to see ?

It would be great if we have the following:

I don't have any experience creating plugins, but I suspect this requires quite some work. So thank you at the very least for reading this long post :)

Describe the alternative you've considered

No response

Anything else?

No response

OS

Windows

Obsidian information

SYSTEM INFO:
    Obsidian version: v1.6.3
    Installer version: v1.5.12
    Operating system: Windows 10 Home Single Language 10.0.19045
    Login status: not logged in
    Insider build toggle: off
    Live preview: off
    Base theme: dark
    Community theme: none
    Snippets enabled: 3
    Restricted mode: off
    Plugins installed: 38
    Plugins enabled: 20
        1: Cursor Location v0.3.1
        2: Custom Font Loader v1.4.0
        3: Dataview v0.5.66
        4: Extended MathJax v0.4.1
        5: floating toc v2.4.3
        6: Footnote Shortcut v0.1.3
        7: Tray v0.3.5
        8: Better footnote v1.0.1
        9: InlineCodeHighlight v1.0.1
        10: Jump to link v0.4.4
        11: Pane Relief v0.5.3
        12: Quick Explorer v0.2.8
        13: Shiki Highlighter v0.3.2
        14: Sortable v0.3.1
        15: Style Settings v1.0.8
        16: Text Format v3.0.5
        17: Code Preview v1.3.11
        18: Tasks v7.4.0
        19: Quick Switcher++ v4.2.2
        20: Regex Mark v1.6.3

RECOMMENDATIONS:
    Custom theme and snippets: for cosmetic issues, please first try updating your theme and disabling your snippets. If still not fixed, please try to make the issue happen in the Sandbox Vault or disable community theme and snippets.
    Community plugins: for bugs, please first try updating all your plugins to latest. If still not fixed, please try to make the issue happen in the Sandbox Vault or disable community plugins.

Plugin version

1.6.3

Mara-Li commented 2 months ago

For Source mode, I'm pretty sure I can't add the regex (as everything is show). I need to check, but I exclude it for the moment.

For the rest, what do you want to see into the UI ?

nuanjanP commented 2 months ago

As for the UI, I was thinking of the last option, just a simple toggle in the plugin settings window. I think I'll be using the same settings for all the notes, and not changing it often, but that's just my own case.

By the way, somehow for me the plugin is working normally in source mode (which for me is a plus, because actually I mainly use source mode). For example, I could add xyz as the regex to be matched and assign to it the class name xyz, then if I load in the following css fragment:

.xyz {
  font-size: 2em;
  background-color: green;
  color: red;
}

As expected, all instances of xyz in source mode will be 2 times as big, with green background and red text.

Mara-Li commented 2 months ago

I fully found how to disable the regex in the three different mode (so source, reading & LP). I removed the disable option, as it is handled by this.

To keep a clean settings, I added an option as a modal, so you can toggle each view separately !

Mara-Li commented 2 months ago

I pasted the new settings, could you please review and said if it's okay?

nuanjanP commented 2 months ago

Looking from the image of the proposed settings page, it looks great! Thank you! :)