### Tables Source: https://github.com/sindresorhus/github-markdown-css/blob/main/_autodocs/usage-guide.md Example of GitHub-flavored markdown table syntax using HTML. ```html
Header 1 Header 2 Header 3
Row 1 Col 1 Row 1 Col 2 Row 1 Col 3
Row 2 Col 1 Row 2 Col 2 Row 2 Col 3
``` -------------------------------- ### Loading CSS Source: https://github.com/sindresorhus/github-markdown-css/blob/main/_autodocs/usage-guide.md Examples of how to load the github-markdown.css file in your HTML, including options for render-blocking and asynchronous loading. ```html ``` -------------------------------- ### Task Lists Source: https://github.com/sindresorhus/github-markdown-css/blob/main/_autodocs/usage-guide.md Example of how to structure task lists in HTML for GitHub Flavored Markdown. ```html ``` -------------------------------- ### React Integration Source: https://github.com/sindresorhus/github-markdown-css/blob/main/_autodocs/usage-guide.md Example of integrating github-markdown-css with a React component. ```jsx import 'github-markdown-css'; export function MarkdownViewer({ html }) { return (
); } ``` -------------------------------- ### Python with Flask Server-Side Integration Source: https://github.com/sindresorhus/github-markdown-css/blob/main/_autodocs/usage-guide.md Example of server-side rendering markdown to HTML with github-markdown-css using Python and Flask. ```python from flask import Flask, render_template_string import markdown app = Flask(__name__) @app.route('/preview') def preview(): with open('content.md', 'r') as f: markdown_content = f.read() html = markdown.markdown(markdown_content, extensions=['fenced_code', 'tables']) return render_template_string('''
{{ html|safe }}
''', html=html) if __name__ == '__main__': app.run() ``` -------------------------------- ### Svelte Integration Source: https://github.com/sindresorhus/github-markdown-css/blob/main/_autodocs/usage-guide.md Example of integrating github-markdown-css with a Svelte component. ```svelte
{@html html}
``` -------------------------------- ### Node.js with Express Server-Side Integration Source: https://github.com/sindresorhus/github-markdown-css/blob/main/_autodocs/usage-guide.md Example of server-side rendering markdown to HTML with github-markdown-css using Node.js and Express. ```javascript import express from 'express'; import { marked } from 'marked'; import fs from 'fs'; const app = express(); app.get('/preview', (req, res) => { const markdownContent = fs.readFileSync('content.md', 'utf-8'); const html = marked(markdownContent); res.send(`
${html}
`); }); app.listen(3000); ``` -------------------------------- ### Vue Integration Source: https://github.com/sindresorhus/github-markdown-css/blob/main/_autodocs/usage-guide.md Example of integrating github-markdown-css with a Vue component. ```vue ``` -------------------------------- ### Image Syntax Examples Source: https://github.com/sindresorhus/github-markdown-css/blob/main/index.html Examples of inline and reference-style image syntax in Markdown. ```markdown ![Alt text](/path/to/img.jpg) ![Alt text](/path/to/img.jpg "Optional title") ``` ```markdown ![Alt text][id] ``` ```markdown [id]: url/to/image "Optional title attribute" ``` -------------------------------- ### Theme Switching with JavaScript Source: https://github.com/sindresorhus/github-markdown-css/blob/main/_autodocs/usage-guide.md JavaScript examples for dynamically switching themes (dark, light, or system preference) on a markdown container. ```javascript // Get the markdown container const container = document.querySelector('.markdown-body'); // Switch to dark theme container.setAttribute('data-theme', 'dark'); // Switch to light theme container.setAttribute('data-theme', 'light'); // Follow system preference container.removeAttribute('data-theme'); // Toggle theme function toggleTheme() { const current = container.getAttribute('data-theme'); const next = current === 'dark' ? 'light' : 'dark'; container.setAttribute('data-theme', next); } ``` -------------------------------- ### Install with npm Source: https://github.com/sindresorhus/github-markdown-css/blob/main/readme.md Install the github-markdown-css package using npm. ```sh npm install github-markdown-css ``` -------------------------------- ### Image Center Align Source: https://github.com/sindresorhus/github-markdown-css/blob/main/_autodocs/usage-guide.md Example of how to center-align an image. ```html Centered ``` -------------------------------- ### Image Examples Source: https://github.com/sindresorhus/github-markdown-css/blob/main/index.html Demonstrates inline and reference-style image syntax in Markdown. ```Markdown ![alt text](https://github.com/adam-p/markdown-here/raw/master/src/common/images/icon48.png "Logo Title Text 1") Reference-style: ![alt text][logo] [logo]: https://github.com/adam-p/markdown-here/raw/master/src/common/images/icon48.png "Logo Title Text 2" ``` -------------------------------- ### Framed Image Source: https://github.com/sindresorhus/github-markdown-css/blob/main/_autodocs/usage-guide.md Example of an image with a frame and a caption. ```html Framed Image caption ``` -------------------------------- ### Syntax-Highlighted Blocks Source: https://github.com/sindresorhus/github-markdown-css/blob/main/_autodocs/usage-guide.md Example of a syntax-highlighted code block using a
with class 'highlight' and a tag. ```html

def hello():
    print('Hello, World!')
  
``` -------------------------------- ### Core Container Example Source: https://github.com/sindresorhus/github-markdown-css/blob/main/_autodocs/css-classes.md Example of how to use the .markdown-body class to wrap markdown content. ```html

Heading

Paragraph text

``` -------------------------------- ### Light Theme Only Source: https://github.com/sindresorhus/github-markdown-css/blob/main/_autodocs/usage-guide.md Using github-markdown-light.css to enforce the light theme. ```html
``` -------------------------------- ### Reference Links in Action Source: https://github.com/sindresorhus/github-markdown-css/blob/main/index.html A comprehensive example of reference links. ```markdown I get 10 times more traffic from [Google] [1] than from [Yahoo] [2] or [MSN] [3]. [1]: http://google.com/ "Google" [2]: http://search.yahoo.com/ "Yahoo Search" [3]: http://search.msn.com/ "MSN Search" ``` -------------------------------- ### Emphasis Examples Source: https://github.com/sindresorhus/github-markdown-css/blob/main/index.html Examples of how asterisks and underscores are used for emphasis in Markdown. ```markdown *single asterisks* _single underscores_ **double asterisks** __double underscores__ ``` ```html single asterisks single underscores double asterisks double underscores ``` -------------------------------- ### Reference-Style Links Source: https://github.com/sindresorhus/github-markdown-css/blob/main/index.html Examples of reference-style link syntax in Markdown. ```markdown This is [an example][id] reference-style link. This is [an example] [id] reference-style link. [id]: http://example.com/ "Optional Title Here" ``` -------------------------------- ### Minimal HTML Structure Source: https://github.com/sindresorhus/github-markdown-css/blob/main/_autodocs/usage-guide.md Basic HTML structure to apply github-markdown-css. ```html

Welcome to Markdown

Your markdown content here

``` -------------------------------- ### Links Source: https://github.com/sindresorhus/github-markdown-css/blob/main/index.html Examples of inline and reference-style links. ```markdown [I'm an inline-style link](https://www.google.com) [I'm an inline-style link with title](https://www.google.com "Google's Homepage") [I'm a reference-style link][Arbitrary case-insensitive reference text] [I'm a relative reference to a repository file](../blob/master/LICENSE) [You can use numbers for reference-style link definitions][1] Or leave it empty and use the [link text itself] Some text to show that the reference links can follow later. [arbitrary case-insensitive reference text]: https://www.mozilla.org [1]: http://slashdot.org [link text itself]: http://www.reddit.com ``` -------------------------------- ### Implicit Link Name Shortcut Example Source: https://github.com/sindresorhus/github-markdown-css/blob/main/index.html Example using the implicit link name shortcut with reference links. ```markdown I get 10 times more traffic from [Google][] than from [Yahoo][] or [MSN][]. [google]: http://google.com/ "Google" [yahoo]: http://search.yahoo.com/ "Yahoo Search" [msn]: http://search.msn.com/ "MSN Search" ``` -------------------------------- ### Inline Code Source: https://github.com/sindresorhus/github-markdown-css/blob/main/_autodocs/usage-guide.md Example of inline code within text using the tag. ```html

This is inline code within text.

``` -------------------------------- ### 11ty (Eleventy) Integration Layout Source: https://github.com/sindresorhus/github-markdown-css/blob/main/_autodocs/implementation-patterns.md Example layout file for integrating github-markdown-css with 11ty (Eleventy). ```html {{ title }}
{{ content | safe }}
``` -------------------------------- ### AppleScript Example Source: https://github.com/sindresorhus/github-markdown-css/blob/main/index.html Another example of an indented code block, this time with AppleScript. ```markdown Here is an example of AppleScript: tell application "Foo" beep end tell ``` -------------------------------- ### Jekyll Integration Layout Source: https://github.com/sindresorhus/github-markdown-css/blob/main/_autodocs/implementation-patterns.md Example layout file for integrating github-markdown-css with Jekyll. ```html --- ---
{{ content }}
``` -------------------------------- ### Code Blocks Source: https://github.com/sindresorhus/github-markdown-css/blob/main/_autodocs/usage-guide.md Example of a standard code block using the
 and  tags with a language class.

```html

function hello() {
  console.log('Hello, World!');
}
``` -------------------------------- ### Manual Theme Override Example Source: https://github.com/sindresorhus/github-markdown-css/blob/main/_autodocs/api-reference/classes.md HTML example demonstrating how to force a dark theme on the markdown body using the data-theme attribute. ```html
``` -------------------------------- ### Usage Example Source: https://github.com/sindresorhus/github-markdown-css/blob/main/readme.md Example of how to use github-markdown.css in an HTML document, including basic styling for the markdown-body container and responsive adjustments. ```html

Unicorns

All the things

``` -------------------------------- ### Inline Links Source: https://github.com/sindresorhus/github-markdown-css/blob/main/index.html Examples of inline link syntax in Markdown. ```markdown This is [an example](http://example.com/ "Title") inline link. [This link](http://example.net/) has no title attribute. ``` -------------------------------- ### Task List Item Example Source: https://github.com/sindresorhus/github-markdown-css/blob/main/_autodocs/css-classes.md Example of a GFM task list item structure. ```html
  • Task description
``` -------------------------------- ### Highlight Class Example Source: https://github.com/sindresorhus/github-markdown-css/blob/main/_autodocs/css-classes.md Example of using the .highlight class for syntax-highlighted code blocks. ```html

    # Highlighted code here
  
``` -------------------------------- ### Images Source: https://github.com/sindresorhus/github-markdown-css/blob/main/index.html Example of an image with inline style. ```markdown Here's our logo (hover to see the title text): Inline-style: ``` -------------------------------- ### Code Blocks Source: https://github.com/sindresorhus/github-markdown-css/blob/main/index.html Examples of code blocks. ```html
foo
``` ```html
foo
``` ```html ``` ```html
``` -------------------------------- ### HTML table example Source: https://github.com/sindresorhus/github-markdown-css/blob/main/index.html Example of how to include an HTML table within Markdown content. ```html This is a regular paragraph.
Foo
This is another regular paragraph. ``` -------------------------------- ### Manual Theme Override Example Source: https://github.com/sindresorhus/github-markdown-css/blob/main/_autodocs/css-classes.md Example demonstrating how to manually override the theme (light or dark) on the .markdown-body element using data attributes. ```html
``` -------------------------------- ### Image Alignment Example Source: https://github.com/sindresorhus/github-markdown-css/blob/main/_autodocs/css-classes.md Example of floating an image to the left with text wrapping. ```html Left aligned

Text wraps around the image...

``` -------------------------------- ### Hugo Integration Layout Source: https://github.com/sindresorhus/github-markdown-css/blob/main/_autodocs/implementation-patterns.md Example layout file for integrating github-markdown-css with Hugo. ```html {{ .Title }}
{{ .Content }}
``` -------------------------------- ### Alert Boxes (Callouts) Source: https://github.com/sindresorhus/github-markdown-css/blob/main/_autodocs/usage-guide.md Examples of different markdown alert types (note, warning, important, tip, caution) using HTML structure. ```html

Note

This is a note callout

Warning

This is a warning callout

Important

This is an important callout

Tip

This is a tip callout

Caution

This is a caution callout

``` -------------------------------- ### Note Alert HTML Example Source: https://github.com/sindresorhus/github-markdown-css/blob/main/_autodocs/api-reference/classes.md Example HTML for a note-type alert box. ```html

Note

Important note here

``` -------------------------------- ### Using Highlight.js Source: https://github.com/sindresorhus/github-markdown-css/blob/main/_autodocs/usage-guide.md Apply syntax highlighting to code blocks using Highlight.js. ```html ``` -------------------------------- ### Alert Note Example Source: https://github.com/sindresorhus/github-markdown-css/blob/main/_autodocs/css-classes.md Example of an informational alert box. ```html

Note

Important information here

``` -------------------------------- ### Loading themes from CDN Source: https://github.com/sindresorhus/github-markdown-css/blob/main/_autodocs/css-themes.md Example of linking the CSS file from a CDN. ```html ``` -------------------------------- ### Syntax Highlighting Example Source: https://github.com/sindresorhus/github-markdown-css/blob/main/_autodocs/api-reference/classes.md Example of how syntax highlighting classes are applied to HTML elements to style code tokens. ```html function getName() { return "value"; } ``` -------------------------------- ### Code Span Examples Source: https://github.com/sindresorhus/github-markdown-css/blob/main/index.html Examples of using backticks for inline code spans in Markdown. ```markdown Use the `printf()` function. ``` ```html

Use the printf() function.

``` ```markdown ``There is a literal backtick (`) here.`` ``` ```html

There is a literal backtick (`) here.

``` ```markdown A single backtick in a code span: `` ` `` A backtick-delimited string in a code span: `` `foo` `` ``` ```html

A single backtick in a code span: `

A backtick-delimited string in a code span: `foo`

``` ```markdown Please don't use any `` tags. ``` ```html

Please don't use any <blink> tags.

``` ```markdown `—` is the decimal-encoded equivalent of `—`. ``` ```html

&#8212; is the decimal-encoded equivalent of &mdash;.

``` -------------------------------- ### Emphasis Source: https://github.com/sindresorhus/github-markdown-css/blob/main/index.html Examples of emphasis, italics, bold, and strikethrough. ```markdown Emphasis, aka italics, with *asterisks* or _underscores_. Strong emphasis, aka bold, with **asterisks** or __underscores__. Combined emphasis with **asterisks and _underscores_**. Strikethrough uses two tildes. ~~Scratch this.~~ ``` -------------------------------- ### Blockquote Examples Source: https://github.com/sindresorhus/github-markdown-css/blob/main/index.html Shows how to create blockquotes, including multi-line quotes and nested Markdown. ```Markdown > Blockquotes are very handy in email to emulate reply text. > This line is part of the same quote. Quote break. > This is a very long line that will still be quoted properly when it wraps. Oh boy let's keep writing to make sure this is long enough to actually wrap for everyone. Oh, you can *put* **Markdown** into a blockquote. ``` -------------------------------- ### Next.js Integration Page Source: https://github.com/sindresorhus/github-markdown-css/blob/main/_autodocs/implementation-patterns.md Example Next.js page component for serving Markdown content with github-markdown-css. ```jsx import fs from 'fs'; import path from 'path'; import { marked } from 'marked'; import 'github-markdown-css'; export async function getStaticProps({ params }) { const docPath = path.join(process.cwd(), 'docs', `${params.slug}.md`); const content = fs.readFileSync(docPath, 'utf-8'); const html = marked(content); return { props: { html }, revalidate: 3600 // ISR: revalidate every hour }; } export async function getStaticPaths() { const docsDir = path.join(process.cwd(), 'docs'); const files = fs.readdirSync(docsDir); return { paths: files.map(f => ({ params: { slug: f.replace('.md', '') } })), fallback: 'blocking' }; } export default function DocPage({ html }) { return (
); } ``` -------------------------------- ### highlight Class Usage Example Source: https://github.com/sindresorhus/github-markdown-css/blob/main/_autodocs/api-reference/classes.md Example of applying the .highlight class to a div wrapping a pre/code block for syntax-highlighted Python code. ```html

def hello():
    print("World")
  
``` -------------------------------- ### Unordered Lists Source: https://github.com/sindresorhus/github-markdown-css/blob/main/index.html Examples of unordered lists with different spacing. ```markdown * asterisk 1 * asterisk 2 * asterisk 3 ``` ```markdown * asterisk 1 * asterisk 2 * asterisk 3 ``` ```markdown * Plus 1 * Plus 2 * Plus 3 ``` ```markdown * Plus 1 * Plus 2 * Plus 3 ``` ```markdown * Minus 1 * Minus 2 * Minus 3 ``` ```markdown * Minus 1 * Minus 2 * Minus 3 ``` -------------------------------- ### Octicon Class Example Source: https://github.com/sindresorhus/github-markdown-css/blob/main/_autodocs/css-classes.md Example of using the .octicon class for GitHub Octicon SVG icons. ```html ... ``` -------------------------------- ### Atx-style H6 header Source: https://github.com/sindresorhus/github-markdown-css/blob/main/index.html Example of an Atx-style H6 header in Markdown. ```markdown ###### This is an H6 ``` -------------------------------- ### Inline HTML Example Source: https://github.com/sindresorhus/github-markdown-css/blob/main/index.html Demonstrates the use of raw HTML within Markdown. ```Markdown
Definition list
Is something people use sometimes.
Markdown in HTML
Does *not* work **very** well. Use HTML tags.
``` -------------------------------- ### Dark Theme Only Source: https://github.com/sindresorhus/github-markdown-css/blob/main/_autodocs/usage-guide.md Using github-markdown-dark.css to enforce the dark theme. ```html
``` -------------------------------- ### Atx-style H1 header Source: https://github.com/sindresorhus/github-markdown-css/blob/main/index.html Example of an Atx-style H1 header in Markdown. ```markdown # This is an H1 ``` -------------------------------- ### Using Node.js Source: https://github.com/sindresorhus/github-markdown-css/blob/main/_autodocs/usage-guide.md Convert markdown to HTML using Node.js and a Markdown parser. ```javascript import { marked } from 'marked'; const html = marked('# Hello\n\nWorld'); // Use html in your application ``` -------------------------------- ### Ordered Lists Source: https://github.com/sindresorhus/github-markdown-css/blob/main/index.html Examples of ordered lists with different spacing and multiple paragraphs. ```markdown 1. First 2. Second 3. Third ``` ```markdown 1. One 2. Two 3. Three ``` ```markdown 1. First 2. Second 3. Third ``` ```markdown 1. One 2. Two 3. Three ``` ```markdown 1. Item 1, graf one. Item 2. graf two. The quick brown fox jumped over the lazy dog's back. 2. Item 2. 3. Item 3. ``` -------------------------------- ### Using Pygments (Server-side) Source: https://github.com/sindresorhus/github-markdown-css/blob/main/_autodocs/usage-guide.md Apply syntax highlighting using Pygments for server-side rendering. ```python from pygments import highlight from pygments.lexers import get_lexer_by_name from pygments.formatters import HtmlFormatter code = 'print("Hello, World!")' lexer = get_lexer_by_name('python') formatter = HtmlFormatter(style='github-dark') html = highlight(code, lexer, formatter) ``` -------------------------------- ### Atx-style H2 header Source: https://github.com/sindresorhus/github-markdown-css/blob/main/index.html Example of an Atx-style H2 header in Markdown. ```markdown ## This is an H2 ``` -------------------------------- ### Gulp Task Source: https://github.com/sindresorhus/github-markdown-css/blob/main/index.html Example Gulp task for processing CSS with Myth. ```javascript var gulp = require('gulp'); var myth = require('gulp-myth'); gulp.task('default', function () { return gulp.src('src/app.css') .pipe(myth()) .pipe(gulp.dest('dist')); }); ``` -------------------------------- ### Print Styling Source: https://github.com/sindresorhus/github-markdown-css/blob/main/_autodocs/usage-guide.md Apply specific styles for printing the markdown content. ```html ``` -------------------------------- ### Nested blockquotes Source: https://github.com/sindresorhus/github-markdown-css/blob/main/index.html Example demonstrating how to nest blockquotes by adding additional levels of '>'. ```markdown > This is the first level of quoting. > > > This is nested blockquote. > > Back to the first level. ``` -------------------------------- ### Ordered Lists Source: https://github.com/sindresorhus/github-markdown-css/blob/main/index.html Example of an ordered list using numbers followed by periods. ```markdown 1. Bird 2. McHale 3. Parish ``` -------------------------------- ### Image Float Right Source: https://github.com/sindresorhus/github-markdown-css/blob/main/_autodocs/usage-guide.md Example of how to float an image to the right, allowing text to wrap around it. ```html Right aligned

Text wraps around the right-floated image...

``` -------------------------------- ### Unordered Lists - Asterisks Source: https://github.com/sindresorhus/github-markdown-css/blob/main/index.html Example of an unordered list using asterisks as markers. ```markdown * Red * Green * Blue ``` -------------------------------- ### Unordered Lists - Hyphens Source: https://github.com/sindresorhus/github-markdown-css/blob/main/index.html Example of an unordered list using hyphens as markers. ```markdown - Red - Green - Blue ``` -------------------------------- ### Doctype for Troubleshooting Source: https://github.com/sindresorhus/github-markdown-css/blob/main/readme.md Example of a doctype to include at the top of a page to avoid quirks mode. ```html ``` -------------------------------- ### Image Float Left Source: https://github.com/sindresorhus/github-markdown-css/blob/main/_autodocs/usage-guide.md Example of how to float an image to the left, allowing text to wrap around it. ```html Left aligned

Text wraps around the left-floated image...

``` -------------------------------- ### Setext-style H1 header Source: https://github.com/sindresorhus/github-markdown-css/blob/main/index.html Example of a Setext-style H1 header in Markdown. ```markdown This is an H1 ============== ``` -------------------------------- ### Setext-style H2 header Source: https://github.com/sindresorhus/github-markdown-css/blob/main/index.html Example of a Setext-style H2 header in Markdown. ```markdown This is an H2 ------------- ``` -------------------------------- ### Using High Contrast Theme Source: https://github.com/sindresorhus/github-markdown-css/blob/main/_autodocs/usage-guide.md Applying the high-contrast dark theme for accessibility requirements. ```html
``` -------------------------------- ### Blockquote with two paragraphs ('>' on every line) Source: https://github.com/sindresorhus/github-markdown-css/blob/main/index.html Example of a blockquote with two paragraphs where each line starts with '>'. ```markdown > This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet, > consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus. > Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus. > > Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse > id sem consectetuer libero luctus adipiscing. ``` -------------------------------- ### Implicit Link Name Shortcut Source: https://github.com/sindresorhus/github-markdown-css/blob/main/index.html Example of the implicit link name shortcut in Markdown. ```markdown [Google][] [Google]: http://google.com/ ``` -------------------------------- ### Theme-Specific Customization Source: https://github.com/sindresorhus/github-markdown-css/blob/main/_autodocs/usage-guide.md Customize colors for light and dark themes using media queries. ```html ``` -------------------------------- ### Using Starry Night Source: https://github.com/sindresorhus/github-markdown-css/blob/main/_autodocs/usage-guide.md Use Starry Night for GFM-compatible syntax highlighting. ```javascript import { toHtml } from 'https://esm.sh/starry-night@2'; import { common } from 'https://esm.sh/starry-night@2/lib/common.js'; const html = toHtml({ file: { value: code }, grammars: common }); ``` -------------------------------- ### Table Examples Source: https://github.com/sindresorhus/github-markdown-css/blob/main/index.html Demonstrates Markdown table syntax, including column alignment and inline Markdown within cells. ```Markdown | Tables | Are | Cool | | ------------- |:-------------:| -----:| | col 3 is | right-aligned | | | col 2 is | centered | | | zebra stripes | are neat | | ``` ```Markdown Markdown | Less | Pretty --- | --- | --- *Still* | `renders` | **nicely** 1 | 2 | 3 ``` -------------------------------- ### Complete HTML Template Source: https://github.com/sindresorhus/github-markdown-css/blob/main/_autodocs/usage-guide.md A complete HTML template demonstrating the use of github-markdown-css with responsive and color scheme support. ```html Markdown Document
``` -------------------------------- ### Loading themes from NPM Source: https://github.com/sindresorhus/github-markdown-css/blob/main/_autodocs/css-themes.md Instructions for installing the package via NPM and linking the CSS file in HTML. ```bash npm install github-markdown-css ``` ```html ``` -------------------------------- ### Closed Atx-style H1 header Source: https://github.com/sindresorhus/github-markdown-css/blob/main/index.html Example of a closed Atx-style H1 header in Markdown. ```markdown # This is an H1 # ``` -------------------------------- ### Footnotes Example Source: https://github.com/sindresorhus/github-markdown-css/blob/main/_autodocs/css-classes.md Example of a container for Markdown footnotes. ```html
  1. Footnote text here
``` -------------------------------- ### Closed Atx-style H2 header Source: https://github.com/sindresorhus/github-markdown-css/blob/main/index.html Example of a closed Atx-style H2 header in Markdown. ```markdown ## This is an H2 ## ``` -------------------------------- ### CSV Data Table Example Source: https://github.com/sindresorhus/github-markdown-css/blob/main/_autodocs/css-classes.md Example of a table styled for CSV data. ```html
1 Value 1
``` -------------------------------- ### No List Class Example Source: https://github.com/sindresorhus/github-markdown-css/blob/main/_autodocs/css-classes.md Example of using the .no-list class to remove list styling. ```html
  • Item without bullet
  • Another item without bullet
``` -------------------------------- ### Basic HTML Setup Source: https://github.com/sindresorhus/github-markdown-css/blob/main/_autodocs/README.md A basic HTML structure demonstrating how to include and use the github-markdown-css library. ```html

Your Markdown Here

Content...

``` -------------------------------- ### Absent Class Example Source: https://github.com/sindresorhus/github-markdown-css/blob/main/_autodocs/css-classes.md Example of using the .absent class for non-existent or deleted references. ```html Deleted Section ``` -------------------------------- ### Container Styles for SPA Documentation Source: https://github.com/sindresorhus/github-markdown-css/blob/main/_autodocs/implementation-patterns.md CSS for styling the documentation container in a Single Page Application. ```css .doc-container { box-sizing: border-box; min-width: 200px; max-width: 980px; margin: 0 auto; padding: 45px; } @media (max-width: 767px) { .doc-container { padding: 15px; } } ``` -------------------------------- ### Anchor Class Example Source: https://github.com/sindresorhus/github-markdown-css/blob/main/_autodocs/css-classes.md Example of using the .anchor class for anchor links within headings. ```html

Section Title

``` -------------------------------- ### Blog Post Display Component Source: https://github.com/sindresorhus/github-markdown-css/blob/main/_autodocs/implementation-patterns.md A React component for displaying blog posts, including metadata, images, and content rendered with GitHub-markdown-css. ```jsx import Link from 'next/link'; import 'github-markdown-css'; export function BlogPost({ post }) { return (

{post.title}

{post.author.name}
{post.author.name}
{post.readingTime} min read
{post.image && ( {post.title} )}
{post.tags.map(tag => ( #{tag} ))}
); } ``` ```css article { max-width: 768px; margin: 0 auto; padding: 2rem; } .post-header { margin-bottom: 2rem; padding-bottom: 2rem; border-bottom: 1px solid var(--borderColor-default); } .post-header h1 { margin: 0 0 1rem 0; font-size: 2.5rem; line-height: 1.2; } .post-meta { display: flex; align-items: center; gap: 1rem; color: var(--fgColor-muted); font-size: 0.875rem; } .post-meta img { width: 40px; height: 40px; border-radius: 50%; } .post-image { width: 100%; height: auto; margin: 2rem 0; border-radius: 8px; } .post-body { margin: 2rem 0; } .post-body h2 { margin-top: 1.5em; padding-top: 1rem; border-top: 1px solid var(--borderColor-default); } .post-footer { margin-top: 2rem; padding-top: 2rem; border-top: 1px solid var(--borderColor-default); } .post-tags { display: flex; gap: 0.5rem; flex-wrap: wrap; } .post-tag { padding: 0.25rem 0.75rem; background-color: var(--bgColor-muted); color: var(--fgColor-default); border-radius: 4px; text-decoration: none; font-size: 0.875rem; transition: background-color 0.2s; } .post-tag:hover { background-color: var(--borderColor-default); } ``` -------------------------------- ### task-list-item HTML Example Source: https://github.com/sindresorhus/github-markdown-css/blob/main/_autodocs/api-reference/classes.md Example of an HTML list item with the 'task-list-item' class, including a checkbox and label. ```html
  • ``` -------------------------------- ### no-list HTML Example Source: https://github.com/sindresorhus/github-markdown-css/blob/main/_autodocs/api-reference/classes.md Example of using the 'no-list' class on a UL element to remove list styling. ```html
    • Item without bullet
    • Item without bullet
    ``` -------------------------------- ### Horizontal Rule Examples Source: https://github.com/sindresorhus/github-markdown-css/blob/main/index.html Demonstrates various ways to create a horizontal rule using hyphens, asterisks, or underscores. ```markdown * * * *** ***** - - - --------------------------------------- _ _ _ ``` -------------------------------- ### markdown-body Usage Example Source: https://github.com/sindresorhus/github-markdown-css/blob/main/_autodocs/api-reference/classes.md Example of how to apply the .markdown-body class to an article element wrapping markdown HTML. ```html

    Title

    Content...

    ``` -------------------------------- ### Horizontal Rule Examples Source: https://github.com/sindresorhus/github-markdown-css/blob/main/index.html Shows different ways to create horizontal rules using hyphens, asterisks, or underscores. ```Markdown --- *** ___ ``` -------------------------------- ### anchor Class Usage Example Source: https://github.com/sindresorhus/github-markdown-css/blob/main/_autodocs/api-reference/classes.md Example of applying the .anchor class to an 'a' tag within a heading for an anchor link. ```html

    Section Title

    ``` -------------------------------- ### mr-2 Utility Class Usage Example Source: https://github.com/sindresorhus/github-markdown-css/blob/main/_autodocs/api-reference/classes.md Example of applying the .mr-2 class to a span element for icon space. ```html Icon Space ``` -------------------------------- ### Automatic Theme Switching (Default) Source: https://github.com/sindresorhus/github-markdown-css/blob/main/_autodocs/usage-guide.md Using the default github-markdown.css for automatic light/dark theme switching based on system preference. ```html
    ``` -------------------------------- ### Using GitHub's Markdown API Source: https://github.com/sindresorhus/github-markdown-css/blob/main/_autodocs/usage-guide.md Convert markdown to HTML using GitHub's Markdown API. ```javascript async function convertMarkdown(markdownText) { const response = await fetch('https://api.github.com/markdown', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ text: markdownText, mode: 'gfm' }) }); return response.text(); } // Usage convertMarkdown('# Hello\n\nWorld').then(html => { document.querySelector('.markdown-body').innerHTML = html; }); ``` -------------------------------- ### absent Class Usage Example Source: https://github.com/sindresorhus/github-markdown-css/blob/main/_autodocs/api-reference/classes.md Example of applying the .absent class to a span element referencing non-existent content. ```html Missing Reference ``` -------------------------------- ### octicon Class Usage Example Source: https://github.com/sindresorhus/github-markdown-css/blob/main/_autodocs/api-reference/classes.md Example of applying the .octicon class to a span element wrapping an SVG for a GitHub Octicon. ```html ``` -------------------------------- ### Tablet Layout Source: https://github.com/sindresorhus/github-markdown-css/blob/main/_autodocs/usage-guide.md CSS for a tablet layout of the markdown content. ```html ``` -------------------------------- ### Mobile-Optimized Layout Source: https://github.com/sindresorhus/github-markdown-css/blob/main/_autodocs/usage-guide.md CSS for a mobile-optimized layout of the markdown content. ```html ``` -------------------------------- ### React Component for SPA Documentation Source: https://github.com/sindresorhus/github-markdown-css/blob/main/_autodocs/implementation-patterns.md A React component to fetch and render Markdown content using github-markdown-css. ```jsx import { useState, useEffect } from 'react'; import { marked } from 'marked'; import 'github-markdown-css'; import './markdown.css'; // Container styles export function DocumentationPage({ docPath }) { const [content, setContent] = useState(''); useEffect(() => { fetch(`/docs/${docPath}.md`) .then(res => res.text()) .then(text => setContent(marked(text))) .catch(err => console.error(err)); }, [docPath]); return (
    ); } ``` -------------------------------- ### Lists Source: https://github.com/sindresorhus/github-markdown-css/blob/main/index.html Examples of ordered and unordered lists, including sub-lists and paragraphs within list items. ```markdown 1. First ordered list item 2. Another item ⋅⋅* Unordered sub-list. 1. Actual numbers don't matter, just that it's a number ⋅⋅1. Ordered sub-list 4. And another item. ⋅⋅⋅You can have properly indented paragraphs within list items. Notice the blank line above, and the leading spaces (at least one, but we'll use three here to also align the raw Markdown). ⋅⋅⋅To have a line break without a paragraph, you will need to use two trailing spaces.⋅⋅ ⋅⋅⋅Note that this line is separate, but within the same paragraph.⋅⋅ ⋅⋅⋅(This is contrary to the typical GFM line break behaviour, where trailing spaces are not required.) * Unordered list can use asterisks - Or minuses + Or pluses ```