Rendering warnings / alerts from markdown to HTML

Post here questions and problems related to editing and publishing DITA content.
Sergio_7
Posts: 18
Joined: Fri Sep 15, 2023 9:56 am

Rendering warnings / alerts from markdown to HTML

Post by Sergio_7 »

Hi everyone,
We work with DITA and Markdown files and output them as webhelp HTML. To achieve a consistent look, I would like to use a standardized style for Markdown warnings and customize them individually in CSS. Unfortunately, in HTML the warnings are output as quotes without a specific class or ID that could be used to style them individually (icon, color, etc.).

Can you help me figure out how to do this?

Markdown syntax for warnings:
> [!NOTE]
---------------
> [!TIP]
---------------
> [!IMPORTANT]
---------------
> [!WARNING]
---------------
> [!CAUTION]
---------------

Example:
Text in markdown:

Code: Select all

> [!WARNING]
> here is the text ... 
Output in HTML as quotes (see image) without any class or ID for the type "warning".
output-html.png
A good approach could be to achieve this look:
default-md-alerts.png
You do not have the required permissions to view the files attached to this post.
julien_lacour
Posts: 778
Joined: Wed Oct 16, 2019 3:47 pm

Re: Rendering warnings / alerts from markdown to HTML

Post by julien_lacour »

Hello,

One possibility could be to integrate HTML content directly in the Markdown topic:

Code: Select all

<div class="- topic/note note note note_note"><span class="note__title">Note:</span>
In this instance, the technical writer knows nothing about his subject.</div>
<div class="- topic/note note caution note_caution" type="caution"><span class="note__title">CAUTION:</span>
You must be grounded before doing this.</div>
<div class="- topic/note note warning note_warning" type="warning"><span class="note__title">WARNING:</span>
This is a dangerous operation.</div>
By using original classes, you will fall back to the original DITA processing and you can apply the style easily.

Regards,
Julien
Sergio_7
Posts: 18
Joined: Fri Sep 15, 2023 9:56 am

Re: Rendering basic admonitions (warnings/alerts) from markdown to HTML

Post by Sergio_7 »

Hi Julien,
Thanks for your reply.
Yes, that would work, but the problem is that the md files usually come directly from developers and their content should not be changed. It would be ideal if the basic admonitions (note, tip, important, warning, caution, danger, info, success etc.) were recognized directly by Oxygen by default and rendered correctly in the output. Is something like this in your backlog? Is this a case for a feature request? I can't imagine that I'm the only one with this problem. Warning messages are a central part of the documentation.

Regards,
Sergio
Last edited by Sergio_7 on Mon Feb 09, 2026 10:46 am, edited 1 time in total.
julien_lacour
Posts: 778
Joined: Wed Oct 16, 2019 3:47 pm

Re: Rendering warnings / alerts from markdown to HTML

Post by julien_lacour »

Hi Sergio,

In this case you could use Mardown DITA syntax:

Code: Select all

!!! warning

    Warning content.
Regards,
Julien
Sergio_7
Posts: 18
Joined: Fri Sep 15, 2023 9:56 am

Re: Rendering warnings / alerts from markdown to HTML

Post by Sergio_7 »

Hi Julien,
that's a much better approach, thank you.
Question:
Is there any way to further expand the admonitions support for DITA (it appears that only “Docusaurus” and “MkDocs” are currently supported) so that widely used admonitions such as "GitHub" and "GitLab" can also be taken into account?
You will find an overview here: https://blog.markdowntools.com/posts/ma ... lete-guide
Thank you!
Last edited by Sergio_7 on Mon Feb 09, 2026 6:49 pm, edited 2 times in total.
julien_lacour
Posts: 778
Joined: Wed Oct 16, 2019 3:47 pm

Re: Rendering warnings / alerts from markdown to HTML

Post by julien_lacour »

Hello,

Markdown support is supplied by the Lightweight DITA for DITA-OT plugin.
You could add an improvement issue in the plugin repository: https://github.com/jelovirt/org.lwdita

Regards,
Julien
Post Reply