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

Notation Color Blocks Only Works with Legacy Editor #9

Open
tjex opened this issue Jun 27, 2022 · 6 comments
Open

Notation Color Blocks Only Works with Legacy Editor #9

tjex opened this issue Jun 27, 2022 · 6 comments

Comments

@tjex
Copy link

tjex commented Jun 27, 2022

Notation color blocks don't render when using the live preview, they just stay as code blocks.
Only when using the legacy editor and toggling preview mode do they render.
Tested using minimal theme 5.2 and notation-color-blocks as of commit d8caed4
Screenshot 2022-06-27 at 21 23 50

@Yehuda-Bergstein
Copy link

Hi! did you find a solution when not using the legacy editor?

@tjex
Copy link
Author

tjex commented Jan 22, 2023

not a direct solution to use this snipped. I stopped using it and instead have just been marking with obsidian's highlights (==highlight==) or the diff code.

+ this is blue
- this is red

@Yehuda-Bergstein
Copy link

Cool, thanks
How do I use the "+, -" ?
And how do you change the color of the text?

@tjex
Copy link
Author

tjex commented Jan 22, 2023

you need to write a code block with the "language type" as diff

As below:
Screen Shot 2023-01-22 at 15 37 20

whatever text you have on a line starting with + will be blue, and red with -

@Yehuda-Bergstein
Copy link

Thanks!

you need to write a code block with the "language type" as diff

As below: Screen Shot 2023-01-22 at 15 37 20

whatever text you have on a line starting with + will be blue, and red with -

@NiklasWitzel
Copy link

It is not possible to get back the old functionality in the live preview with only CSS snippets. Below is a markdown example and the HTML output that is generated in the live preview window:

```note-gray-background
xxx
```

which gets translated into:

<div class="HyperMD-codeblock HyperMD-codeblock-begin HyperMD-codeblock-begin-bg HyperMD-codeblock-bg cm-line" dir="ltr">
    <img class="cm-widgetBuffer" aria-hidden="true" />
    <span contenteditable="false"></span>
    <img class="cm-widgetBuffer" aria-hidden="true" />
    <span class="code-block-flair" aria-label="Copy" contenteditable="false">note-gray-background</span>
    <img class="cm-widgetBuffer" aria-hidden="true" />
</div>
<div class="HyperMD-codeblock HyperMD-codeblock-bg cm-line" dir="ltr">
    <span class="cm-hmd-codeblock" spellcheck="false">xxx</span>
</div>
<div class="HyperMD-codeblock HyperMD-codeblock-bg HyperMD-codeblock-end HyperMD-codeblock-end-bg cm-line" dir="ltr">
    <img class="cm-widgetBuffer" aria-hidden="true" />
    <span contenteditable="false"></span>
    <img class="cm-widgetBuffer" aria-hidden="true" />
</div>

It is not possible to style an element based on its innerHTML/content.

But I just found the Admonition plugin, which looks like what I was looking for. Or you could use the built-in Callouts (which I also just found).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants