How to display HTML content in github README.md?

GithubMarkdown

Github Problem Overview


I am new to github, in README.md want to display a HTML content using an Iframe or something is this possible ?

What I have tried is I just create HTML tags other then anchor, that is not working.

Github Solutions


Solution 1 - Github

Github's markdown interpreter can include HTML. However, there is only so much you can do in HTML. I would suggest checking out this article which provides more information on what tags can be used. Personally, I have never used much more than line-breaks, horizontal rules, etc... Unfortunately, I don't see Iframes mentioned in the article.

Solution 2 - Github

As answered by mjgpy3, you can include html - no <html> tags needed, but it'll be sanitized before display and the only tags allowed are in this whitelist.

The list currently includes:

h1 h2 h3 h4 h5 h6 h7 h8 br b i strong em a pre code img tt div ins del sup sub p ol ul table thead tbody tfoot blockquote dl dt dd kbd q samp var hr ruby rt rp li tr td th s strike summary details caption figure figcaption abbr bdo cite dfn mark small span time wbr

but no iframe.

Solution 3 - Github

You can use svg to work around, example code (./path/example.svg):

<svg width="100" height="100" xmlns="http://www.w3.org/2000/svg">
<foreignObject width="100" height="100">
    <div xmlns="http://www.w3.org/1999/xhtml">
        <ul>
            <li>text</li>
        </ul>
        <!-- Other embed HTML element/text into SVG -->
    </div>
</foreignObject>
</svg>

and then use image insert way to embed the svg file in any other markdown file, like this:

![](./path/example.svg)

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionBalaKrishnanė›ƒView Question on Stackoverflow
Solution 1 - Githubmjgpy3View Answer on Stackoverflow
Solution 2 - GithublazysoundsystemView Answer on Stackoverflow
Solution 3 - Githubyihao yeView Answer on Stackoverflow