This gives a pretty thorough description of how HTML elements are interpreted by Markdown. But it does not discuss styles.
So far, the only thing I can get to work is image width.
style="....."
attribute is completely ignored.style=...
)https://gist.github.com/abalter/46df1b79e9f429342972477d7c20cebc
Change span
to div
due to div
being in the whitelisted tags per @waylan's comment under @chris's answer.
It appears that Firefox and Chrome don't render any style attributes any more at all.
Wherever HTML is rendered on GitHub (gists, README files in repos, comments on issues and pull requests, ...) you can use any of the HTML elements that GitHub Flavored Markdown (GFM) provides syntactic sugar for.
Markdown does not support CSS styles. Since Markdown converts to HTML, Any valid HTML works. CSS styles are added with inline or style tags in HTML.
GitHub uses its own Markdown processor; GitHub Pages uses jekyll-commonmark. This means your README.md file will look different on GitHub's website than on your GitHub Pages website.
Inline - by using the style attribute inside HTML elements. Internal - by using a <style> element in the <head> section. External - by using a <link> element to link to an external CSS file.
After GitHub converts Markdown to HTML,
The HTML is sanitized, aggressively removing things that could harm you and your kin—such as
script
tags, inline-styles, andclass
orid
attributes. See the sanitization filter for the full whitelist.
You're right: style
tags are not included in the whitelist. They are ignored.
The permitted attributes differ by tag. I recommend referring to the sanitization filter link above. It leads to a fairly readable Ruby source file.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With