### 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
``` -------------------------------- ### JavaScript DOM Manipulation Source: https://github.com/serkodev/markdown-exit/blob/main/packages/markdown-exit/tests/fixtures/commonmark/good.txt A JavaScript example that targets an HTML element with the ID 'demo' and sets its innerHTML content to 'Hello JavaScript!'. This demonstrates basic client-side scripting for dynamic web content. ```javascript // JavaScript example document.getElementById("demo").innerHTML = "Hello JavaScript!"; ``` -------------------------------- ### Install markdown-exit (v1+) Source: https://github.com/serkodev/markdown-exit/blob/main/README.md Installs the latest stable version of markdown-exit using npm. This version includes all new features and may contain breaking changes. ```bash npm i markdown-exit ``` -------------------------------- ### Markdown Nested Lists Source: https://github.com/serkodev/markdown-exit/blob/main/packages/markdown-exit/tests/fixtures/commonmark/good.txt Shows the syntax for creating nested lists in Markdown. This involves indenting list items to create sub-lists. ```markdown - a - b ``` -------------------------------- ### Install markdown-exit (v0.x Legacy) Source: https://github.com/serkodev/markdown-exit/blob/main/README.md Installs the legacy version of markdown-exit, which maintains full compatibility with markdown-it usage while adding TypeScript support, bug fixes, and performance improvements. ```bash npm i markdown-exit@legacy ``` -------------------------------- ### Handle Multiple Reference-Style Link Definitions Source: https://github.com/serkodev/markdown-exit/blob/main/packages/markdown-exit/tests/fixtures/commonmark/good.txt This snippet demonstrates multiple definitions for the same link label. Only the first definition `[foo]: first` is used when resolving `[foo]`, subsequent definitions are ignored. ```markdown [foo] [foo]: first [foo]: second ``` -------------------------------- ### Handle Nested Div Tags Source: https://github.com/serkodev/markdown-exit/blob/main/packages/markdown-exit/tests/fixtures/commonmark/good.txt This snippet shows how nested `
` tags are handled. The inner `
` is escaped and presented within a `
` 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 (