Admonition plugin

Plugin to add block-styled content like summaries, notes, hints or warnings.

example:

!!! tip
    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla et euismod
    nulla. Curabitur feugiat, tortor non consequat finibus, justo purus auctor
    massa, nec semper lorem quam in massa.

result:

Will be useful for writing documentation.

Links:
Material for MkDocs
https://python-markdown.github.io/extensions/admonition/

23 Likes

A nice example of this in action is the SuperMemo Guru Wiki, scroll all the way to the bottom of the page and he has a list of these and descriptions of how to use them.

  • Important notes
  • Excerpts
  • Personal anecdotes
  • Anecdotes
  • Motto
  • Metaphor
  • SuperMemo insert
  • FAQ question
  • Archive
3 Likes

I get around this simply by

> ⚠ Note to self
> If apply the Suchman's ideas to Agile and Waterfall, it's more like do we use planning models.
> 
> If we use planning model, then responding to change, means plans 

It will show up as

image

Which is good enough for me

8 Likes

I’d love to have such a plugin in Obsidian! It’s like awesomebox in LaTeX

1 Like

Any news on that?

Good idea!!!

Thumbs up for a plugin like this!

I would also love to see an Admonition plugin coming to life :blush: !

Here are other examples, in case one of the experts have to time to take a look at this :blush: :crossed_fingers: :

Somehow, I thought this could be achievable solely from CSS, like the Kanban boards in the wonderful Spectrum community theme :thinking: … But, as my CSS is really rusty, I probably won’t be able to help there :innocent: .

2 Likes

Decided to take a stab at this. Check it out here:

The admonitions are basically a direct copy of the ones from the Material for MkDocs above, but I show the css to modify them if you want to customize the look.

I just wrote this plugin and didn’t do too much testing, so I wouldn’t be surprised if it could be buggy, but it is a pretty simple one so hopefully it works well.

Edit: I also haven’t submitted it to the community list yet - you have to manually download it from the Releases section on the repository.

9 Likes

Yeah, it could be achieved through Styling, since that what it boils down to. The user just needs to write HTML Markup instead of Markdown. I actually want to include something like that in the theme!

1 Like

This is really cool! I might even adjust it to fit with Spectrum. :blush:

2 Likes

Hey, thanks. I just released 0.0.5 that allows the admonition to be collapsible.

I’ll probably submit it to the community plugin list soon!

4 Likes

Sounds awesome!
What kind of versioning do you use?

Once it’s submitted as a community plugin, I’ll go to 1.0.0 and then use typical semantic versioning from there, but honestly sometimes I don’t follow it well (like this release should have been a minor version update).

3 Likes

Very nice indeed. Tried it out and look forward for using it
Thanks @valentine.195

I am still using 0.0.4 until it is available on the Community Plugins, but I just noticed this. Could this be fixed somehow? The breaks don’t work. I know that it is because it gets turned into a <p> tag. So either each line has a new <p> tag, add <br /> or leave it as <pre> ? Just some suggestions.

1 Like

0.2.0 Release

  • Uses Obsidian’s Markdown renderer to render the admonition content, instead of just placing it all inside a <p> tag.
  • Removed requirement to use the content: flags if title: or collapse: is used

This should fix that issue. The content should render exactly like regular markdown outside of code blocks.

The only thing I could find that gives the admonition block fits is nested code – if its the last thing in the block it will render fine (and even do the prism highlighting), but if there’s content after it, that content will be placed outside the block.

image

2 Likes

Please also regard the Pandoc fenced divs and pandoc-latex-admonition a possibility.

I have been using these with Pandoc and LaTeX in times before Obsidian …

Hi there! Your plugin is a great shot, yet I’m struggling with customizing default titles for each text block. For example, I’d like not to rename “Note” every time with the “content:” row but to give it another default title. Any suggestions?

In version 0.2.0 I removed the requirement to have the content: parameter if you have a unique title, which helps.

Right now, there isn’t the ability to do custom default titles, but I was planning on adding it. This is a little tricky because the plugin is telling Obsidian to treat each admonition type as a code block language (like javascript or mermaid), so it could collide with other languages and exhibit weird behavior.

2 Likes