user4648588
user4648588

Reputation:

How to insert image in the table using Markdown

How to insert image in the table using Markdown

Normal html syntax works fine, but the markdown syntax returns as table data,

Please suggest any answers

Normal HTML

# Image inside a Table
<table>
    <tr>
        <td>
            Image inside Table
        </td>

        <td>
        <img src="image.jpg"></img>
        </td>
    </tr>

Markdown

# Image inside a Table
<table>
    <tr>
        <td>
            Image inside Table
        </td>

         <td>
        ![](image.jpg)

        </td>
    </tr>

Upvotes: 3

Views: 6838

Answers (3)

user24974545
user24974545

Reputation: 1

It is quite an old post, but may be it will help someone. I was struggling with the same problem in the Azure DevOps Wiki, when I put an empty line between <td> and ![](image.jpg), then it works.

# Image inside a Table
<table>
    <tr>
        <td>
            Image inside Table
        </td>
        <td>
...empty line must be here...
        ![](image.jpg)
        </td>
    </tr>

Upvotes: 0

Waylan
Waylan

Reputation: 42647

The rules state:

Note that Markdown formatting syntax is not processed within block-level HTML tags. E.g., you can’t use Markdown-style *emphasis* inside an HTML block.

Therefore, everything between the <table> and </table> tags is ignored by Markdown. That being the case, if you are using raw HTML for the table, you must use HTML for all of the content of said table.

There are a few unofficial workarounds which depend on the Markdown implementation you are using.

  1. Some implementations provide a mechanism to tell the parser to not ignore Markdown text inside an HTML block. The most common is to set markdown=1 as an attribute on the block tag. Some implementations include this feature by default. Others provide the feature through a plugin/extension. And Some require you to enable it globally through an API hook (programmatically).

  2. Some implementations provide a table syntax which is defined using plain text rather than HTML (usually through a plugin/extension). As the table itself is Markdown, everything in it is as well. However, the specifics of the syntax vary from implementation to implementation.

As both of the above solutions depend on which Markdown implementation you are using, and you didn't tell us that, all I can do is suggest you check the documentation for the implementation you are using.

Upvotes: 1

Chris
Chris

Reputation: 137183

You can't, at least not with the original implementation:

Note that Markdown formatting syntax is not processed within block-level HTML tags. E.g., you can’t use Markdown-style *emphasis* inside an HTML block.

If you are using some other implementation of Markdown (e.g. GFM, PHP Markdown, etc.) there may be an option in that particular tool. But you would have to edit your question to include that information.

Upvotes: 0

Related Questions