### Install markdown-exit v0.x (legacy) with npm, pnpm, yarn, or bun Source: https://github.com/serkodev/markdown-exit/blob/main/docs/guide/quick-start.md Installs the legacy version of markdown-exit, ensuring compatibility with markdown-it while adding TypeScript support and improvements. Use this for stable, established projects. ```sh npm install markdown-exit@legacy ``` ```sh pnpm add markdown-exit@legacy ``` ```sh yarn add markdown-exit@legacy ``` ```sh bun add markdown-exit@legacy ``` -------------------------------- ### Include markdown-exit v1+ via CDN Source: https://github.com/serkodev/markdown-exit/blob/main/docs/guide/quick-start.md Includes the latest version of markdown-exit using a CDN script tag. This is useful for quick testing or projects that do not use a module bundler. It demonstrates creating an instance and rendering basic Markdown. ```html ``` -------------------------------- ### Install markdown-exit v1+ with npm, pnpm, yarn, or bun Source: https://github.com/serkodev/markdown-exit/blob/main/docs/guide/quick-start.md Installs the latest version of markdown-exit using common package managers. This version includes new features and may have breaking changes from markdown-it. ```sh npm install markdown-exit ``` ```sh pnpm add markdown-exit ``` ```sh yarn add markdown-exit ``` ```sh bun add markdown-exit ``` -------------------------------- ### Include markdown-exit v0.x (legacy) via CDN Source: https://github.com/serkodev/markdown-exit/blob/main/docs/guide/quick-start.md Includes the legacy version of markdown-exit via a CDN script tag. This approach is suitable for older projects or when maintaining compatibility with markdown-it's legacy usage patterns. ```html ``` -------------------------------- ### Usage: Create markdown-exit instance with createMarkdownExit (TypeScript) Source: https://github.com/serkodev/markdown-exit/blob/main/docs/guide/quick-start.md Demonstrates the recommended way to use markdown-exit by importing and calling the `createMarkdownExit` factory function in TypeScript. This returns an instance ready for rendering Markdown content. ```ts import { createMarkdownExit } from 'markdown-exit' // factory helper const md = createMarkdownExit() md.render('# markdown-exit') ``` -------------------------------- ### Install Dependencies with pnpm Source: https://github.com/serkodev/markdown-exit/blob/main/CONTRIBUTING.md Installs all necessary project dependencies using the pnpm package manager. Ensure pnpm is installed globally before running this command. ```bash pnpm install ``` -------------------------------- ### PHP Example: Echo Variable Source: https://github.com/serkodev/markdown-exit/blob/main/packages/bench/samples/inline-html.md Demonstrates how to echo a variable within a PHP processing instruction. This is a basic example of server-side scripting within markdown. ```php ``` -------------------------------- ### C Language Integer Declaration Source: https://github.com/serkodev/markdown-exit/blob/main/packages/markdown-exit/tests/fixtures/commonmark/good.txt Declares an integer variable 'x' and initializes it with the value 33 in C. This is a fundamental example of variable declaration and assignment in C. ```c int x = 33; ``` -------------------------------- ### Handle Doctype Declaration Source: https://github.com/serkodev/markdown-exit/blob/main/packages/markdown-exit/tests/fixtures/commonmark/good.txt This snippet shows the handling of the HTML5 doctype declaration. The `` declaration is preserved as is. ```html ``` -------------------------------- ### Handle PHP Code Blocks Source: https://github.com/serkodev/markdown-exit/blob/main/packages/markdown-exit/tests/fixtures/commonmark/good.txt This snippet demonstrates how PHP code blocks are preserved. The `` block is output as is, followed by the rendered text `okay` as a paragraph. ```php '; ?> ``` -------------------------------- ### Handle HTML Table Source: https://github.com/serkodev/markdown-exit/blob/main/packages/markdown-exit/tests/fixtures/commonmark/good.txt This snippet shows a basic HTML table structure. The table with a single row and cell containing 'Hi' is rendered as is. ```html
| Hi |
` block.
```html
```
--------------------------------
### Usage: Default import with markdown-exit (JavaScript)
Source: https://github.com/serkodev/markdown-exit/blob/main/docs/guide/quick-start.md
Illustrates the default import method for markdown-exit, maintaining compatibility with markdown-it. This method allows calling the import directly or using it with the `new` keyword, though it's not recommended for modern codebases due to potential module interop issues.
```js
import MarkdownExit from 'markdown-exit'
// callable function
const md = MarkdownExit()
// OR with the `new` keyword
const md = new MarkdownExit()
```
--------------------------------
### Ruby Function Definition
Source: https://github.com/serkodev/markdown-exit/blob/main/packages/markdown-exit/tests/fixtures/commonmark/good.txt
Defines a simple Ruby function named 'foo' that takes one argument 'x' and always returns the integer 3. This is a basic example of Ruby function syntax.
```ruby
def foo(x)
return 3
end
```
--------------------------------
### Syntax Highlighting with markdown-exit and Shiki
Source: https://github.com/serkodev/markdown-exit/blob/main/docs/guide/rendering.md
Illustrates how to integrate syntax highlighting into markdown-exit rendering using the Shiki library. A custom `highlight` function is provided via the `createMarkdownExit` options. This example uses Shiki's synchronous highlighter. Dependencies include `shiki` and specific Shiki modules like `createHighlighterCoreSync`, `nord`, and `js`.
```typescript
import { createMarkdownExit } from 'markdown-exit'
import { createHighlighterCoreSync } from '@shiki/core'
import { nord } from '@shiki/theme-nord'
import { javascript as js } from '@shiki/language-javascript'
import { createJavaScriptRegexEngine } from '@shiki/engines'
const shiki = createHighlighterCoreSync({
themes: [nord],
langs: [js],
engine: createJavaScriptRegexEngine()
})
const md = createMarkdownExit({
highlight(str, lang) {
return shiki.highlight(str, { lang, theme: 'nord' })
}
})
```
--------------------------------
### Markdown Multi-level Nested Lists
Source: https://github.com/serkodev/markdown-exit/blob/main/packages/markdown-exit/tests/fixtures/commonmark/good.txt
Shows the syntax for creating deeply nested lists in Markdown. This example includes multiple levels of indentation to represent hierarchical data.
```markdown
- a
- b
- c
- d
- e
- f
```
--------------------------------
### Markdown Inline Code with Multiple Spans
Source: https://github.com/serkodev/markdown-exit/blob/main/packages/markdown-exit/tests/fixtures/commonmark/good.txt
Demonstrates rendering multiple inline code spans in Markdown on separate lines. This is useful for displaying distinct code elements or commands.
```markdown
` `
` `
```
--------------------------------
### Haskell HTML Tag Parsing
Source: https://github.com/serkodev/markdown-exit/blob/main/packages/markdown-exit/tests/fixtures/commonmark/good.txt
Imports the Text.HTML.TagSoup library and defines a main IO action that prints the result of parsing a string of HTML tags. This snippet showcases basic Haskell I/O and library usage for HTML parsing.
```haskell
import Text.HTML.TagSoup
main :: IO ()
main = print $ parseTags tags
```
--------------------------------
### Markdown Italic Emphasis with Underscores
Source: https://github.com/serkodev/markdown-exit/blob/main/packages/markdown-exit/tests/fixtures/commonmark/good.txt
Demonstrates the syntax for applying italic emphasis to text in Markdown using single underscores. This is an alternative to using asterisks for italics.
```markdown
_foo bar_
```
--------------------------------
### HTML to Markdown List Conversion
Source: https://github.com/serkodev/markdown-exit/blob/main/packages/markdown-exit/tests/fixtures/commonmark/good.txt
Demonstrates the conversion of nested HTML unordered lists ( and - ) into their Markdown equivalents. This is useful for parsing or generating Markdown from HTML content.
```markdown
- a
- b
```
c
```
- d
```
--------------------------------
### Markdown Inline Code with Backticks
Source: https://github.com/serkodev/markdown-exit/blob/main/packages/markdown-exit/tests/fixtures/commonmark/good.txt
Demonstrates the use of single backticks for inline code formatting in Markdown. This is useful for highlighting short snippets of code or commands within text.
```markdown
`hi`lo`
```
--------------------------------
### Markdown Inline Emphasis with Backticks
Source: https://github.com/serkodev/markdown-exit/blob/main/packages/markdown-exit/tests/fixtures/commonmark/good.txt
Demonstrates the interaction between Markdown's emphasis syntax (asterisks) and inline code formatting (backticks). The backticks take precedence, rendering the content as code.
```markdown
*foo`*`
```
--------------------------------
### Markdown Inline Code with Mixed Spacing and Newlines
Source: https://github.com/serkodev/markdown-exit/blob/main/packages/markdown-exit/tests/fixtures/commonmark/good.txt
Demonstrates rendering an inline code span in Markdown that includes varied spacing and a newline. This ensures that the code's formatting is accurately represented.
```markdown
`foo bar
baz`
```
--------------------------------
### CSS Styling Rules
Source: https://github.com/serkodev/markdown-exit/blob/main/packages/markdown-exit/tests/fixtures/commonmark/good.txt
Defines CSS rules to set the color of h1 elements to red and p elements to blue. This is a basic example of defining styles for HTML elements.
```css
h1 {color:red;}
p {color:blue;}
```
--------------------------------
### Markdown Emphasis with Underscore and Quotes
Source: https://github.com/serkodev/markdown-exit/blob/main/packages/markdown-exit/tests/fixtures/commonmark/good.txt
Demonstrates rendering emphasis using underscores when the emphasized text includes quotes. The quotes are preserved as literal characters.
```markdown
aa_"bb"_cc
```
--------------------------------
### Handle Reference-Style Link with URL on New Line
Source: https://github.com/serkodev/markdown-exit/blob/main/packages/markdown-exit/tests/fixtures/commonmark/good.txt
This snippet demonstrates a reference-style link where the URL is specified on a new line after the label. The link `[foo]` is resolved using `[foo]:
/url` to create a simple anchor tag.
```markdown
[foo]:
/url
[foo]
```
--------------------------------
### Markdown Emphasis with Numbers Underscore
Source: https://github.com/serkodev/markdown-exit/blob/main/packages/markdown-exit/tests/fixtures/commonmark/good.txt
Shows how Markdown renders emphasis using underscores when they surround numbers. The emphasis is applied to the numbers.
```markdown
5_6_78
```
--------------------------------
### Markdown Link with Backtick in URL
Source: https://github.com/serkodev/markdown-exit/blob/main/packages/markdown-exit/tests/fixtures/commonmark/good.txt
Demonstrates rendering a standard Markdown link where the URL contains a backtick character. The backtick in the URL is preserved, and the link is rendered as intended.
```markdown
`
```
--------------------------------
### Markdown Emphasis with Cyrillic Underscore
Source: https://github.com/serkodev/markdown-exit/blob/main/packages/markdown-exit/tests/fixtures/commonmark/good.txt
Illustrates the rendering of emphasis using underscores with Cyrillic text. This shows that the emphasis syntax generally works with non-Latin alphabets.
```markdown
пристаням_стремятся_
```
--------------------------------
### Handle Reference-Style Link Defined After Usage
Source: https://github.com/serkodev/markdown-exit/blob/main/packages/markdown-exit/tests/fixtures/commonmark/good.txt
This snippet shows a reference-style link `[foo]` used before its definition `[foo]: url`. The link is resolved to an anchor tag with the specified URL.
```markdown
[foo]
[foo]: url
```
--------------------------------
### Markdown Inline Code with Escaped Backslash
Source: https://github.com/serkodev/markdown-exit/blob/main/packages/markdown-exit/tests/fixtures/commonmark/good.txt
Shows how to include a literal backslash within an inline code span in Markdown. The backslash should be escaped.
```markdown
`foo\`bar`
```
--------------------------------
### Handle Reference-Style Link with Multi-line Title
Source: https://github.com/serkodev/markdown-exit/blob/main/packages/markdown-exit/tests/fixtures/commonmark/good.txt
This snippet demonstrates a reference-style link with a multi-line title. The link `[foo]` is resolved using `[foo]: /url 'title
line1
line2'`, and the title is rendered preserving the line breaks.
```markdown
[foo]: /url '
title
line1
line2
'
[foo]
```
--------------------------------
### Markdown Emphasis with Parentheses
Source: https://github.com/serkodev/markdown-exit/blob/main/packages/markdown-exit/tests/fixtures/commonmark/good.txt
Shows how Markdown handles emphasis using asterisks when the emphasized text is enclosed in parentheses. The parentheses are rendered literally, and the emphasis is applied within them.
```markdown
foo-_(bar)_
```
--------------------------------
### Handle Script Tags in Markdown
Source: https://github.com/serkodev/markdown-exit/blob/main/packages/markdown-exit/tests/fixtures/commonmark/good.txt
This snippet shows how `1. *bar*
```
--------------------------------
### Handle Empty Reference-Style Link URL
Source: https://github.com/serkodev/markdown-exit/blob/main/packages/markdown-exit/tests/fixtures/commonmark/good.txt
This snippet shows a reference-style link definition with an empty URL. The link `[foo]` resolves to `[foo]:` which results in an anchor tag with an empty `href` attribute.
```markdown
[foo]:
[foo]
```
--------------------------------
### Markdown Italic Emphasis with Numbers
Source: https://github.com/serkodev/markdown-exit/blob/main/packages/markdown-exit/tests/fixtures/commonmark/good.txt
Shows how Markdown renders italic emphasis when the asterisks surround numbers. The emphasis is applied to the numbers.
```markdown
5*6*78
```
--------------------------------
### Markdown Inline Code with Leading/Trailing Spaces
Source: https://github.com/serkodev/markdown-exit/blob/main/packages/markdown-exit/tests/fixtures/commonmark/good.txt
Shows how leading and trailing spaces within an inline code span in Markdown are preserved. This is useful for formatting command-line inputs or specific string literals.
```markdown
` a`
```
```markdown
` b `
```
--------------------------------
### Markdown Italic Emphasis with Leading Space Underscore
Source: https://github.com/serkodev/markdown-exit/blob/main/packages/markdown-exit/tests/fixtures/commonmark/good.txt
Shows how Markdown renders italic emphasis when there is a space preceding the opening underscore. The emphasis may not be applied.
```markdown
_ foo bar_
```
--------------------------------
### Handle Reference-Style Link Definition Without Usage
Source: https://github.com/serkodev/markdown-exit/blob/main/packages/markdown-exit/tests/fixtures/commonmark/good.txt
This snippet shows a reference-style link definition `[foo]: /url` that is not used in the document. The definition itself is rendered as plain text.
```markdown
[foo]: /url
```
--------------------------------
### Markdown Inline Code within Links
Source: https://github.com/serkodev/markdown-exit/blob/main/packages/markdown-exit/tests/fixtures/commonmark/good.txt
Illustrates how inline code formatting within a Markdown link is rendered. The code formatting is preserved, and the text remains a non-clickable string.
```markdown
[not a `link](/foo`)
```
--------------------------------
### Handle Invalid Reference-Style Link Format
Source: https://github.com/serkodev/markdown-exit/blob/main/packages/markdown-exit/tests/fixtures/commonmark/good.txt
This snippet shows an invalid reference-style link definition `[foo]:
(baz)`. Since this format is not recognized, it is rendered as plain text.
```markdown
[foo]: (baz)
[foo]
```
--------------------------------
### Markdown Inline Code with Escaped Backticks
Source: https://github.com/serkodev/markdown-exit/blob/main/packages/markdown-exit/tests/fixtures/commonmark/good.txt
Demonstrates how to create an inline code span containing only backticks in Markdown. This requires careful use of enclosing backticks.
```markdown
` ``` `
```
--------------------------------
### Handle HTML Div with Markdown
Source: https://github.com/serkodev/markdown-exit/blob/main/packages/markdown-exit/tests/fixtures/commonmark/good.txt
This snippet shows an HTML `` followed by markdown text. The div and its content 'bar' are preserved, and the markdown '*foo*' is rendered as emphasized text.
```markdown
bar
*foo*
```
--------------------------------
### Markdown Inline Code with Newlines
Source: https://github.com/serkodev/markdown-exit/blob/main/packages/markdown-exit/tests/fixtures/commonmark/good.txt
Shows the rendering of an inline code span in Markdown that spans multiple lines. This preserves newline characters within the code.
```markdown
``
foo
``
```
--------------------------------
### Markdown Italic Emphasis with Quotes
Source: https://github.com/serkodev/markdown-exit/blob/main/packages/markdown-exit/tests/fixtures/commonmark/good.txt
Illustrates the rendering of italic emphasis in Markdown when the emphasized text is enclosed in quotes. The quotes are treated as literal characters.
```markdown
a*"foo"*
```
--------------------------------
### Markdown Italic Emphasis
Source: https://github.com/serkodev/markdown-exit/blob/main/packages/markdown-exit/tests/fixtures/commonmark/good.txt
Demonstrates the basic syntax for applying italic emphasis to text in Markdown using single asterisks. This is commonly used for subtle emphasis or foreign words.
```markdown
*foo bar*
```
--------------------------------
### Markdown Inline Code with Newline
Source: https://github.com/serkodev/markdown-exit/blob/main/packages/markdown-exit/tests/fixtures/commonmark/good.txt
Illustrates the rendering of an inline code span in Markdown that contains a newline character. The newline is preserved within the code span.
```markdown
`foo
```
--------------------------------
### Markdown Emphasis with Special Characters
Source: https://github.com/serkodev/markdown-exit/blob/main/packages/markdown-exit/tests/fixtures/commonmark/good.txt
Shows how Markdown handles emphasis syntax with common special characters like '$', '£', and '€'. In these cases, the asterisks are typically rendered literally.
```markdown
*$*alpha.
*£*bravo.
*€*charlie.
```
--------------------------------
### Handle Reference-Style Link with Title and Whitespace
Source: https://github.com/serkodev/markdown-exit/blob/main/packages/markdown-exit/tests/fixtures/commonmark/good.txt
This snippet shows a reference-style link definition with leading/trailing whitespace and a title. The link `[foo]` is resolved using `[foo]: /url 'the title'`, producing an anchor tag with the correct URL and title.
```markdown
[foo]:
/url
'the title'
[foo]
```
--------------------------------
### Handle Reference-Style Link with Title
Source: https://github.com/serkodev/markdown-exit/blob/main/packages/markdown-exit/tests/fixtures/commonmark/good.txt
This snippet demonstrates a reference-style link with a title. The link `[foo]` is resolved using the definition `[foo]: /url "title"`, resulting in an anchor tag with the specified URL and title.
```markdown
[foo]: /url "title"
[foo]
```
--------------------------------
### Handle Markdown with HTML Anchor
Source: https://github.com/serkodev/markdown-exit/blob/main/packages/markdown-exit/tests/fixtures/commonmark/good.txt
This snippet demonstrates how markdown text is rendered alongside an HTML anchor tag. The text 'Foo' before the anchor is rendered as a paragraph, including the anchor and its content 'baz'.
```markdown
Foo
baz
```
--------------------------------
### Extending Markdown-Exit with Plugins
Source: https://context7.com/serkodev/markdown-exit/llms.txt
This snippet demonstrates how to create and use custom plugins to extend markdown-exit's functionality. It includes examples of adding custom block rules, render rules for new token types, and asynchronous rendering for features like image dimension fetching. It also shows how to integrate with existing markdown-it plugins.
```typescript
import { createMarkdownExit } from 'markdown-exit'
import type { MarkdownExit, Token } from 'markdown-exit'
// Custom plugin: add a custom token type
function pluginCustomAlert(md: MarkdownExit) {
// Add block rule
md.block.ruler.before('paragraph', 'alert', (state, startLine, endLine, silent) => {
const pos = state.bMarks[startLine] + state.tShift[startLine]
const max = state.eMarks[startLine]
const line = state.src.slice(pos, max)
// Check for alert syntax: !!! type
if (!line.startsWith('!!! ')) return false
if (silent) return true
const type = line.slice(4).trim()
const token = state.push('alert_open', 'div', 1)
token.attrSet('class', `alert alert-${type}`)
token.markup = '!!!'
token.info = type
state.push('inline', '', 0).content = ''
state.push('alert_close', 'div', -1).markup = '!!!'
state.line = startLine + 1
return true
})
// Add render rules
md.renderer.rules.alert_open = (tokens, idx) => {
const type = tokens[idx].info
return `
`
}
md.renderer.rules.alert_close = () => '\n'
}
// Async plugin: fetch and embed image dimensions
function pluginImageSize(md: MarkdownExit) {
md.renderer.rules.image = async (tokens, idx, options, env, self) => {
const token = tokens[idx]
const src = token.attrGet('src')
const alt = token.content
try {
// Simulate async fetch of image dimensions
const dimensions = await fetchImageSize(src!)
return `
`
} catch (error) {
// Fallback to default rendering
return self.renderToken(tokens, idx, options)
}
}
}
// Mock function for demonstration
async function fetchImageSize(url: string) {
return { width: 800, height: 600 }
}
// Use plugins
const md = createMarkdownExit()
md.use(pluginCustomAlert)
md.use(pluginImageSize)
const markdown = `
!!! warning

`
const html = await md.renderAsync(markdown)
console.log(html)
// Using markdown-it plugins (compatible)
import emoji from 'markdown-it-emoji'
md.use(emoji)
console.log(md.render('Hello :smile:'))
```
--------------------------------
### Markdown Italic Emphasis with Spaces
Source: https://github.com/serkodev/markdown-exit/blob/main/packages/markdown-exit/tests/fixtures/commonmark/good.txt
Demonstrates rendering italic emphasis in Markdown when there are spaces immediately following the opening asterisk and preceding the closing asterisk. This may result in the emphasis not being applied.
```markdown
* a *
```
--------------------------------
### Run Unit Tests with pnpm
Source: https://github.com/serkodev/markdown-exit/blob/main/CONTRIBUTING.md
Executes the project's unit tests using the pnpm test script. This is crucial for verifying code integrity and catching regressions. Ensure dependencies are installed first.
```bash
pnpm run test
```
--------------------------------
### Markdown Emphasis with Underscores Adjacent to Text
Source: https://github.com/serkodev/markdown-exit/blob/main/packages/markdown-exit/tests/fixtures/commonmark/good.txt
Demonstrates how Markdown applies emphasis using underscores when they are directly adjacent to other text characters. The emphasis is applied to the text between the underscores.
```markdown
foo_bar_
```
--------------------------------
### Handle CDATA Sections
Source: https://github.com/serkodev/markdown-exit/blob/main/packages/markdown-exit/tests/fixtures/commonmark/good.txt
This snippet shows how CDATA sections are preserved, including their content. The JavaScript function within the `` block remains intact, and the following text `okay` is rendered as a paragraph.
```javascript
```
--------------------------------
### Handle Reference-Style Link Definition with URL on New Line
Source: https://github.com/serkodev/markdown-exit/blob/main/packages/markdown-exit/tests/fixtures/commonmark/good.txt
This snippet demonstrates a reference-style link definition where the URL is on a new line after the label. The text 'bar' following the URL is ignored, and the link `[ ]` is treated as a literal.
```markdown
[
foo
]: /url
bar
```
--------------------------------
### Build Library with pnpm
Source: https://github.com/serkodev/markdown-exit/blob/main/CONTRIBUTING.md
Builds the project's library using the pnpm build script. This command typically compiles the source code into a distributable format. Ensure dependencies are installed before building.
```bash
pnpm run build
```
--------------------------------
### Handle Reference-Style Link with Empty URL in Angle Brackets
Source: https://github.com/serkodev/markdown-exit/blob/main/packages/markdown-exit/tests/fixtures/commonmark/good.txt
This snippet demonstrates a reference-style link with an empty URL enclosed in angle brackets. The link `[foo]` is resolved using `[foo]: <>`, resulting in an anchor tag with an empty `href` attribute.
```markdown
[foo]: <>
[foo]
```
--------------------------------
### Handle Markdown with HTML Div
Source: https://github.com/serkodev/markdown-exit/blob/main/packages/markdown-exit/tests/fixtures/commonmark/good.txt
This snippet illustrates the rendering of markdown text alongside an HTML ``. The text 'Foo' before the div is rendered as a paragraph, while the div and its content 'bar' are preserved.
```markdown
Foo
bar
```
--------------------------------
### Handle Non-ASCII Characters in Reference-Style Link
Source: https://github.com/serkodev/markdown-exit/blob/main/packages/markdown-exit/tests/fixtures/commonmark/good.txt
This snippet demonstrates the handling of non-ASCII characters in reference-style link labels and URLs. The link `[αγω]` is resolved using `[ΑΓΩ]: /φου`, correctly encoding the URL.
```markdown
[ΑΓΩ]: /φου
[αγω]
```
--------------------------------
### Markdown Italic Emphasis with Quotes Underscore
Source: https://github.com/serkodev/markdown-exit/blob/main/packages/markdown-exit/tests/fixtures/commonmark/good.txt
Illustrates the rendering of italic emphasis using underscores when the emphasized text is enclosed in quotes. The quotes are treated as literal characters.
```markdown
a_"foo"_
```
--------------------------------
### Handle Reference-Style Link Title on New Line
Source: https://github.com/serkodev/markdown-exit/blob/main/packages/markdown-exit/tests/fixtures/commonmark/good.txt
This snippet demonstrates a reference-style link where the title spans multiple lines. The title `"title
ok"` is correctly parsed and includes the newline character.
```markdown
[foo]: /url
"title
ok"
```
--------------------------------
### Markdown Link with Backtick in URL and Text
Source: https://github.com/serkodev/markdown-exit/blob/main/packages/markdown-exit/tests/fixtures/commonmark/good.txt
Shows a Markdown link where both the URL and the link text contain backticks. This demonstrates how Markdown parses such cases, encoding the URL and rendering the text as is.
```markdown
`
```
--------------------------------
### Handle Reference-Style Link Definition with Title on New Line
Source: https://github.com/serkodev/markdown-exit/blob/main/packages/markdown-exit/tests/fixtures/commonmark/good.txt
This snippet shows a reference-style link definition where the title is on a new line. The text 'ok' after the quoted title is rendered as part of the paragraph following the link.
```markdown
[foo]: /url "title" ok
```
--------------------------------
### Markdown Inline Code with Spaces and Backticks
Source: https://github.com/serkodev/markdown-exit/blob/main/packages/markdown-exit/tests/fixtures/commonmark/good.txt
Illustrates creating an inline code span in Markdown that includes spaces around backticks. This shows how whitespace is preserved within code spans.
```markdown
` `` `
```
--------------------------------
### Markdown Nested Lists with Code Blocks
Source: https://github.com/serkodev/markdown-exit/blob/main/packages/markdown-exit/tests/fixtures/commonmark/good.txt
Illustrates how Markdown handles nested lists where list items contain blockquotes and code blocks. This shows the rendering of complex list structures.
```markdown
- a
> b
```
c
```
- d
```
--------------------------------
### Handle Multi-line HTML Comments
Source: https://github.com/serkodev/markdown-exit/blob/main/packages/markdown-exit/tests/fixtures/commonmark/good.txt
This snippet illustrates the handling of multi-line HTML comments. The comment block `` is removed, and the subsequent text `okay` is rendered as a paragraph.
```markdown
okay
```
--------------------------------
### Markdown Italic Emphasis Adjacent to Text
Source: https://github.com/serkodev/markdown-exit/blob/main/packages/markdown-exit/tests/fixtures/commonmark/good.txt
Illustrates how Markdown applies italic emphasis when the asterisks are directly adjacent to other text characters. The emphasis is applied to the text between the asterisks.
```markdown
foo*bar*
```
--------------------------------
### Markdown Inline Code with Embedded Backticks
Source: https://github.com/serkodev/markdown-exit/blob/main/packages/markdown-exit/tests/fixtures/commonmark/good.txt
Illustrates creating an inline code span in Markdown that contains a single backtick. This is achieved by using double backticks to enclose the span.
```markdown
``foo`bar``
```
--------------------------------
### Markdown Inline Code with Multiple Backticks
Source: https://github.com/serkodev/markdown-exit/blob/main/packages/markdown-exit/tests/fixtures/commonmark/good.txt
Shows how to create an inline code span in Markdown containing multiple backticks. This uses a combination of single and double backticks for proper enclosure.
```markdown
` foo `` bar `
```
--------------------------------
### Markdown Inline Code with Newlines and Multiple Spaces
Source: https://github.com/serkodev/markdown-exit/blob/main/packages/markdown-exit/tests/fixtures/commonmark/good.txt
Illustrates how Markdown renders inline code spans containing newlines and multiple spaces. This preserves the exact formatting of the code snippet.
```markdown
``
foo
bar
baz
``
```
--------------------------------
### Handle Reference-Style Link with Special Characters
Source: https://github.com/serkodev/markdown-exit/blob/main/packages/markdown-exit/tests/fixtures/commonmark/good.txt
This snippet demonstrates a reference-style link with special characters in the label and URL, and a title with parentheses. The link `[Foo*bar]]` is resolved using `[Foo*bar]]:my_(url) 'title (with parens)'`, correctly encoding the URL and title.
```markdown
[Foo*bar\]]:my_(url) 'title (with parens)'
[Foo*bar\]]
```
--------------------------------
### Markdown Italic Emphasis with Leading Space
Source: https://github.com/serkodev/markdown-exit/blob/main/packages/markdown-exit/tests/fixtures/commonmark/good.txt
Shows how Markdown renders italic emphasis when there is a space preceding the opening asterisk. The emphasis may not be applied in this case, depending on the Markdown flavor.
```markdown
a * foo bar*
```
--------------------------------
### Markdown Fenced Code Block with Backticks
Source: https://github.com/serkodev/markdown-exit/blob/main/packages/markdown-exit/tests/fixtures/commonmark/good.txt
Demonstrates rendering a fenced code block in Markdown where the opening fence contains backticks. This shows how Markdown interprets variations in code block delimiters.
```markdown
```foo``
```
--------------------------------
### Handle HTML Div with Markdown Emphasis
Source: https://github.com/serkodev/markdown-exit/blob/main/packages/markdown-exit/tests/fixtures/commonmark/good.txt
This snippet demonstrates an HTML `