javalent / markdown-attributes

Add attributes to elements in Obsidian
MIT License
94 stars 7 forks source link

[Bug]: Attributes in inline elements are inconsistent #24

Closed efrec closed 1 year ago

efrec commented 1 year ago

Version Check

Windows 11 Obsidian v 1.1.16 Markdown Attributes v 1.2.2

What is the expected behavior?

The attribute clause in ==**Bolded text**{.change-highlight}== should apply to the <mark> and not to the <strong> tag. Documentation states that "Inline text elements such as italics, bold, highlight, etc. should have their attributes placed inside the symbol". But this isn't always the case.

The clause also isn't removed, inconsistently, in the reading view when inside an inline. This may be a separate bug.

What is the current behavior?

My test in a fresh vault:

image

In the reading mode, the .hltr-green class is applied to the strong element when inside a blockquote. It should apply to the mark element.

And idk what goes on in live preview:

image

The behavior is different between notes, for me. I first noticed this happening to some change highlights:

image

But can't figure out why some files don't have the same issue occur:

image

What are the A-to-Z Steps to Reproduce your Bug?

  1. In a md note, add highlights to some text. Include a paragraph and some other context, like a blockquote. Copy that text, and nest inlines inside each inline, e.g. bold text. Style the outer inline elements with a .hltr-green class using this plugin.
  2. Add CSS for hltr-green:
    .hltr-green.hltr-green {
      background-color: yellowgreen;
      border-radius: 0.8em 0.3em;
      padding: 0 0.2em 0 0.2em;
    }
  3. Check if hltr-green is applied to the inner or outer inline.
  4. Check if the md attributes clause was removed.

Error Codes

No errors in console

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.