Tables in WebHelp from Markdown files

Post here questions and problems related to editing and publishing DITA content.
susannecm
Posts: 121
Joined: Wed Mar 17, 2010 1:04 pm

Tables in WebHelp from Markdown files

Post by susannecm »

I am working on an API documentation that uses Markdown files in a DITAMAP..
So far, I have been using my normal DITA output transformation to create WebHelp from this content.
However, I do not like the appearance of the tables in the output. They only have a single separator line between the header and the rest of the table.
I assume that this is because the Markdown table is converted to a DITA CALS table that lacks rowsep and colsep attributes.
How can I change this without affecting the output for the remaining documentation?
I appreciate your help.

Susanne
julien_lacour
Posts: 737
Joined: Wed Oct 16, 2019 3:47 pm

Re: Tables in WebHelp from Markdown files

Post by julien_lacour »

Hello Susanne,

You can easily customize the tables using custom CSS rules, such as:

Code: Select all

*[class ~= "topic/table"] {
  border: 1px solid black;
  border-collapse: collapse;
}

.table th[class ~= 'topic/entry'],
.table td[class ~= 'topic/entry'] {
  border: 1px solid black;
}
For more information about how to customize WebHelp Responsive output using CSS, please refer to this topic.

Regards,
Julien
Prinnybod
Posts: 1
Joined: Thu Nov 13, 2025 12:07 pm

Re: Tables in WebHelp from Markdown files

Post by Prinnybod »

I’ve been struggling with Markdown-to-DITA table formatting too. I wonder if there’s a way to apply a specific style only when the source file is Markdown, without changing the rest of the DITA content.
susannecm
Posts: 121
Joined: Wed Mar 17, 2010 1:04 pm

Re: Tables in WebHelp from Markdown files

Post by susannecm »

Yes, that is also my problem. I want to apply CSS styles selectively.
For example, when the output is generated, could Oxygen apply an outputclass to these tables on conversion from Markdown to DITA?
julien_lacour
Posts: 737
Joined: Wed Oct 16, 2019 3:47 pm

Re: Tables in WebHelp from Markdown files

Post by julien_lacour »

Hello,

If you need a style for Markdown tables and another for DITA CALS tables, you can add attributes, for example:

Code: Select all

| Header | Header |
|---|---|
| Cell | Cell |
| Cell | Cell |
{outputclass="md-table"}
Then match the new class (copied from the outputclass) in the final output:

Code: Select all

.md-table {
  border: 1px solid black;
  border-collapse: collapse;
}

.md-table th[class ~= 'topic/entry'],
.md-table td[class ~= 'topic/entry'] {
  border: 1px solid black;
}
Regards,
Julien
susannecm
Posts: 121
Joined: Wed Mar 17, 2010 1:04 pm

Re: Tables in WebHelp from Markdown files

Post by susannecm »

Thanks, this worked for me.
Post Reply