obsidian-spaced-repetition icon indicating copy to clipboard operation
obsidian-spaced-repetition copied to clipboard

[FEAT]

Open rikugo1 opened this issue 1 year ago • 13 comments

Issue When a card is included within a bullet point that is indented, the front side of the card is rendered as a code block, which prevents rendering of formatting and LaTeX. It also shows up with a "copy" button underneath, which I assume is intended for debugging when something isn't rendered as expected.

Solution Ideally, the plugin would recognize that the card begins after the bullet point, or at least ignore any initial whitespace.

Example Screenshot 2024-05-14 at 6 11 28 AM

rikugo1 avatar May 14 '24 10:05 rikugo1

Hi @rikugo1 could you please post your actual markdown file.

(Attach the file, don't copy/paste the text)

Cheers Ronny

ronzulu avatar May 14 '24 12:05 ronzulu

Sure thing, thanks!

Calculus Fundamentals.md

rikugo1 avatar May 14 '24 13:05 rikugo1

There is a related issue.

When a card has a bullet point that is indented followed by text that is not indented, that text is also shown as indented although it should not be. Here is an example:

Actual text formatting:

  • Indented bullet point

Not indented text

Text formatting as shown during review:

  • Indented bullet point Not indented text

dengrish avatar May 18 '24 10:05 dengrish

Hi @rikugo1

Thanks for posting the file. The reason why this issue is happening is because of an Obsidian characteristic:

https://help.obsidian.md/Editing+and+formatting/Basic+formatting+syntax#Code+blocks

[!QUOTE] You can also create a code block by indenting the text using Tab or 4 blank spaces.

I don't think that the plugin can simply strip the leading whitespace before having the Obsidian library render it. From memory, that caused issue in some use cases.

ronzulu avatar May 20 '24 02:05 ronzulu

Hi @dengrish could you please post your actual markdown file.

(Attach the file, don't copy/paste the text)

Cheers Ronny

ronzulu avatar May 20 '24 02:05 ronzulu

test_note.md

A markdown file is attached. Thanks!

dengrish avatar May 24 '24 20:05 dengrish

I did a bit of a research of this those problems there are not really related but that's not the case. Original issues is cause because of the initial spaced/tab the MarkdownRender interpreted it as code block. this is easy to fix just include a trim to the string and we should be fine. image But while testing this cause any problems for other supported flashcards I tested the code block and the result looks off image I have undone the change to check it was working before but it wasn't @ronzulu did you know, at some point the code block got rendered correctly or was this just me thinking it was working correctly. With working correctly I mean image the copy button is at same position as in obsidian note.

4Source avatar May 25 '24 16:05 4Source

test_note.md

A markdown file is attached. Thanks!

I think this is a problem with the Obsidian MarkdownRenderer it is somehow ignoring the \n after - indented not sure we are passing wrong formatting or this is a bug of obsidian api.

4Source avatar May 25 '24 17:05 4Source

I think this is a problem with the Obsidian MarkdownRenderer it is somehow ignoring the \n after - indented not sure we are passing wrong formatting or this is a bug of obsidian api.

Ok I checked this it is not a bug of the api it is the expected behavior if you switch to the reading mode in obsidian you can see the same behavior and the render does the same. Live preview: image Reading: image

But I have seen there is a related issue #909 maybe the issue of this is fixable by trick the renderer and make him think it is a list there indents are possible and make the list points invisible but not sure how easy this is and possible cause issues

4Source avatar Jun 09 '24 21:06 4Source

Hi @4Source

I have undone the change to check it was working before but it wasn't @ronzulu did you know, at some point the code block got rendered correctly or was this just me thinking it was working correctly. With working correctly I mean

Not sure. I didn't change any of that code, so the behavior likely has been the same for 9+ months.

ronzulu avatar Jun 15 '24 10:06 ronzulu

Ok but I think we should fix the copy button of the code block

4Source avatar Jun 15 '24 15:06 4Source

Same issue. This might be fixable if flashcards in list item are treated specially and other cases are left unchanged.

polyipseity avatar Jun 30 '24 07:06 polyipseity

Same issue. This might be fixable if flashcards in list item are treated specially and other cases are left unchanged.

The problem here is that the html is generated by function of obsidian the result is difficult to edit because the not indented line is in same list item as the above list item image

The only option I could imagine is to modify the input text for the render function add additional \n after a end of list this would result in here expected outcome. This brings its own difficulties, especially the exact detection of list endings without affecting other texts.

Question
?
not indented
- indented 
- indented2
<!-- new line here -->
should not be indented but is indented

image

But if someone expect the outcome is like in the reading view there is no option for them to achieve this if the text is internally modified. In my opinion we need a different solution.

4Source avatar Jun 30 '24 10:06 4Source