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

Still renders in source mode #8

Open
ggstrader opened this issue Feb 28, 2023 · 14 comments
Open

Still renders in source mode #8

ggstrader opened this issue Feb 28, 2023 · 14 comments
Assignees
Labels
bug Something isn't working

Comments

@ggstrader
Copy link

ggstrader commented Feb 28, 2023

Describe the bug
Rendering should be reserved for Live Preview and Reader View only, but blocks with custom classes are still rendered in Source view.

Expected behavior
Should be able to (in Source view) see and edit each inline code block as if it were a plain-text editor like notepad.

@ggstrader ggstrader added the bug Something isn't working label Feb 28, 2023
@LilaRest
Copy link
Owner

@ggstrader Are you using the latest version of the plugin (2.6.1) ? I'll investigate this later in the day

@LilaRest
Copy link
Owner

Re @ggstrader.

I've not been able to reproduce this bug. Very old version of the plugin may cause that, please ensure you're using the latest one.

If you already are, please provide me with your Obsidian app's version and a note content with which you are observing this bug.

@ggstrader
Copy link
Author

I'm using 2.6.1 and Obsidian 1.1.15, Windows 10.
I just assumed based on the element view that the plugin wasn't respecting source mode.
But, now I've "figured it out." Except I have absolutely no idea what's going on.

I couldn't reproduce it in Sandbox. So I copied the entire vault to another directory, and still had the issue. Turned off all the plugins, still had the issue. Removed all other plugins and snippets. Still had the issue. By process of elimination, found that removing one file - /software/obsidian/plugins/Plugin Notes.md - made the problem go away??? However, re-copying the vault and removing only that file doesn't fix the problem. Re-copying and removing everything except that file doesn't fix the problem. Only if I delete 90% of my vault (including that file), and undo that delete, does the problem go away. I.e. if absolutely nothing changes (except maybe file metadata) for most of my files including that strange problem file, somehow it's fixed. This is bonkers.

Anyways, it appears(?) to have nothing to do with the plugin? Somehow it's OS related? I'm genuinely confused.

@ggstrader
Copy link
Author

ggstrader commented Mar 1, 2023

Figured it out! The issue resurfaced and I 'bout died.

It had nothing to do with any of that.

It looks like the "first" pane dictates what mode other panes are in. This is reproducible in the Sandbox.

  1. Open a note with a custom class in source mode
  2. Open another note in a separate pane
  3. Observe that toggling between Live/Source mode has no effect in the second pane
  4. Switch the first pane to Live
  5. Observe when clicking in the second pane that it switches modes
  6. Toggling the mode in the second pane again has no effect

@ggstrader ggstrader reopened this Mar 1, 2023
@LilaRest
Copy link
Owner

LilaRest commented Mar 1, 2023

@ggstrader Thanks for this investigation ! I'll try to fix that later in the day :)

@AzulaBeLovely
Copy link

I had the same issue as ggstrader also another issue that might be caused by this.
I can't paste from clipboard if the item has backtics as the first line, disabling the plugin fixes it.

`class:meta`
- creation:: 2023-01-21T18:55:12
- author:: [[John Doe]]
- parents:: [[Note]], [[Another note]]
- status:: #MayBePartial

Also, in source view it renders as if I'm in live preview and hides "class:meta" but shows if I click inside the fields.

Outside that I'm having no issues, I love your plugin and so happy I have a way to link my notes in fields, thank you!

@LilaRest
Copy link
Owner

LilaRest commented Mar 4, 2023

@ggstrader @AzulaBeKinky I hadn't added this to my tasks list and had totally forgotten to investigate this issue 🤭

I'll let you know when I'll have more infos or when it's fixed.

Happy to read that this plugin is useful to you @
@AzulaBeKinky 😊

@YIRU69
Copy link

YIRU69 commented Mar 6, 2023

I had the same issue! On Win10

@ThornedRose
Copy link

I'm not sure if this is related but, aside from having the same problem as above with rendering even in source mode, the class doesn't seem to be applied at all and instead I get a code block.

I have the Copy Document As HTML plugin and when I copy the HTML, the apparent output is like this:

<div><h2 data-heading="`class:meta`"><code>class:meta</code></h2>
<ul>
<li>List 2</li>
<li>List 3</li>
</ul></div>

As you can see, the backticks are causing it to be wrapped in a code block and not get rendered at all. For some reason the first list item is also getting cut off (there actually was a "List 1" item)

I've tried disabling all plugins and any relevant settings I can think of. It may be I'm doing something wrong since I'm new to Obsidian.

@LilaRest
Copy link
Owner

LilaRest commented Apr 2, 2023

@ThornedRose Are you using it for the Lila's frontmatter ?
I'll soon release a new version of this one on the Obsidian forum that doesn't rely on this plugin to work.

I'm actually not using this plugin myself anymore, I don't plan to continue maintaining it in the future, but would be happy to accept any PR.

@ThornedRose
Copy link

ThornedRose commented Apr 3, 2023

@ThornedRose Are you using it for the Lila's frontmatter ? I'll soon release a new version of this one on the Obsidian forum that doesn't rely on this plugin to work.

I'm actually not using this plugin myself anymore, I don't plan to continue maintaining it in the future, but would be happy to accept any PR.

I do not use it for front matter. Just for trying to style individual elements. A problem I've been beating my head against with immense frustration for two solid days :(

My use case is that I have a heap of books, each one as a note. At the top of each book, I have a table containing a summary of the characters in the book, the period in which it takes place, organisations and places of significance, etc. It looks similar to the metadata of the book but is just more flexible (it also has dataview inline fields). I wanted to be able to style it differently from other tables so it stands out more. My work around so far has been to put it in a callout. But that also has it's own limitations since I now can't put any other tables in the book notes callouts otherwise they'll get styled the same.

It would be wonderful if Obsidian either added a unique identifier to each element by default or at least allowed optionally adding identifiers and classes such as your plugin provides.

Unfortunately my forte lies solely in HTML and CSS and I have Cognitive Impairment so as much as I would love to be able to contribute to this wonderful plugin, I don't have the knowledge or ability. :(

@LilaRest
Copy link
Owner

LilaRest commented Apr 3, 2023

@ThornedRose Oh I see ! Thanks for those details :)

If I understood your problem correctly, I think callout could indeed be the solution.
Do you know that you can style callouts from their identifiers ?

I've myself replaced the usage of this plugin for my frontmatter with a callout. Here is a minimal example that might inspire you.

Here is the callout in my note :

>[!meta]-
> type:: XP
> creation:: 2023-03-31T23:44
> archived:: false

And now the callout is accessible using the [data-callout="meta"] CSS selector, so I can change its background like this :

[data-callout="meta"] {
    background: red;
}

@ThornedRose
Copy link

ThornedRose commented Apr 3, 2023

And now the callout is accessible using the [data-callout="meta"]

OMG, game changer!!! Somehow I missed that. Probably not surprising after staring at html for days on end. 😅

Coupled with the Metatable plugin, I now have wonderful control over custom meta content. Thanks so much!!

@LilaRest
Copy link
Owner

LilaRest commented Apr 4, 2023

@ThornedRose Glad it helped ! 😊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants