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

fix display bug for admonition to callout conversion #150

Merged
merged 1 commit into from
May 22, 2023

Conversation

bayang
Copy link
Contributor

@bayang bayang commented May 7, 2023

The admonition plugin accepts parameters on the first 4 lines. These lines are displayed in the resulting html and the collapsing does not work.

For example in the following block :

ad-quote
title: Summary
icon: dice-five
collapse: open

content here

The rendered html shows the title, icon and collapse strings, and collapsing is broken.
See below :

Screenshot_20230507_120236

The fix I propose tries to integrate the title, the collapsible state.
Unfortunately custom icon names and custom color are trickier to convert.
Below are some sample tests i made :

Screenshot_20230507_134250

PS : I'll try to do some research and see if converting the admonition blocks directly in the obsidian plugin using the rendering functions of the admonition plugin might be better.

admonition accepts parameters on the first 4 lines.
These lines are displayed in teh resulting html and the collapsing
does not work.
@bayang bayang changed the title fix display bug for admontion to callout conversion fix display bug for admonition to callout conversion May 7, 2023
@oleeskild
Copy link
Owner

Thanks for creating a PR! I was surprised that this changed the rendering for admonition blocks as I was under the impression that admonitions were replaced with the obsidian native callout blocks, but that doesn't seem to be the case, as it seems to still be under active development.

As you mentioned, the icon part currently doesn't have any effect, but it does at least allow us to parse the admonition correctly. I'll merge it in. If you find a cleaner way to parse this using the rendering functions in obsidian itself, I'd be happy to accept a PR, as the current implementation easily breaks if any new features are added.

@oleeskild oleeskild merged commit 2c14fcc into oleeskild:main May 22, 2023
oleeskild pushed a commit that referenced this pull request May 22, 2023
admonition accepts parameters on the first 4 lines.
These lines are displayed in teh resulting html and the collapsing
does not work.
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

Successfully merging this pull request may close these issues.

2 participants