From 4a2b22c570f378839af37baa3594b9c948cf270c Mon Sep 17 00:00:00 2001 From: jhauga Date: Thu, 29 Jan 2026 00:01:36 -0500 Subject: [PATCH 1/2] Add new skill for custom markdown to html covnersion --- docs/README.skills.md | 1 + skills/markdown-to-html/SKILL.md | 916 ++++++++++++++++++ .../references/basic-markdown-to-html.md | 420 ++++++++ .../references/basic-markdown.md | 496 ++++++++++ .../references/code-blocks-to-html.md | 165 ++++ .../references/code-blocks.md | 70 ++ .../references/collapsed-sections-to-html.md | 136 +++ .../references/collapsed-sections.md | 48 + .../markdown-to-html/references/gomarkdown.md | 253 +++++ skills/markdown-to-html/references/hugo.md | 394 ++++++++ skills/markdown-to-html/references/jekyll.md | 321 ++++++ skills/markdown-to-html/references/marked.md | 121 +++ skills/markdown-to-html/references/pandoc.md | 226 +++++ .../references/tables-to-html.md | 169 ++++ skills/markdown-to-html/references/tables.md | 72 ++ ...riting-mathematical-expressions-to-html.md | 350 +++++++ .../writing-mathematical-expressions.md | 76 ++ 17 files changed, 4234 insertions(+) create mode 100644 skills/markdown-to-html/SKILL.md create mode 100644 skills/markdown-to-html/references/basic-markdown-to-html.md create mode 100644 skills/markdown-to-html/references/basic-markdown.md create mode 100644 skills/markdown-to-html/references/code-blocks-to-html.md create mode 100644 skills/markdown-to-html/references/code-blocks.md create mode 100644 skills/markdown-to-html/references/collapsed-sections-to-html.md create mode 100644 skills/markdown-to-html/references/collapsed-sections.md create mode 100644 skills/markdown-to-html/references/gomarkdown.md create mode 100644 skills/markdown-to-html/references/hugo.md create mode 100644 skills/markdown-to-html/references/jekyll.md create mode 100644 skills/markdown-to-html/references/marked.md create mode 100644 skills/markdown-to-html/references/pandoc.md create mode 100644 skills/markdown-to-html/references/tables-to-html.md create mode 100644 skills/markdown-to-html/references/tables.md create mode 100644 skills/markdown-to-html/references/writing-mathematical-expressions-to-html.md create mode 100644 skills/markdown-to-html/references/writing-mathematical-expressions.md diff --git a/docs/README.skills.md b/docs/README.skills.md index 45a9d055..9f1dfaa7 100644 --- a/docs/README.skills.md +++ b/docs/README.skills.md @@ -37,6 +37,7 @@ Skills differ from other primitives by supporting bundled assets (scripts, code | [image-manipulation-image-magick](../skills/image-manipulation-image-magick/SKILL.md) | Process and manipulate images using ImageMagick. Supports resizing, format conversion, batch processing, and retrieving image metadata. Use when working with images, creating thumbnails, resizing wallpapers, or performing batch image operations. | None | | [legacy-circuit-mockups](../skills/legacy-circuit-mockups/SKILL.md) | Generate breadboard circuit mockups and visual diagrams using HTML5 Canvas drawing techniques. Use when asked to create circuit layouts, visualize electronic component placements, draw breadboard diagrams, mockup 6502 builds, generate retro computer schematics, or design vintage electronics projects. Supports 555 timers, W65C02S microprocessors, 28C256 EEPROMs, W65C22 VIA chips, 7400-series logic gates, LEDs, resistors, capacitors, switches, buttons, crystals, and wires. | `references/28256-eeprom.md`
`references/555.md`
`references/6502.md`
`references/6522.md`
`references/6C62256.md`
`references/7400-series.md`
`references/assembly-compiler.md`
`references/assembly-language.md`
`references/basic-electronic-components.md`
`references/breadboard.md`
`references/common-breadboard-components.md`
`references/connecting-electronic-components.md`
`references/emulator-28256-eeprom.md`
`references/emulator-6502.md`
`references/emulator-6522.md`
`references/emulator-6C62256.md`
`references/emulator-lcd.md`
`references/lcd.md`
`references/minipro.md`
`references/t48eeprom-programmer.md` | | [make-skill-template](../skills/make-skill-template/SKILL.md) | Create new Agent Skills for GitHub Copilot from prompts or by duplicating this template. Use when asked to "create a skill", "make a new skill", "scaffold a skill", or when building specialized AI capabilities with bundled resources. Generates SKILL.md files with proper frontmatter, directory structure, and optional scripts/references/assets folders. | None | +| [markdown-to-html](../skills/markdown-to-html/SKILL.md) | Convert Markdown files to HTML similar to `marked.js`, `pandoc`, `gomarkdown/markdown`, or similar tools; or writing custom script to convert markdown to html and/or working on web template systems like `jekyll/jekyll`, `gohugoio/hugo`, or similar web templating systems that utilize markdown documents, converting them to html. Use when asked to "convert markdown to html", "transform md to html", "render markdown", "generate html from markdown", or when working with .md files and/or web a templating system that converts markdown to HTML output. Supports CLI and Node.js workflows with GFM, CommonMark, and standard Markdown flavors. | `references/basic-markdown-to-html.md`
`references/basic-markdown.md`
`references/code-blocks-to-html.md`
`references/code-blocks.md`
`references/collapsed-sections-to-html.md`
`references/collapsed-sections.md`
`references/gomarkdown.md`
`references/hugo.md`
`references/jekyll.md`
`references/marked.md`
`references/pandoc.md`
`references/tables-to-html.md`
`references/tables.md`
`references/writing-mathematical-expressions-to-html.md`
`references/writing-mathematical-expressions.md` | | [mcp-cli](../skills/mcp-cli/SKILL.md) | Interface for MCP (Model Context Protocol) servers via CLI. Use when you need to interact with external tools, APIs, or data sources through MCP servers, list available MCP servers/tools, or call MCP tools from command line. | None | | [microsoft-code-reference](../skills/microsoft-code-reference/SKILL.md) | Look up Microsoft API references, find working code samples, and verify SDK code is correct. Use when working with Azure SDKs, .NET libraries, or Microsoft APIs—to find the right method, check parameters, get working examples, or troubleshoot errors. Catches hallucinated methods, wrong signatures, and deprecated patterns by querying official docs. | None | | [microsoft-docs](../skills/microsoft-docs/SKILL.md) | Query official Microsoft documentation to understand concepts, find tutorials, and learn how services work. Use for Azure, .NET, Microsoft 365, Windows, Power Platform, and all Microsoft technologies. Get accurate, current information from learn.microsoft.com and other official Microsoft websites—architecture overviews, quickstarts, configuration guides, limits, and best practices. | None | diff --git a/skills/markdown-to-html/SKILL.md b/skills/markdown-to-html/SKILL.md new file mode 100644 index 00000000..cf70ef71 --- /dev/null +++ b/skills/markdown-to-html/SKILL.md @@ -0,0 +1,916 @@ +--- +name: markdown-to-html +description: 'Convert Markdown files to HTML similar to `marked.js`, `pandoc`, `gomarkdown/markdown`, or similar tools; or writing custom script to convert markdown to html and/or working on web template systems like `jekyll/jekyll`, `gohugoio/hugo`, or similar web templating systems that utilize markdown documents, converting them to html. Use when asked to "convert markdown to html", "transform md to html", "render markdown", "generate html from markdown", or when working with .md files and/or web a templating system that converts markdown to HTML output. Supports CLI and Node.js workflows with GFM, CommonMark, and standard Markdown flavors.' +--- + +# Markdown to HTML Conversion + +Expert skill for converting Markdown documents to HTML using the marked.js library, or writing data conversion scripts; in this case scripts similar to [markedJS/marked](https://github.com/markedjs/marked) repository. For custom scripts knowledge is not confined to `marked.js`, but data conversion methods are utilized from tools like [pandoc](https://github.com/jgm/pandoc) and [gomarkdown/markdown](https://github.com/gomarkdown/markdown) for data conversion; [jekyll/jekyll](https://github.com/jekyll/jekyll) and [gohugoio/hugo](https://github.com/gohugoio/hugo) for templating systems. + +The conversion script or tool should handles single files, batch conversions, and advanced configurations. + +## When to Use This Skill + +- User asks to "convert markdown to html" or "transform md files" +- User wants to "render markdown" as HTML output +- User needs to generate HTML documentation from .md files +- User is building static sites from Markdown content +- User is building template system that converts markdown to html +- User is working on a tool, widget, or custom template for an existing templating system +- User wants to preview Markdown as rendered HTML + +## Converting Markdown to HTML + +### Essential Basic Conversions + +For more see [basic-markdown-to-html.md](references/basic-markdown-to-html.md) + +```text + ```markdown + # Level 1 + ## Level 2 + + One sentence with a [link](https://example.com), and a HTML snippet like `

paragraph tag

`. + + - `ul` list item 1 + - `ul` list item 2 + + 1. `ol` list item 1 + 2. `ol` list item 1 + + | Table Item | Description | + | One | One is the spelling of the number `1`. | + | Two | Two is the spelling of the number `2`. | + + ```js + var one = 1; + var two = 2; + + function simpleMath(x, y) { + return x + y; + } + console.log(simpleMath(one, two)); + ``` + ``` + + ```html +

Level 1

+

Level 2

+ +

One sentence with a link, and a HTML snippet like <p>paragraph tag</p>.

+ + + +
    +
  1. `ol` list item 1
  2. +
  3. `ol` list item 2
  4. +
+ + + + + + + + + + + + + + + + + + +
Table ItemDescription
OneOne is the spelling of the number `1`.
TwoTwo is the spelling of the number `2`.
+ +
+     var one = 1;
+     var two = 2;
+
+     function simpleMath(x, y) {
+      return x + y;
+     }
+     console.log(simpleMath(one, two));
+    
+ ``` +``` + +### Code Block Conversions + +For more see [code-blocks-to-html.md](references/code-blocks-to-html.md) + +```text + + ```markdown + your code here + ``` + + ```html +

+    your code here
+    
+ ``` + + ```js + console.log("Hello world"); + ``` + + ```html +

+    console.log("Hello world");
+    
+ ``` + + ```markdown + ``` + + ``` + visible backticks + ``` + + ``` + ``` + + ```html +

+      ```
+
+      visible backticks
+
+      ```
+      
+ ``` +``` + +### Collapsed Section Conversions + +For more see [collapsed-sections-to-html.md](references/collapsed-sections-to-html.md) + +```text + ```markdown +
+ More info + + ### Header inside + + - Lists + - **Formatting** + - Code blocks + + ```js + console.log("Hello"); + ``` + +
+ ``` + + ```html +
+ More info + +

Header inside

+ + + +
+     console.log("Hello");
+    
+ +
+ ``` +``` + +### Mathematical Expression Conversions + +For more see [writing-mathematical-expressions-to-html.md](references/writing-mathematical-expressions-to-html.md) + +```text + ```markdown + This sentence uses `$` delimiters to show math inline: $\sqrt{3x-1}+(1+x)^2$ + ``` + + ```html +

This sentence uses $ delimiters to show math inline: + + 3x1 + +(1+x + )2 + + +

+ ``` + + ```markdown + **The Cauchy-Schwarz Inequality**\ + $$\left( \sum_{k=1}^n a_k b_k \right)^2 \leq \left( \sum_{k=1}^n a_k^2 \right) \left( \sum_{k=1}^n b_k^2 \right)$$ + ``` + + ```html +

The Cauchy-Schwarz Inequality
+ + + + ( + + k=1n + + ak + bk + ) + + 2 + + + ( + + k=1 + n + + ak2 + ) + + ( + + k=1 + n + + bk2 + ) + + +

+ ``` +``` + +### Table Conversions + +For more see [tables-to-html.md](references/tables-to-html.md) + +```text + ```markdown + | First Header | Second Header | + | ------------- | ------------- | + | Content Cell | Content Cell | + | Content Cell | Content Cell | + ``` + + ```html + + + + + + +
First HeaderSecond Header
Content CellContent Cell
Content CellContent Cell
+ ``` + + ```markdown + | Left-aligned | Center-aligned | Right-aligned | + | :--- | :---: | ---: | + | git status | git status | git status | + | git diff | git diff | git diff | + ``` + + ```html + + + + + + + + + + + + + + + + + + + + +
Left-alignedCenter-alignedRight-aligned
git statusgit statusgit status
git diffgit diffgit diff
+ ``` +``` + +## Working with [`markedJS/marked`](references/marked.md) + +### Prerequisites + +- Node.js installed (for CLI or programmatic usage) +- Install marked globally for CLI: `npm install -g marked` +- Or install locally: `npm install marked` + +### Quick Conversion Methods + +See [marked.md](references/marked.md) **Quick Conversion Methods** + +### Step-by-Step Workflows + +See [marked.md](references/marked.md) **Step-by-Step Workflows** + +### CLI Configuration + +### Using Config Files + +Create `~/.marked.json` for persistent options: + +```json +{ + "gfm": true, + "breaks": true +} +``` + +Or use a custom config: + +```bash +marked -i input.md -o output.html -c config.json +``` + +### CLI Options Reference + +| Option | Description | +|--------|-------------| +| `-i, --input ` | Input Markdown file | +| `-o, --output ` | Output HTML file | +| `-s, --string ` | Parse string instead of file | +| `-c, --config ` | Use custom config file | +| `--gfm` | Enable GitHub Flavored Markdown | +| `--breaks` | Convert newlines to `
` | +| `--help` | Show all options | + +### Security Warning + +⚠️ **Marked does NOT sanitize output HTML.** For untrusted input, use a sanitizer: + +```javascript +import { marked } from 'marked'; +import DOMPurify from 'dompurify'; + +const unsafeHtml = marked.parse(untrustedMarkdown); +const safeHtml = DOMPurify.sanitize(unsafeHtml); +``` + +Recommended sanitizers: + +- [DOMPurify](https://github.com/cure53/DOMPurify) (recommended) +- [sanitize-html](https://github.com/apostrophecms/sanitize-html) +- [js-xss](https://github.com/leizongmin/js-xss) + +### Supported Markdown Flavors + +| Flavor | Support | +|--------|---------| +| Original Markdown | 100% | +| CommonMark 0.31 | 98% | +| GitHub Flavored Markdown | 97% | + +### Troubleshooting + +| Issue | Solution | +|-------|----------| +| Special characters at file start | Strip zero-width chars: `content.replace(/^[\u200B\u200C\u200D\uFEFF]/,"")` | +| Code blocks not highlighting | Add a syntax highlighter like highlight.js | +| Tables not rendering | Ensure `gfm: true` option is set | +| Line breaks ignored | Set `breaks: true` in options | +| XSS vulnerability concerns | Use DOMPurify to sanitize output | + +## Working with [`pandoc`](references/pandoc.md) + +### Prerequisites + +- Pandoc installed (download from ) +- For PDF output: LaTeX installation (MacTeX on macOS, MiKTeX on Windows, texlive on Linux) +- Terminal/command prompt access + +### Quick Conversion Methods + +#### Method 1: CLI Basic Conversion + +```bash +# Convert markdown to HTML +pandoc input.md -o output.html + +# Convert with standalone document (includes header/footer) +pandoc input.md -s -o output.html + +# Explicit format specification +pandoc input.md -f markdown -t html -s -o output.html +``` + +#### Method 2: Filter Mode (Interactive) + +```bash +# Start pandoc as a filter +pandoc + +# Type markdown, then Ctrl-D (Linux/macOS) or Ctrl-Z+Enter (Windows) +Hello *pandoc*! +# Output:

Hello pandoc!

+``` + +#### Method 3: Format Conversion + +```bash +# HTML to Markdown +pandoc -f html -t markdown input.html -o output.md + +# Markdown to LaTeX +pandoc input.md -s -o output.tex + +# Markdown to PDF (requires LaTeX) +pandoc input.md -s -o output.pdf + +# Markdown to Word +pandoc input.md -s -o output.docx +``` + +### CLI Configuration + +| Option | Description | +|--------|-------------| +| `-f, --from ` | Input format (markdown, html, latex, etc.) | +| `-t, --to ` | Output format (html, latex, pdf, docx, etc.) | +| `-s, --standalone` | Produce standalone document with header/footer | +| `-o, --output ` | Output file (inferred from extension) | +| `--mathml` | Convert TeX math to MathML | +| `--metadata title="Title"` | Set document metadata | +| `--toc` | Include table of contents | +| `--template ` | Use custom template | +| `--help` | Show all options | + +### Security Warning + +⚠️ **Pandoc processes input faithfully.** When converting untrusted markdown: + +- Use `--sandbox` mode to disable external file access +- Validate input before processing +- Sanitize HTML output if displayed in browsers + +```bash +# Run in sandbox mode for untrusted input +pandoc --sandbox input.md -o output.html +``` + +### Supported Markdown Flavors + +| Flavor | Support | +|--------|---------| +| Pandoc Markdown | 100% (native) | +| CommonMark | Full (use `-f commonmark`) | +| GitHub Flavored Markdown | Full (use `-f gfm`) | +| MultiMarkdown | Partial | + +### Troubleshooting + +| Issue | Solution | +|-------|----------| +| PDF generation fails | Install LaTeX (MacTeX, MiKTeX, or texlive) | +| Encoding issues on Windows | Run `chcp 65001` before using pandoc | +| Missing standalone headers | Add `-s` flag for complete documents | +| Math not rendering | Use `--mathml` or `--mathjax` option | +| Tables not rendering | Ensure proper table syntax with pipes and dashes | + +## Working with [`gomarkdown/markdown`](references/gomarkdown.md) + +### Prerequisites + +- Go 1.18 or higher installed +- Install the library: `go get github.com/gomarkdown/markdown` +- For CLI tool: `go install github.com/gomarkdown/mdtohtml@latest` + +### Quick Conversion Methods + +#### Method 1: Simple Conversion (Go) + +```go +package main + +import ( + "fmt" + "github.com/gomarkdown/markdown" +) + +func main() { + md := []byte("# Hello World\n\nThis is **bold** text.") + html := markdown.ToHTML(md, nil, nil) + fmt.Println(string(html)) +} +``` + +#### Method 2: CLI Tool + +```bash +# Install mdtohtml +go install github.com/gomarkdown/mdtohtml@latest + +# Convert file +mdtohtml input.md output.html + +# Convert file (output to stdout) +mdtohtml input.md +``` + +#### Method 3: Custom Parser and Renderer + +```go +package main + +import ( + "github.com/gomarkdown/markdown" + "github.com/gomarkdown/markdown/html" + "github.com/gomarkdown/markdown/parser" +) + +func mdToHTML(md []byte) []byte { + // Create parser with extensions + extensions := parser.CommonExtensions | parser.AutoHeadingIDs | parser.NoEmptyLineBeforeBlock + p := parser.NewWithExtensions(extensions) + doc := p.Parse(md) + + // Create HTML renderer with extensions + htmlFlags := html.CommonFlags | html.HrefTargetBlank + opts := html.RendererOptions{Flags: htmlFlags} + renderer := html.NewRenderer(opts) + + return markdown.Render(doc, renderer) +} +``` + +### CLI Configuration + +The `mdtohtml` CLI tool has minimal options: + +```bash +mdtohtml input-file [output-file] +``` + +For advanced configuration, use the Go library programmatically with parser and renderer options: + +| Parser Extension | Description | +|------------------|-------------| +| `parser.CommonExtensions` | Tables, fenced code, autolinks, strikethrough, etc. | +| `parser.AutoHeadingIDs` | Generate IDs for headings | +| `parser.NoEmptyLineBeforeBlock` | No blank line needed before blocks | +| `parser.MathJax` | MathJax support for LaTeX math | + +| HTML Flag | Description | +|-----------|-------------| +| `html.CommonFlags` | Common HTML output flags | +| `html.HrefTargetBlank` | Add `target="_blank"` to links | +| `html.CompletePage` | Generate complete HTML page | +| `html.UseXHTML` | Generate XHTML output | + +### Security Warning + +⚠️ **gomarkdown does NOT sanitize output HTML.** For untrusted input, use Bluemonday: + +```go +import ( + "github.com/microcosm-cc/bluemonday" + "github.com/gomarkdown/markdown" +) + +maybeUnsafeHTML := markdown.ToHTML(md, nil, nil) +html := bluemonday.UGCPolicy().SanitizeBytes(maybeUnsafeHTML) +``` + +Recommended sanitizer: [Bluemonday](https://github.com/microcosm-cc/bluemonday) + +### Supported Markdown Flavors + +| Flavor | Support | +|--------|---------| +| Original Markdown | 100% | +| CommonMark | High (with extensions) | +| GitHub Flavored Markdown | High (tables, fenced code, strikethrough) | +| MathJax/LaTeX Math | Supported via extension | +| Mmark | Supported | + +### Troubleshooting + +| Issue | Solution | +|-------|----------| +| Windows/Mac newlines not parsed | Use `parser.NormalizeNewlines(input)` | +| Tables not rendering | Enable `parser.Tables` extension | +| Code blocks without highlighting | Integrate with syntax highlighter like Chroma | +| Math not rendering | Enable `parser.MathJax` extension | +| XSS vulnerabilities | Use Bluemonday to sanitize output | + +## Working with [`jekyll`](references/jekyll.md) + +### Prerequisites + +- Ruby version 2.7.0 or higher +- RubyGems +- GCC and Make (for native extensions) +- Install Jekyll and Bundler: `gem install jekyll bundler` + +### Quick Conversion Methods + +#### Method 1: Create New Site + +```bash +# Create a new Jekyll site +jekyll new myblog + +# Change to site directory +cd myblog + +# Build and serve locally +bundle exec jekyll serve + +# Access at http://localhost:4000 +``` + +#### Method 2: Build Static Site + +```bash +# Build site to _site directory +bundle exec jekyll build + +# Build with production environment +JEKYLL_ENV=production bundle exec jekyll build +``` + +#### Method 3: Live Reload Development + +```bash +# Serve with live reload +bundle exec jekyll serve --livereload + +# Serve with drafts +bundle exec jekyll serve --drafts +``` + +### CLI Configuration + +| Command | Description | +|---------|-------------| +| `jekyll new ` | Create new Jekyll site | +| `jekyll build` | Build site to `_site` directory | +| `jekyll serve` | Build and serve locally | +| `jekyll clean` | Remove generated files | +| `jekyll doctor` | Check for configuration issues | + +| Serve Options | Description | +|---------------|-------------| +| `--livereload` | Reload browser on changes | +| `--drafts` | Include draft posts | +| `--port ` | Set server port (default: 4000) | +| `--host ` | Set server host (default: localhost) | +| `--baseurl ` | Set base URL | + +### Security Warning + +⚠️ **Jekyll security considerations:** + +- Avoid using `safe: false` in production +- Use `exclude` in `_config.yml` to prevent sensitive files from being published +- Sanitize user-generated content if accepting external input +- Keep Jekyll and plugins updated + +```yaml +# _config.yml security settings +exclude: + - Gemfile + - Gemfile.lock + - node_modules + - vendor +``` + +### Supported Markdown Flavors + +| Flavor | Support | +|--------|---------| +| Kramdown (default) | 100% | +| CommonMark | Via plugin (jekyll-commonmark) | +| GitHub Flavored Markdown | Via plugin (jekyll-commonmark-ghpages) | +| RedCarpet | Via plugin (deprecated) | + +Configure markdown processor in `_config.yml`: + +```yaml +markdown: kramdown +kramdown: + input: GFM + syntax_highlighter: rouge +``` + +### Troubleshooting + +| Issue | Solution | +|-------|----------| +| Ruby 3.0+ fails to serve | Run `bundle add webrick` | +| Gem dependency errors | Run `bundle install` | +| Slow builds | Use `--incremental` flag | +| Liquid syntax errors | Check for unescaped `{` in content | +| Plugin not loading | Add to `_config.yml` plugins list | + +## Working with [`hugo`](references/hugo.md) + +### Prerequisites + +- Hugo installed (download from ) +- Git (recommended for themes and modules) +- Go (optional, for Hugo Modules) + +### Quick Conversion Methods + +#### Method 1: Create New Site + +```bash +# Create a new Hugo site +hugo new site mysite + +# Change to site directory +cd mysite + +# Add a theme +git init +git submodule add https://github.com/theNewDynamic/gohugo-theme-ananke themes/ananke +echo "theme = 'ananke'" >> hugo.toml + +# Create content +hugo new content posts/my-first-post.md + +# Start development server +hugo server -D +``` + +#### Method 2: Build Static Site + +```bash +# Build site to public directory +hugo + +# Build with minification +hugo --minify + +# Build for specific environment +hugo --environment production +``` + +#### Method 3: Development Server + +```bash +# Start server with drafts +hugo server -D + +# Start with live reload and bind to all interfaces +hugo server --bind 0.0.0.0 --baseURL http://localhost:1313/ + +# Start with specific port +hugo server --port 8080 +``` + +### CLI Configuration + +| Command | Description | +|---------|-------------| +| `hugo new site ` | Create new Hugo site | +| `hugo new content ` | Create new content file | +| `hugo` | Build site to `public` directory | +| `hugo server` | Start development server | +| `hugo mod init` | Initialize Hugo Modules | + +| Build Options | Description | +|---------------|-------------| +| `-D, --buildDrafts` | Include draft content | +| `-E, --buildExpired` | Include expired content | +| `-F, --buildFuture` | Include future-dated content | +| `--minify` | Minify output | +| `--gc` | Run garbage collection after build | +| `-d, --destination ` | Output directory | + +| Server Options | Description | +|----------------|-------------| +| `--bind ` | Interface to bind to | +| `-p, --port ` | Port number (default: 1313) | +| `--liveReloadPort ` | Live reload port | +| `--disableLiveReload` | Disable live reload | +| `--navigateToChanged` | Navigate to changed content | + +### Security Warning + +⚠️ **Hugo security considerations:** + +- Configure security policy in `hugo.toml` for external commands +- Use `--enableGitInfo` carefully with public repositories +- Validate shortcode parameters for user-generated content + +```toml +# hugo.toml security settings +[security] + enableInlineShortcodes = false + [security.exec] + allow = ['^go$', '^npx$', '^postcss$'] + [security.funcs] + getenv = ['^HUGO_', '^CI$'] + [security.http] + methods = ['(?i)GET|POST'] + urls = ['.*'] +``` + +### Supported Markdown Flavors + +| Flavor | Support | +|--------|---------| +| Goldmark (default) | 100% (CommonMark compliant) | +| GitHub Flavored Markdown | Full (tables, strikethrough, autolinks) | +| CommonMark | 100% | +| Blackfriday (legacy) | Deprecated, not recommended | + +Configure markdown in `hugo.toml`: + +```toml +[markup] + [markup.goldmark] + [markup.goldmark.extensions] + definitionList = true + footnote = true + linkify = true + strikethrough = true + table = true + taskList = true + [markup.goldmark.renderer] + unsafe = false # Set true to allow raw HTML +``` + +### Troubleshooting + +| Issue | Solution | +|-------|----------| +| "Page not found" on paths | Check `baseURL` in config | +| Theme not loading | Verify theme in `themes/` or Hugo Modules | +| Slow builds | Use `--templateMetrics` to identify bottlenecks | +| Raw HTML not rendering | Set `unsafe = true` in goldmark config | +| Images not loading | Check `static/` folder structure | +| Module errors | Run `hugo mod tidy` | + +## References + +### Writing and Styling Markdown + +- [basic-markdown.md](references/basic-markdown.md) +- [code-blocks.md](references/code-blocks.md) +- [collapsed-sections.md](references/collapsed-sections.md) +- [tables.md](references/tables.md) +- [writing-mathematical-expressions.md](references/writing-mathematical-expressions.md) +- Markdown Guide: +- Styling Markdown: + +### [`markedJS/marked`](references/marked.md) + +- Official documentation: +- Advanced options: +- Extensibility: +- GitHub repository: + +### [`pandoc`](references/pandoc.md) + +- Getting started: +- Official documentation: +- Extensibility: +- GitHub repository: + +### [`gomarkdown/markdown`](references/gomarkdown.md) + +- Official documentation: +- Advanced configuration: +- Markdown processing: +- GitHub repository: + +### [`jekyll`](references/jekyll.md) + +- Official documentation: +- Configuration options: +- Plugins: + - [Installation](https://jekyllrb.com/docs/plugins/installation/) + - [Generators](https://jekyllrb.com/docs/plugins/generators/) + - [Converters](https://jekyllrb.com/docs/plugins/converters/) + - [Commands](https://jekyllrb.com/docs/plugins/commands/) + - [Tags](https://jekyllrb.com/docs/plugins/tags/) + - [Filters](https://jekyllrb.com/docs/plugins/filters/) + - [Hooks](https://jekyllrb.com/docs/plugins/hooks/) +- GitHub repository: + +### [`hugo`](references/hugo.md) + +- Official documentation: +- All Settings: +- Editor Plugins: +- GitHub repository: diff --git a/skills/markdown-to-html/references/basic-markdown-to-html.md b/skills/markdown-to-html/references/basic-markdown-to-html.md new file mode 100644 index 00000000..2e2f6b96 --- /dev/null +++ b/skills/markdown-to-html/references/basic-markdown-to-html.md @@ -0,0 +1,420 @@ +# Basic Markdown to HTML + +## Headings + +### Markdown + +```md +# Basic writing and formatting syntax +``` + +### Parsed HTML + +```html +

Basic writing and formatting syntax

+``` + +```md +## Headings +``` + +```html +

Headings

+``` + +```md +### A third-level heading +``` + +```html +

A third-level heading

+``` + +### Markdown + +```md +Heading 2 +--- +``` + +### Parsed HTML + +```html +

Heading 2

+``` + +--- + +## Paragraphs + +### Markdown + +```md +Create sophisticated formatting for your prose and code on GitHub with simple syntax. +``` + +### Parsed HTML + +```html +

Create sophisticated formatting for your prose and code on GitHub with simple syntax.

+``` + +--- + +## Inline Formatting + +### Bold + +```md +**This is bold text** +``` + +```html +This is bold text +``` + +--- + +### Italic + +```md +_This text is italicized_ +``` + +```html +This text is italicized +``` + +--- + +### Bold + Italic + +```md +***All this text is important*** +``` + +```html +All this text is important +``` + +--- + +### Strikethrough (GFM) + +```md +~~This was mistaken text~~ +``` + +```html +This was mistaken text +``` + +--- + +### Subscript / Superscript (raw HTML passthrough) + +```md +This is a subscript text +``` + +```html +

This is a subscript text

+``` + +```md +This is a superscript text +``` + +```html +

This is a superscript text

+``` + +--- + +## Blockquotes + +### Markdown + +```md +> Text that is a quote +``` + +### Parsed HTML + +```html +
+

Text that is a quote

+
+``` + +--- + +### GitHub Alert (NOTE) + +```md +> [!NOTE] +> Useful information. +``` + +```html +
+

Note

+

Useful information.

+
+``` + +> ⚠️ The `markdown-alert-*` classes are GitHub-specific, not standard Markdown. + +--- + +## Inline Code + +```md +Use `git status` to list files. +``` + +```html +

Use git status to list files.

+``` + +--- + +## Code Blocks + +### Markdown + +````md +```markdown +git status +git add +``` +```` + +### Parsed HTML + +```html +

+git status
+git add
+
+``` + +--- + +## Tables + +### Markdown + +```md +| Style | Syntax | +|------|--------| +| Bold | ** ** | +``` + +### Parsed HTML + +```html + + + + + + + + + + + + + +
StyleSyntax
Bold
+``` + +--- + +## Links + +### Markdown + +```md +[GitHub Pages](https://pages.github.com/) +``` + +### Parsed HTML + +```html +GitHub Pages +``` + +--- + +## Images + +### Markdown + +```md +![Alt text](image.png) +``` + +### Parsed HTML + +```html +Alt text +``` + +--- + +## Lists + +### Unordered List + +```md +- George Washington +- John Adams +``` + +```html +
    +
  • George Washington
  • +
  • John Adams
  • +
+``` + +--- + +### Ordered List + +```md +1. James Madison +2. James Monroe +``` + +```html +
    +
  1. James Madison
  2. +
  3. James Monroe
  4. +
+``` + +--- + +### Nested Lists + +```md +1. First item + - Nested item +``` + +```html +
    +
  1. + First item +
      +
    • Nested item
    • +
    +
  2. +
+``` + +--- + +## Task Lists (GitHub Flavored Markdown) + +```md +- [x] Done +- [ ] Pending +``` + +```html +
    +
  • + Done +
  • +
  • + Pending +
  • +
+``` + +--- + +## Mentions + +```md +@github/support +``` + +```html +@github/support +``` + +--- + +## Footnotes + +### Markdown + +```md +Here is a footnote[^1]. + +[^1]: My reference. +``` + +### Parsed HTML + +```html +

+ Here is a footnote + + 1 + . +

+ +
+
    +
  1. +

    My reference.

    +
  2. +
+
+``` + +--- + +## HTML Comments (Hidden Content) + +```md + +``` + +```html + +``` + +--- + +## Escaped Markdown Characters + +```md +\*not italic\* +``` + +```html +

*not italic*

+``` + +--- + +## Emoji + +```md +:+1: +``` + +```html +👍 +``` + +(GitHub replaces emoji with `` tags.) + +--- diff --git a/skills/markdown-to-html/references/basic-markdown.md b/skills/markdown-to-html/references/basic-markdown.md new file mode 100644 index 00000000..9181c3aa --- /dev/null +++ b/skills/markdown-to-html/references/basic-markdown.md @@ -0,0 +1,496 @@ +# Basic writing and formatting syntax + +Create sophisticated formatting for your prose and code on GitHub with simple syntax. + +## Headings + +To create a heading, add one to six # symbols before your heading text. The number of # you use will determine the hierarchy level and typeface size of the heading. + +```markdown +# A first-level heading +## A second-level heading +### A third-level heading +``` + +![Screenshot of rendered GitHub Markdown showing sample h1, h2, and h3 headers, which descend in type size and visual weight to show hierarchy level.](https://docs.github.com/assets/images/help/writing/headings-rendered.png) + +When you use two or more headings, GitHub automatically generates a table of contents that you can access by clicking the "Outline" menu icon within the file header. Each heading title is listed in the table of contents and you can click a title to navigate to the selected section. + +![Screenshot of a README file with the drop-down menu for the table of contents exposed. The table of contents icon is outlined in dark orange.](https://docs.github.comhttps://docs.github.com/assets/images/help/repository/headings-toc.png) + +## Styling text + +You can indicate emphasis with bold, italic, strikethrough, subscript, or superscript text in comment fields and `.md` files. + +| Style | Syntax | Keyboard shortcut | Example | Output | | +| ---------------------- | ------------------- | ------------------------------------------------------------------------------------- | ---------------------------------------- | -------------------------------------- | ------------------------------------------------- | +| Bold | `** **` or `__ __` | Command+B (Mac) or Ctrl+B (Windows/Linux) | `**This is bold text**` | **This is bold text** | | +| Italic | `* *` or `_ _`      | Command+I (Mac) or Ctrl+I (Windows/Linux) | `_This text is italicized_` | *This text is italicized* | | +| Strikethrough | `~~ ~~` or `~ ~` | None | `~~This was mistaken text~~` | ~~This was mistaken text~~ | | +| Bold and nested italic | `** **` and `_ _` | None | `**This text is _extremely_ important**` | **This text is *extremely* important** | | +| All bold and italic | `*** ***` | None | `***All this text is important***` | ***All this text is important*** | | +| Subscript | ` ` | None | `This is a subscript text` | This is a subscript text | | +| Superscript | ` ` | None | `This is a superscript text` | This is a superscript text | | +| Underline | ` ` | None | `This is an underlined text` | This is an underlined text | | + +## Quoting text + +You can quote text with a >. + +```markdown +Text that is not a quote + +> Text that is a quote +``` + +Quoted text is indented with a vertical line on the left and displayed using gray type. + +![Screenshot of rendered GitHub Markdown showing the difference between normal and quoted text.](https://docs.github.comhttps://docs.github.com/assets/images/help/writing/quoted-text-rendered.png) + +> \[!NOTE] +> When viewing a conversation, you can automatically quote text in a comment by highlighting the text, then typing R. You can quote an entire comment by clicking , then **Quote reply**. For more information about keyboard shortcuts, see [Keyboard shortcuts](https://docs.github.com/en/get-started/accessibility/keyboard-shortcuts). + +## Quoting code + +You can call out code or a command within a sentence with single backticks. The text within the backticks will not be formatted. You can also press the Command+E (Mac) or Ctrl+E (Windows/Linux) keyboard shortcut to insert the backticks for a code block within a line of Markdown. + +```markdown +Use `git status` to list all new or modified files that haven't yet been committed. +``` + +![Screenshot of rendered GitHub Markdown showing that characters surrounded by backticks are shown in a fixed-width typeface, highlighted in light gray.](https://docs.github.com/assets/images/help/writing/inline-code-rendered.png) + +To format code or text into its own distinct block, use triple backticks. + +````markdown +Some basic Git commands are: +``` +git status +git add +git commit +``` +```` + +![Screenshot of rendered GitHub Markdown showing a simple code block without syntax highlighting.](https://docs.github.com/assets/images/help/writing/code-block-rendered.png) + +For more information, see [Creating and highlighting code blocks](https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/creating-and-highlighting-code-blocks). + +If you are frequently editing code snippets and tables, you may benefit from enabling a fixed-width font in all comment fields on GitHub. For more information, see [About writing and formatting on GitHub](https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/about-writing-and-formatting-on-github#enabling-fixed-width-fonts-in-the-editor). + +## Supported color models + +In issues, pull requests, and discussions, you can call out colors within a sentence by using backticks. A supported color model within backticks will display a visualization of the color. + +```markdown +The background color is `#ffffff` for light mode and `#000000` for dark mode. +``` + +![Screenshot of rendered GitHub Markdown showing how HEX values within backticks create small circles of color, here white and then black.](https://docs.github.com/assets/images/help/writing/supported-color-models-rendered.png) + +Here are the currently supported color models. + +| Color | Syntax | Example | Output | +| ----- | --------------------------- | ----------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| HEX | \`#RRGGBB\` | \`#0969DA\` | ![Screenshot of rendered GitHub Markdown showing how HEX value #0969DA appears with a blue circle.](https://docs.github.com/assets/images/help/writing/supported-color-models-hex-rendered.png) | +| RGB | \`rgb(R,G,B)\` | \`rgb(9, 105, 218)\` | ![Screenshot of rendered GitHub Markdown showing how RGB value 9, 105, 218 appears with a blue circle.](https://docs.github.com/assets/images/help/writing/supported-color-models-rgb-rendered.png) | +| HSL | \`hsl(H,S,L)\` | \`hsl(212, 92%, 45%)\` | ![Screenshot of rendered GitHub Markdown showing how HSL value 212, 92%, 45% appears with a blue circle.](https://docs.github.com/assets/images/help/writing/supported-color-models-hsl-rendered.png) | + +> \[!NOTE] +> +> * A supported color model cannot have any leading or trailing spaces within the backticks. +> * The visualization of the color is only supported in issues, pull requests, and discussions. + +## Links + +You can create an inline link by wrapping link text in brackets `[ ]`, and then wrapping the URL in parentheses `( )`. You can also use the keyboard shortcut Command+K to create a link. When you have text selected, you can paste a URL from your clipboard to automatically create a link from the selection. + +You can also create a Markdown hyperlink by highlighting the text and using the keyboard shortcut Command+V. If you'd like to replace the text with the link, use the keyboard shortcut Command+Shift+V. + +`This site was built using [GitHub Pages](https://pages.github.com/).` + +![Screenshot of rendered GitHub Markdown showing how text within brackets, "GitHub Pages," appears as a blue hyperlink.](https://docs.github.com/assets/images/help/writing/link-rendered.png) + +> \[!NOTE] +> GitHub automatically creates links when valid URLs are written in a comment. For more information, see [Autolinked references and URLs](https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/autolinked-references-and-urls). + +## Section links + +You can link directly to any section that has a heading. To view the automatically generated anchor in a rendered file, hover over the section heading to expose the icon and click the icon to display the anchor in your browser. + +![Screenshot of a README for a repository. To the left of a section heading, a link icon is outlined in dark orange.](https://docs.github.com/assets/images/help/repository/readme-links.png) + +If you need to determine the anchor for a heading in a file you are editing, you can use the following basic rules: + +* Letters are converted to lower-case. +* Spaces are replaced by hyphens (`-`). Any other whitespace or punctuation characters are removed. +* Leading and trailing whitespace are removed. +* Markup formatting is removed, leaving only the contents (for example, `_italics_` becomes `italics`). +* If the automatically generated anchor for a heading is identical to an earlier anchor in the same document, a unique identifier is generated by appending a hyphen and an auto-incrementing integer. + +For more detailed information on the requirements of URI fragments, see [RFC 3986: Uniform Resource Identifier (URI): Generic Syntax, Section 3.5](https://www.rfc-editor.org/rfc/rfc3986#section-3.5). + +The code block below demonstrates the basic rules used to generate anchors from headings in rendered content. + +```markdown +# Example headings + +## Sample Section + +## This'll be a _Helpful_ Section About the Greek Letter Θ! +A heading containing characters not allowed in fragments, UTF-8 characters, two consecutive spaces between the first and second words, and formatting. + +## This heading is not unique in the file + +TEXT 1 + +## This heading is not unique in the file + +TEXT 2 + +# Links to the example headings above + +Link to the sample section: [Link Text](#sample-section). + +Link to the helpful section: [Link Text](#thisll-be-a-helpful-section-about-the-greek-letter-Θ). + +Link to the first non-unique section: [Link Text](#this-heading-is-not-unique-in-the-file). + +Link to the second non-unique section: [Link Text](#this-heading-is-not-unique-in-the-file-1). +``` + +> \[!NOTE] +> If you edit a heading, or if you change the order of headings with "identical" anchors, you will also need to update any links to those headings as the anchors will change. + +## Relative links + +You can define relative links and image paths in your rendered files to help readers navigate to other files in your repository. + +A relative link is a link that is relative to the current file. For example, if you have a README file in root of your repository, and you have another file in *docs/CONTRIBUTING.md*, the relative link to *CONTRIBUTING.md* in your README might look like this: + +```text +[Contribution guidelines for this project](docs/CONTRIBUTING.md) +``` + +GitHub will automatically transform your relative link or image path based on whatever branch you're currently on, so that the link or path always works. The path of the link will be relative to the current file. Links starting with `/` will be relative to the repository root. You can use all relative link operands, such as `./` and `../`. + +Your link text should be on a single line. The example below will not work. + +```markdown +[Contribution +guidelines for this project](docs/CONTRIBUTING.md) +``` + +Relative links are easier for users who clone your repository. Absolute links may not work in clones of your repository - we recommend using relative links to refer to other files within your repository. + +## Custom anchors + +You can use standard HTML anchor tags (``) to create navigation anchor points for any location in the document. To avoid ambiguous references, use a unique naming scheme for anchor tags, such as adding a prefix to the `name` attribute value. + +> \[!NOTE] +> Custom anchors will not be included in the document outline/Table of Contents. + +You can link to a custom anchor using the value of the `name` attribute you gave the anchor. The syntax is exactly the same as when you link to an anchor that is automatically generated for a heading. + +For example: + +```markdown +# Section Heading + +Some body text of this section. + + +Some text I want to provide a direct link to, but which doesn't have its own heading. + +(… more content…) + +[A link to that custom anchor](#my-custom-anchor-point) +``` + +> \[!TIP] +> Custom anchors are not considered by the automatic naming and numbering behavior of automatic heading links. + +## Line breaks + +If you're writing in issues, pull requests, or discussions in a repository, GitHub will render a line break automatically: + +```markdown +This example +Will span two lines +``` + +However, if you are writing in an .md file, the example above would render on one line without a line break. To create a line break in an .md file, you will need to include one of the following: + +* Include two spaces at the end of the first line. +
+  This example  
+  Will span two lines
+  
+ +* Include a backslash at the end of the first line. + + ```markdown + This example\ + Will span two lines + ``` + +* Include an HTML single line break tag at the end of the first line. + + ```markdown + This example
+ Will span two lines + ``` + +If you leave a blank line between two lines, both .md files and Markdown in issues, pull requests, and discussions will render the two lines separated by the blank line: + +```markdown +This example + +Will have a blank line separating both lines +``` + +## Images + +You can display an image by adding ! and wrapping the alt text in `[ ]`. Alt text is a short text equivalent of the information in the image. Then, wrap the link for the image in parentheses `()`. + +`![Screenshot of a comment on a GitHub issue showing an image, added in the Markdown, of an Octocat smiling and raising a tentacle.](https://docs.github.comhttps://myoctocat.com/assets/images/base-octocat.svg)` + +![Screenshot of a comment on a GitHub issue showing an image, added in the Markdown, of an Octocat smiling and raising a tentacle.](https://docs.github.com/assets/images/help/writing/image-rendered.png) + +GitHub supports embedding images into your issues, pull requests, discussions, comments and `.md` files. You can display an image from your repository, add a link to an online image, or upload an image. For more information, see [Uploading assets](#uploading-assets). + +> \[!NOTE] +> When you want to display an image that is in your repository, use relative links instead of absolute links. + +Here are some examples for using relative links to display an image. + +| Context | Relative Link | +| ----------------------------------------------------------- | ---------------------------------------------------------------------- | +| In a `.md` file on the same branch | `/assets/images/electrocat.png` | +| In a `.md` file on another branch | `/../main/assets/images/electrocat.png` | +| In issues, pull requests and comments of the repository | `../blob/main/assets/images/electrocat.png?raw=true` | +| In a `.md` file in another repository | `/../../../../github/docs/blob/main/assets/images/electrocat.png` | +| In issues, pull requests and comments of another repository | `../../../github/docs/blob/main/assets/images/electrocat.png?raw=true` | + +> \[!NOTE] +> The last two relative links in the table above will work for images in a private repository only if the viewer has at least read access to the private repository that contains these images. + +For more information, see [Relative Links](#relative-links). + +### The Picture element + +The `` HTML element is supported. + +## Lists + +You can make an unordered list by preceding one or more lines of text with -, \*, or +. + +```markdown +- George Washington +* John Adams ++ Thomas Jefferson +``` + +![Screenshot of rendered GitHub Markdown showing a bulleted list of the names of the first three American presidents.](https://docs.github.com/assets/images/help/writing/unordered-list-rendered.png) + +To order your list, precede each line with a number. + +```markdown +1. James Madison +2. James Monroe +3. John Quincy Adams +``` + +![Screenshot of rendered GitHub Markdown showing a numbered list of the names of the fourth, fifth, and sixth American presidents.](https://docs.github.com/assets/images/help/writing/ordered-list-rendered.png) + +### Nested Lists + +You can create a nested list by indenting one or more list items below another item. + +To create a nested list using the web editor on GitHub or a text editor that uses a monospaced font, like [Visual Studio Code](https://code.visualstudio.com/), you can align your list visually. Type space characters in front of your nested list item until the list marker character (- or \*) lies directly below the first character of the text in the item above it. + +```markdown +1. First list item + - First nested list item + - Second nested list item +``` + +> \[!NOTE] +> In the web-based editor, you can indent or dedent one or more lines of text by first highlighting the desired lines and then using Tab or Shift+Tab respectively. + +![Screenshot of Markdown in Visual Studio Code showing indentation of nested numbered lines and bullets.](https://docs.github.com/assets/images/help/writing/nested-list-alignment.png) + +![Screenshot of rendered GitHub Markdown showing a numbered item followed by nested bullets at two different levels of nesting.](https://docs.github.com/assets/images/help/writing/nested-list-example-1.png) + +To create a nested list in the comment editor on GitHub, which doesn't use a monospaced font, you can look at the list item immediately above the nested list and count the number of characters that appear before the content of the item. Then type that number of space characters in front of the nested list item. + +In this example, you could add a nested list item under the list item `100. First list item` by indenting the nested list item a minimum of five spaces, since there are five characters (`100. `) before `First list item`. + +```markdown +100. First list item + - First nested list item +``` + +![Screenshot of rendered GitHub Markdown showing a numbered item prefaced by the number 100 followed by a bulleted item nested one level.](https://docs.github.com/assets/images/help/writing/nested-list-example-3.png) + +You can create multiple levels of nested lists using the same method. For example, because the first nested list item has seven characters (`␣␣␣␣␣-␣`) before the nested list content `First nested list item`, you would need to indent the second nested list item by at least two more characters (nine spaces minimum). + +```markdown +100. First list item + - First nested list item + - Second nested list item +``` + +![Screenshot of rendered GitHub Markdown showing a numbered item prefaced by the number 100 followed by bullets at two different levels of nesting.](https://docs.github.com/assets/images/help/writing/nested-list-example-2.png) + +For more examples, see the [GitHub Flavored Markdown Spec](https://github.github.com/gfm/#example-265). + +## Task lists + +To create a task list, preface list items with a hyphen and space followed by `[ ]`. To mark a task as complete, use `[x]`. + +```markdown +- [x] #739 +- [ ] https://github.com/octo-org/octo-repo/issues/740 +- [ ] Add delight to the experience when all tasks are complete :tada: +``` + +![Screenshot showing the rendered version of the markdown. The references to issues are rendered as issue titles.](https://docs.github.com/assets/images/help/writing/task-list-rendered-simple.png) + +If a task list item description begins with a parenthesis, you'll need to escape it with \\: + +`- [ ] \(Optional) Open a followup issue` + +For more information, see [About tasklists](https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/about-task-lists). + +## Mentioning people and teams + +You can mention a person or [team](https://docs.github.com/en/organizations/organizing-members-into-teams) on GitHub by typing @ plus their username or team name. This will trigger a notification and bring their attention to the conversation. People will also receive a notification if you edit a comment to mention their username or team name. For more information about notifications, see [About notifications](https://docs.github.com/en/account-and-profile/managing-subscriptions-and-notifications-on-github/setting-up-notifications/about-notifications). + +> \[!NOTE] +> A person will only be notified about a mention if the person has read access to the repository and, if the repository is owned by an organization, the person is a member of the organization. + +`@github/support What do you think about these updates?` + +![Screenshot of rendered GitHub Markdown showing how the team mention "@github/support" renders as bold, clickable text.](https://docs.github.com/assets/images/help/writing/mention-rendered.png) + +When you mention a parent team, members of its child teams also receive notifications, simplifying communication with multiple groups of people. For more information, see [About organization teams](https://docs.github.com/en/organizations/organizing-members-into-teams/about-teams). + +Typing an @ symbol will bring up a list of people or teams on a project. The list filters as you type, so once you find the name of the person or team you are looking for, you can use the arrow keys to select it and press either tab or enter to complete the name. For teams, enter the @organization/team-name and all members of that team will get subscribed to the conversation. + +The autocomplete results are restricted to repository collaborators and any other participants on the thread. + +## Referencing issues and pull requests + +You can bring up a list of suggested issues and pull requests within the repository by typing #. Type the issue or pull request number or title to filter the list, and then press either tab or enter to complete the highlighted result. + +For more information, see [Autolinked references and URLs](https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/autolinked-references-and-urls). + +## Referencing external resources + +If custom autolink references are configured for a repository, then references to external resources, like a JIRA issue or Zendesk ticket, convert into shortened links. To know which autolinks are available in your repository, contact someone with admin permissions to the repository. For more information, see [Configuring autolinks to reference external resources](https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/managing-repository-settings/configuring-autolinks-to-reference-external-resources). + +## Uploading assets + +You can upload assets like images by dragging and dropping, selecting from a file browser, or pasting. You can upload assets to issues, pull requests, comments, and `.md` files in your repository. + +## Using emojis + +You can add emoji to your writing by typing `:EMOJICODE:`, a colon followed by the name of the emoji. + +`@octocat :+1: This PR looks great - it's ready to merge! :shipit:` + +![Screenshot of rendered GitHub Markdown showing how emoji codes for +1 and shipit render visually as emoji.](https://docs.github.com/assets/images/help/writing/emoji-rendered.png) + +Typing : will bring up a list of suggested emoji. The list will filter as you type, so once you find the emoji you're looking for, press **Tab** or **Enter** to complete the highlighted result. + +For a full list of available emoji and codes, see [the Emoji-Cheat-Sheet](https://github.com/ikatyang/emoji-cheat-sheet/blob/github-actions-auto-update/README.md). + +## Paragraphs + +You can create a new paragraph by leaving a blank line between lines of text. + +## Footnotes + +You can add footnotes to your content by using this bracket syntax: + +```text +Here is a simple footnote[^1]. + +A footnote can also have multiple lines[^2]. + +[^1]: My reference. +[^2]: To add line breaks within a footnote, add 2 spaces to the end of a line. +This is a second line. +``` + +The footnote will render like this: + +![Screenshot of rendered Markdown showing superscript numbers used to indicate footnotes, along with optional line breaks inside a note.](https://docs.github.com/assets/images/help/writing/footnote-rendered.png) + +> \[!NOTE] +> The position of a footnote in your Markdown does not influence where the footnote will be rendered. You can write a footnote right after your reference to the footnote, and the footnote will still render at the bottom of the Markdown. Footnotes are not supported in wikis. + +## Alerts + +**Alerts**, also sometimes known as **callouts** or **admonitions**, are a Markdown extension based on the blockquote syntax that you can use to emphasize critical information. On GitHub, they are displayed with distinctive colors and icons to indicate the significance of the content. + +Use alerts only when they are crucial for user success and limit them to one or two per article to prevent overloading the reader. Additionally, you should avoid placing alerts consecutively. Alerts cannot be nested within other elements. + +To add an alert, use a special blockquote line specifying the alert type, followed by the alert information in a standard blockquote. Five types of alerts are available: + +```markdown +> [!NOTE] +> Useful information that users should know, even when skimming content. + +> [!TIP] +> Helpful advice for doing things better or more easily. + +> [!IMPORTANT] +> Key information users need to know to achieve their goal. + +> [!WARNING] +> Urgent info that needs immediate user attention to avoid problems. + +> [!CAUTION] +> Advises about risks or negative outcomes of certain actions. +``` + +Here are the rendered alerts: + +![Screenshot of rendered Markdown alerts showing how Note, Tip, Important, Warning, and Caution render with different colored text and icons.](https://docs.github.com/assets/images/help/writing/alerts-rendered.png) + +## Hiding content with comments + +You can tell GitHub to hide content from the rendered Markdown by placing the content in an HTML comment. + +```text + +``` + +## Ignoring Markdown formatting + +You can tell GitHub to ignore (or escape) Markdown formatting by using \\ before the Markdown character. + +`Let's rename \*our-new-project\* to \*our-old-project\*.` + +![Screenshot of rendered GitHub Markdown showing how backslashes prevent the conversion of asterisks to italics.](https://docs.github.com/assets/images/help/writing/escaped-character-rendered.png) + +For more information on backslashes, see Daring Fireball's [Markdown Syntax](https://daringfireball.net/projects/markdown/syntax#backslash). + +> \[!NOTE] +> The Markdown formatting will not be ignored in the title of an issue or a pull request. + +## Disabling Markdown rendering + +When viewing a Markdown file, you can click **Code** at the top of the file to disable Markdown rendering and view the file's source instead. + +![Screenshot of a Markdown file in a repository showing options for interacting with the file. A button, labeled "Code", is outlined in dark orange.](https://docs.github.com/assets/images/help/writing/display-markdown-as-source-global-nav-update.png) + +Disabling Markdown rendering enables you to use source view features, such as line linking, which is not possible when viewing rendered Markdown files. + +## Further reading + +*[GitHub Flavored Markdown Spec](https://github.github.com/gfm/) +*[About writing and formatting on GitHub](https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/about-writing-and-formatting-on-github) +*[Working with advanced formatting](https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting) +*[Quickstart for writing on GitHub](https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/quickstart-for-writing-on-github) \ No newline at end of file diff --git a/skills/markdown-to-html/references/code-blocks-to-html.md b/skills/markdown-to-html/references/code-blocks-to-html.md new file mode 100644 index 00000000..9e2901e9 --- /dev/null +++ b/skills/markdown-to-html/references/code-blocks-to-html.md @@ -0,0 +1,165 @@ +# Code Blocks to HTML + +## Fenced Code Blocks (No Language) + +### Markdown + +``` +function test() { + console.log("notice the blank line before this function?"); +} +``` + +### Parsed HTML + +```html +

+function test() {
+  console.log("notice the blank line before this function?");
+}
+
+``` + +--- + +## GitHub Tip Callout + +### Markdown + +```md +> [!TIP] +> To preserve your formatting within a list, make sure to indent non-fenced code blocks by eight spaces. +``` + +### Parsed HTML (GitHub-specific) + +```html +
+

Tip

+

To preserve your formatting within a list, make sure to indent non-fenced code blocks by eight spaces.

+
+``` + +--- + +## Showing Backticks Inside Code Blocks + +### Markdown + +`````md + ```` + ``` + Look! You can see my backticks. + ``` + ```` +````` + +### Parsed HTML + +```html +

+    ```
+
+    Look! You can see my backticks.
+
+    ```
+    
+``` + +## Syntax Highlighting (Language Identifier) + +### Markdown + +```ruby +require 'redcarpet' +markdown = Redcarpet.new("Hello World!") +puts markdown.to_html +``` + +### Parsed HTML + +```html +

+require 'redcarpet'
+markdown = Redcarpet.new("Hello World!")
+puts markdown.to_html
+
+``` + +> The `language-ruby` class is consumed by GitHub’s syntax highlighter (Linguist + grammar). + +### Summary: Syntax-Highlighting Rules (HTML-Level) + +| Markdown fence | Parsed `` tag | +| -------------- | ------------------------------ | +| ```js | `` | +| ```html | `` | +| ```md | `` | +| ``` (no lang) | `` | + +--- + +## HTML Comments (Ignored by Renderer) + +```md + +``` + +```html + +``` + +--- + +## Links + +```md +[About writing and formatting on GitHub](https://docs.github.com/...) +``` + +```html +About writing and formatting on GitHub +``` + +--- + +## Lists + +```md +* [GitHub Flavored Markdown Spec](https://github.github.com/gfm/) +``` + +```html + +``` + +--- + +## Diagrams (Conceptual Parsing) + +### Markdown + +````md +```mermaid +graph TD + A --> B +``` +```` + +### Parsed HTML + +```html +

+graph TD
+  A --> B
+
+``` + +## Closing Notes + +* No `language-*` class appears here because **no language identifier** was provided. +* The inner triple backticks are preserved **as literal text** inside ``. diff --git a/skills/markdown-to-html/references/code-blocks.md b/skills/markdown-to-html/references/code-blocks.md new file mode 100644 index 00000000..729c8874 --- /dev/null +++ b/skills/markdown-to-html/references/code-blocks.md @@ -0,0 +1,70 @@ +# Creating and highlighting code blocks + +Share samples of code with fenced code blocks and enabling syntax highlighting. + +## Fenced code blocks + +You can create fenced code blocks by placing triple backticks \`\`\` before and after the code block. We recommend placing a blank line before and after code blocks to make the raw formatting easier to read. + +````text +``` +function test() { + console.log("notice the blank line before this function?"); +} +``` +```` + +![Screenshot of rendered GitHub Markdown showing the use of triple backticks to create code blocks. The block begins with "function test() {."](https://docs.github.com/assets/images/help/writing/fenced-code-block-rendered.png) + +> \[!TIP] +> To preserve your formatting within a list, make sure to indent non-fenced code blocks by eight spaces. + +To display triple backticks in a fenced code block, wrap them inside quadruple backticks. + +`````text +```` +``` +Look! You can see my backticks. +``` +```` +````` + +![Screenshot of rendered Markdown showing that when you write triple backticks between quadruple backticks they are visible in the rendered content.](https://docs.github.com/assets/images/help/writing/fenced-code-show-backticks-rendered.png) + +If you are frequently editing code snippets and tables, you may benefit from enabling a fixed-width font in all comment fields on GitHub. For more information, see [About writing and formatting on GitHub](https://docs.github.comn/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/about-writing-and-formatting-on-github#enabling-fixed-width-fonts-in-the-editor). + +## Syntax highlighting + + + +You can add an optional language identifier to enable syntax highlighting in your fenced code block. + +Syntax highlighting changes the color and style of source code to make it easier to read. + +For example, to syntax highlight Ruby code: + +````text +```ruby +require 'redcarpet' +markdown = Redcarpet.new("Hello World!") +puts markdown.to_html +``` +```` + +This will display the code block with syntax highlighting: + +![Screenshot of three lines of Ruby code as displayed on GitHub. Elements of the code display in purple, blue, and red type for scannability.](https://docs.github.com/assets/images/help/writing/code-block-syntax-highlighting-rendered.png) + +> \[!TIP] +> When you create a fenced code block that you also want to have syntax highlighting on a GitHub Pages site, use lower-case language identifiers. For more information, see [About GitHub Pages and Jekyll](https://docs.github.comn/pages/setting-up-a-github-pages-site-with-jekyll/about-github-pages-and-jekyll#syntax-highlighting). + +We use [Linguist](https://github.com/github-linguist/linguist) to perform language detection and to select [third-party grammars](https://github.com/github-linguist/linguist/blob/main/vendor/README.md) for syntax highlighting. You can find out which keywords are valid in [the languages YAML file](https://github.com/github-linguist/linguist/blob/main/lib/linguist/languages.yml). + +## Creating diagrams + +You can also use code blocks to create diagrams in Markdown. GitHub supports Mermaid, GeoJSON, TopoJSON, and ASCII STL syntax. For more information, see [Creating diagrams](https://docs.github.comn/get-started/writing-on-github/working-with-advanced-formatting/creating-diagrams). + +## Further reading + +* [GitHub Flavored Markdown Spec](https://github.github.com/gfm/) +* [Basic writing and formatting syntax](https://docs.github.comn/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax) \ No newline at end of file diff --git a/skills/markdown-to-html/references/collapsed-sections-to-html.md b/skills/markdown-to-html/references/collapsed-sections-to-html.md new file mode 100644 index 00000000..2689c6bb --- /dev/null +++ b/skills/markdown-to-html/references/collapsed-sections-to-html.md @@ -0,0 +1,136 @@ +# Collapsed Sections to HTML + +## `
` Block (Raw HTML in Markdown) + +### Markdown + +````md +
+ +Tips for collapsed sections + +### You can add a header + +You can add text within a collapsed section. + +You can add an image or a code block, too. + + ```ruby + puts "Hello World" + ``` + +
+```` + +--- + +### Parsed HTML + +```html +
+ Tips for collapsed sections + +

You can add a header

+ +

You can add text within a collapsed section.

+ +

You can add an image or a code block, too.

+ +

+puts "Hello World"
+
+
+``` + +#### Notes: + +* Markdown **inside `
`** is still parsed normally. +* Syntax highlighting is preserved via `class="language-ruby"`. + +--- + +## Open by Default (`open` attribute) + +### Markdown + +````md +
+ +Tips for collapsed sections + +### You can add a header + +You can add text within a collapsed section. + +You can add an image or a code block, too. + + ```ruby + puts "Hello World" + ``` + +
+```` + +### Parsed HTML + +```html +
+ Tips for collapsed sections + +

You can add a header

+ +

You can add text within a collapsed section.

+ +

You can add an image or a code block, too.

+ +

+puts "Hello World"
+
+
+``` + +## Key Rules + +* `
` and `` are **raw HTML**, not Markdown syntax +* Markdown inside `
` **is still parsed** +* Syntax highlighting works normally inside collapsed sections +* Use `` as the **clickable label** + +## Paragraphs with Inline HTML & SVG + +### Markdown + +```md +You can streamline your Markdown by creating a collapsed section with the `
` tag. +``` + +### Parsed HTML + +```html +

+ You can streamline your Markdown by creating a collapsed section with the <details> tag. +

+``` + +--- + +### Markdown (inline SVG preserved) + +```md +Any Markdown within the `
` block will be collapsed until the reader clicks to expand the details. +``` + +### Parsed HTML + +```html +

+ Any Markdown within the <details> block will be collapsed until the reader clicks + + + + to expand the details. +

+``` diff --git a/skills/markdown-to-html/references/collapsed-sections.md b/skills/markdown-to-html/references/collapsed-sections.md new file mode 100644 index 00000000..b2caf30a --- /dev/null +++ b/skills/markdown-to-html/references/collapsed-sections.md @@ -0,0 +1,48 @@ +# Organizing information with collapsed sections + +You can streamline your Markdown by creating a collapsed section with the `
` tag. + +## Creating a collapsed section + +You can temporarily obscure sections of your Markdown by creating a collapsed section that the reader can choose to expand. For example, when you want to include technical details in an issue comment that may not be relevant or interesting to every reader, you can put those details in a collapsed section. + +Any Markdown within the `
` block will be collapsed until the reader clicks to expand the details. + +Within the `
` block, use the `` tag to let readers know what is inside. The label appears to the right of . + +````markdown +
+ +Tips for collapsed sections + +### You can add a header + +You can add text within a collapsed section. + +You can add an image or a code block, too. + +```ruby + puts "Hello World" +``` + +
+```` + +The Markdown inside the `` label will be collapsed by default: + +![Screenshot of the Markdown above on this page as rendered on GitHub, showing a right-facing arrow and the header "Tips for collapsed sections."](https://docs.github.com/assets/images/help/writing/collapsed-section-view.png) + +After a reader clicks , the details are expanded: + +![Screenshot of the Markdown above on this page as rendered on GitHub. The collapsed section contains headers, text, images, and code blocks.](https://docs.github.com/assets/images/help/writing/open-collapsed-section.png) + +Optionally, to make the section display as open by default, add the `open` attribute to the `
` tag: + +```html +
+``` + +## Further reading + +* [GitHub Flavored Markdown Spec](https://github.github.com/gfm/) +* [Basic writing and formatting syntax](https://docs.github.comn/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax) \ No newline at end of file diff --git a/skills/markdown-to-html/references/gomarkdown.md b/skills/markdown-to-html/references/gomarkdown.md new file mode 100644 index 00000000..21abf824 --- /dev/null +++ b/skills/markdown-to-html/references/gomarkdown.md @@ -0,0 +1,253 @@ +# gomarkdown/markdown Reference + +Go library for parsing Markdown and rendering HTML. Fast, extensible, and thread-safe. + +## Installation + +```bash +# Add to your Go project +go get github.com/gomarkdown/markdown + +# Install CLI tool +go install github.com/gomarkdown/mdtohtml@latest +``` + +## Basic Usage + +### Simple Conversion + +```go +package main + +import ( + "fmt" + "github.com/gomarkdown/markdown" +) + +func main() { + md := []byte("# Hello World\n\nThis is **bold** text.") + html := markdown.ToHTML(md, nil, nil) + fmt.Println(string(html)) +} +``` + +### Using CLI Tool + +```bash +# Convert file to HTML +mdtohtml input.md output.html + +# Output to stdout +mdtohtml input.md +``` + +## Parser Configuration + +### Common Extensions + +```go +import ( + "github.com/gomarkdown/markdown" + "github.com/gomarkdown/markdown/parser" +) + +// Create parser with extensions +extensions := parser.CommonExtensions | parser.AutoHeadingIDs +p := parser.NewWithExtensions(extensions) + +// Parse markdown +doc := p.Parse(md) +``` + +### Available Parser Extensions + +| Extension | Description | +|-----------|-------------| +| `parser.CommonExtensions` | Tables, fenced code, autolinks, strikethrough | +| `parser.Tables` | Pipe tables support | +| `parser.FencedCode` | Fenced code blocks with language | +| `parser.Autolink` | Auto-detect URLs | +| `parser.Strikethrough` | ~~strikethrough~~ text | +| `parser.SpaceHeadings` | Require space after # in headings | +| `parser.HeadingIDs` | Custom heading IDs {#id} | +| `parser.AutoHeadingIDs` | Auto-generate heading IDs | +| `parser.Footnotes` | Footnote support | +| `parser.NoEmptyLineBeforeBlock` | No blank line required before blocks | +| `parser.HardLineBreak` | Newlines become `
` | +| `parser.MathJax` | MathJax support | +| `parser.SuperSubscript` | Super^script^ and sub~script~ | +| `parser.Mmark` | Mmark syntax support | + +## HTML Renderer Configuration + +### Common Flags + +```go +import ( + "github.com/gomarkdown/markdown" + "github.com/gomarkdown/markdown/html" + "github.com/gomarkdown/markdown/parser" +) + +// Parser +p := parser.NewWithExtensions(parser.CommonExtensions) + +// Renderer +htmlFlags := html.CommonFlags | html.HrefTargetBlank +opts := html.RendererOptions{ + Flags: htmlFlags, + Title: "My Document", + CSS: "style.css", +} +renderer := html.NewRenderer(opts) + +// Convert +html := markdown.ToHTML(md, p, renderer) +``` + +### Available HTML Flags + +| Flag | Description | +|------|-------------| +| `html.CommonFlags` | Common sensible defaults | +| `html.HrefTargetBlank` | Add `target="_blank"` to links | +| `html.CompletePage` | Generate complete HTML document | +| `html.UseXHTML` | Use XHTML output | +| `html.FootnoteReturnLinks` | Add return links in footnotes | +| `html.FootnoteNoHRTag` | No `
` before footnotes | +| `html.Smartypants` | Smart punctuation | +| `html.SmartypantsFractions` | Smart fractions (1/2 → ½) | +| `html.SmartypantsDashes` | Smart dashes (-- → –) | +| `html.SmartypantsLatexDashes` | LaTeX-style dashes | + +### Renderer Options + +```go +opts := html.RendererOptions{ + Flags: htmlFlags, + Title: "Document Title", + CSS: "path/to/style.css", + Icon: "favicon.ico", + Head: []byte(""), + RenderNodeHook: customRenderHook, +} +``` + +## Complete Example + +```go +package main + +import ( + "os" + "github.com/gomarkdown/markdown" + "github.com/gomarkdown/markdown/html" + "github.com/gomarkdown/markdown/parser" +) + +func mdToHTML(md []byte) []byte { + // Parser with extensions + extensions := parser.CommonExtensions | + parser.AutoHeadingIDs | + parser.NoEmptyLineBeforeBlock + p := parser.NewWithExtensions(extensions) + doc := p.Parse(md) + + // HTML renderer with options + htmlFlags := html.CommonFlags | html.HrefTargetBlank + opts := html.RendererOptions{Flags: htmlFlags} + renderer := html.NewRenderer(opts) + + return markdown.Render(doc, renderer) +} + +func main() { + md, _ := os.ReadFile("input.md") + html := mdToHTML(md) + os.WriteFile("output.html", html, 0644) +} +``` + +## Security: Sanitizing Output + +**Important:** gomarkdown does not sanitize HTML output. Use Bluemonday for untrusted input: + +```go +import ( + "github.com/microcosm-cc/bluemonday" + "github.com/gomarkdown/markdown" +) + +// Convert markdown to potentially unsafe HTML +unsafeHTML := markdown.ToHTML(md, nil, nil) + +// Sanitize using Bluemonday +p := bluemonday.UGCPolicy() +safeHTML := p.SanitizeBytes(unsafeHTML) +``` + +### Bluemonday Policies + +| Policy | Description | +|--------|-------------| +| `UGCPolicy()` | User-generated content (most common) | +| `StrictPolicy()` | Strip all HTML | +| `StripTagsPolicy()` | Strip tags, keep text | +| `NewPolicy()` | Build custom policy | + +## Working with AST + +### Accessing the AST + +```go +import ( + "github.com/gomarkdown/markdown/ast" + "github.com/gomarkdown/markdown/parser" +) + +p := parser.NewWithExtensions(parser.CommonExtensions) +doc := p.Parse(md) + +// Walk the AST +ast.WalkFunc(doc, func(node ast.Node, entering bool) ast.WalkStatus { + if heading, ok := node.(*ast.Heading); ok && entering { + fmt.Printf("Found heading level %d\n", heading.Level) + } + return ast.GoToNext +}) +``` + +### Custom Renderer + +```go +type MyRenderer struct { + *html.Renderer +} + +func (r *MyRenderer) RenderNode(w io.Writer, node ast.Node, entering bool) ast.WalkStatus { + // Custom rendering logic + if heading, ok := node.(*ast.Heading); ok && entering { + fmt.Fprintf(w, "", heading.Level) + return ast.GoToNext + } + return r.Renderer.RenderNode(w, node, entering) +} +``` + +## Handling Newlines + +Windows and Mac newlines need normalization: + +```go +// Normalize newlines before parsing +normalized := parser.NormalizeNewlines(input) +html := markdown.ToHTML(normalized, nil, nil) +``` + +## Resources + +- [Package Documentation](https://pkg.go.dev/github.com/gomarkdown/markdown) +- [Advanced Processing Guide](https://blog.kowalczyk.info/article/cxn3/advanced-markdown-processing-in-go.html) +- [GitHub Repository](https://github.com/gomarkdown/markdown) +- [CLI Tool](https://github.com/gomarkdown/mdtohtml) +- [Bluemonday Sanitizer](https://github.com/microcosm-cc/bluemonday) diff --git a/skills/markdown-to-html/references/hugo.md b/skills/markdown-to-html/references/hugo.md new file mode 100644 index 00000000..07904508 --- /dev/null +++ b/skills/markdown-to-html/references/hugo.md @@ -0,0 +1,394 @@ +# Hugo Reference + +Hugo is the world's fastest static site generator. It builds sites in milliseconds and supports advanced content management features. + +## Installation + +### Windows + +```powershell +# Using Chocolatey +choco install hugo-extended + +# Using Scoop +scoop install hugo-extended + +# Using Winget +winget install Hugo.Hugo.Extended +``` + +### macOS + +```bash +# Using Homebrew +brew install hugo +``` + +### Linux + +```bash +# Debian/Ubuntu (snap) +snap install hugo --channel=extended + +# Using package manager (may not be latest) +sudo apt-get install hugo + +# Or download from https://gohugo.io/installation/ +``` + +## Quick Start + +### Create New Site + +```bash +# Create site +hugo new site mysite +cd mysite + +# Initialize git and add theme +git init +git submodule add https://github.com/theNewDynamic/gohugo-theme-ananke themes/ananke +echo "theme = 'ananke'" >> hugo.toml + +# Create first post +hugo new content posts/my-first-post.md + +# Start development server +hugo server -D +``` + +### Directory Structure + +``` +mysite/ +├── archetypes/ # Content templates +│ └── default.md +├── assets/ # Assets to process (SCSS, JS) +├── content/ # Markdown content +│ └── posts/ +├── data/ # Data files (YAML, JSON, TOML) +├── i18n/ # Internationalization +├── layouts/ # Templates +│ ├── _default/ +│ ├── partials/ +│ └── shortcodes/ +├── static/ # Static files (copied as-is) +├── themes/ # Themes +└── hugo.toml # Configuration +``` + +## CLI Commands + +| Command | Description | +|---------|-------------| +| `hugo new site ` | Create new site | +| `hugo new content ` | Create content file | +| `hugo` | Build to `public/` | +| `hugo server` | Start dev server | +| `hugo mod init` | Initialize Hugo Modules | +| `hugo mod tidy` | Clean up modules | + +### Build Options + +```bash +# Basic build +hugo + +# Build with minification +hugo --minify + +# Build with drafts +hugo -D + +# Build for specific environment +hugo --environment production + +# Build to custom directory +hugo -d ./dist + +# Verbose output +hugo -v +``` + +### Server Options + +```bash +# Start with drafts +hugo server -D + +# Bind to all interfaces +hugo server --bind 0.0.0.0 + +# Custom port +hugo server --port 8080 + +# Disable live reload +hugo server --disableLiveReload + +# Navigate to changed content +hugo server --navigateToChanged +``` + +## Configuration (hugo.toml) + +```toml +# Basic settings +baseURL = 'https://example.com/' +languageCode = 'en-us' +title = 'My Hugo Site' +theme = 'ananke' + +# Build settings +[build] + writeStats = true + +# Markdown configuration +[markup] + [markup.goldmark] + [markup.goldmark.extensions] + definitionList = true + footnote = true + linkify = true + strikethrough = true + table = true + taskList = true + [markup.goldmark.parser] + autoHeadingID = true + autoHeadingIDType = 'github' + [markup.goldmark.renderer] + unsafe = false + [markup.highlight] + style = 'monokai' + lineNos = true + +# Taxonomies +[taxonomies] + category = 'categories' + tag = 'tags' + author = 'authors' + +# Menus +[menus] + [[menus.main]] + name = 'Home' + pageRef = '/' + weight = 10 + [[menus.main]] + name = 'Posts' + pageRef = '/posts' + weight = 20 + +# Parameters +[params] + description = 'My awesome site' + author = 'John Doe' +``` + +## Front Matter + +Hugo supports TOML, YAML, and JSON front matter: + +### TOML (default) + +```markdown ++++ +title = 'My First Post' +date = 2025-01-28T12:00:00-05:00 +draft = false +tags = ['hugo', 'tutorial'] +categories = ['blog'] +author = 'John Doe' ++++ + +Content here... +``` + +### YAML + +```markdown +--- +title: "My First Post" +date: 2025-01-28T12:00:00-05:00 +draft: false +tags: ["hugo", "tutorial"] +--- + +Content here... +``` + +## Templates + +### Base Template (_default/baseof.html) + +```html + + + + {{ .Title }} | {{ .Site.Title }} + {{ partial "head.html" . }} + + + {{ partial "header.html" . }} +
+ {{ block "main" . }}{{ end }} +
+ {{ partial "footer.html" . }} + + +``` + +### Single Page (_default/single.html) + +```html +{{ define "main" }} +
+

{{ .Title }}

+ + {{ .Content }} +
+{{ end }} +``` + +### List Page (_default/list.html) + +```html +{{ define "main" }} +

{{ .Title }}

+{{ range .Pages }} + +{{ end }} +{{ end }} +``` + +## Shortcodes + +### Built-in Shortcodes + +```markdown +{{< figure src="/images/photo.jpg" title="My Photo" >}} + +{{< youtube dQw4w9WgXcQ >}} + +{{< gist user 12345 >}} + +{{< highlight go >}} +fmt.Println("Hello") +{{< /highlight >}} +``` + +### Custom Shortcode (layouts/shortcodes/alert.html) + +```html +
+ {{ .Inner | markdownify }} +
+``` + +Usage: + +```markdown +{{< alert type="warning" >}} +**Warning:** This is important! +{{< /alert >}} +``` + +## Content Organization + +### Page Bundles + +``` +content/ +├── posts/ +│ └── my-post/ # Page bundle +│ ├── index.md # Content +│ └── image.jpg # Resources +└── _index.md # Section page +``` + +### Accessing Resources + +```html +{{ $image := .Resources.GetMatch "image.jpg" }} +{{ with $image }} + ... +{{ end }} +``` + +## Hugo Pipes (Asset Processing) + +### SCSS Compilation + +```html +{{ $styles := resources.Get "scss/main.scss" | toCSS | minify }} + +``` + +### JavaScript Bundling + +```html +{{ $js := resources.Get "js/main.js" | js.Build | minify }} + +``` + +## Taxonomies + +### Configure + +```toml +[taxonomies] + tag = 'tags' + category = 'categories' +``` + +### Use in Front Matter + +```markdown ++++ +tags = ['go', 'hugo'] +categories = ['tutorials'] ++++ +``` + +### List Taxonomy Terms + +```html +{{ range .Site.Taxonomies.tags }} + {{ .Page.Title }} ({{ .Count }}) +{{ end }} +``` + +## Multilingual Sites + +```toml +defaultContentLanguage = 'en' + +[languages] + [languages.en] + title = 'My Site' + weight = 1 + [languages.es] + title = 'Mi Sitio' + weight = 2 +``` + +## Troubleshooting + +| Issue | Solution | +|-------|----------| +| Page not found | Check `baseURL` configuration | +| Theme not loading | Verify theme path in config | +| Raw HTML not showing | Set `unsafe = true` in goldmark config | +| Slow builds | Use `--templateMetrics` to debug | +| Module errors | Run `hugo mod tidy` | +| CSS not updating | Clear browser cache or use fingerprinting | + +## Resources + +- [Hugo Documentation](https://gohugo.io/documentation/) +- [Hugo Themes](https://themes.gohugo.io/) +- [Hugo Discourse](https://discourse.gohugo.io/) +- [GitHub Repository](https://github.com/gohugoio/hugo) +- [Quick Reference](https://gohugo.io/quick-reference/) diff --git a/skills/markdown-to-html/references/jekyll.md b/skills/markdown-to-html/references/jekyll.md new file mode 100644 index 00000000..cc99a935 --- /dev/null +++ b/skills/markdown-to-html/references/jekyll.md @@ -0,0 +1,321 @@ +# Jekyll Reference + +Jekyll is a static site generator that transforms Markdown content into complete websites. It's blog-aware and powers GitHub Pages. + +## Installation + +### Prerequisites + +- Ruby 2.7.0 or higher +- RubyGems +- GCC and Make + +### Install Jekyll + +```bash +# Install Jekyll and Bundler +gem install jekyll bundler +``` + +### Platform-Specific Installation + +```bash +# macOS (install Xcode CLI tools first) +xcode-select --install +gem install jekyll bundler + +# Ubuntu/Debian +sudo apt-get install ruby-full build-essential zlib1g-dev +gem install jekyll bundler + +# Windows (use RubyInstaller) +# Download from https://rubyinstaller.org/ +gem install jekyll bundler +``` + +## Quick Start + +### Create New Site + +```bash +# Create new Jekyll site +jekyll new myblog + +# Navigate to site +cd myblog + +# Build and serve +bundle exec jekyll serve + +# Open http://localhost:4000 +``` + +### Directory Structure + +``` +myblog/ +├── _config.yml # Site configuration +├── _posts/ # Blog posts +│ └── 2025-01-28-welcome.md +├── _layouts/ # Page templates +├── _includes/ # Reusable components +├── _data/ # Data files (YAML, JSON, CSV) +├── _sass/ # Sass partials +├── assets/ # CSS, JS, images +├── index.md # Home page +└── Gemfile # Ruby dependencies +``` + +## CLI Commands + +| Command | Description | +|---------|-------------| +| `jekyll new ` | Create new site | +| `jekyll build` | Build to `_site/` | +| `jekyll serve` | Build and serve locally | +| `jekyll clean` | Remove generated files | +| `jekyll doctor` | Check for issues | + +### Build Options + +```bash +# Build site +bundle exec jekyll build + +# Build with production environment +JEKYLL_ENV=production bundle exec jekyll build + +# Build to custom directory +bundle exec jekyll build --destination ./public + +# Build with incremental regeneration +bundle exec jekyll build --incremental +``` + +### Serve Options + +```bash +# Serve with live reload +bundle exec jekyll serve --livereload + +# Include draft posts +bundle exec jekyll serve --drafts + +# Specify port +bundle exec jekyll serve --port 8080 + +# Bind to all interfaces +bundle exec jekyll serve --host 0.0.0.0 +``` + +## Configuration (_config.yml) + +```yaml +# Site settings +title: My Blog +description: A great blog +baseurl: "" +url: "https://example.com" + +# Build settings +markdown: kramdown +theme: minima +plugins: + - jekyll-feed + - jekyll-seo-tag + +# Kramdown settings +kramdown: + input: GFM + syntax_highlighter: rouge + hard_wrap: false + +# Collections +collections: + docs: + output: true + permalink: /docs/:name/ + +# Defaults +defaults: + - scope: + path: "" + type: "posts" + values: + layout: "post" + +# Exclude from processing +exclude: + - Gemfile + - Gemfile.lock + - node_modules + - vendor +``` + +## Front Matter + +Every content file needs YAML front matter: + +```markdown +--- +layout: post +title: "My First Post" +date: 2025-01-28 12:00:00 -0500 +categories: blog tutorial +tags: [jekyll, markdown] +author: John Doe +excerpt: "A brief introduction..." +published: true +--- + +Your content here... +``` + +## Markdown Processors + +### Kramdown (Default) + +```yaml +# _config.yml +markdown: kramdown +kramdown: + input: GFM # GitHub Flavored Markdown + syntax_highlighter: rouge + syntax_highlighter_opts: + block: + line_numbers: true +``` + +### CommonMark + +```ruby +# Gemfile +gem 'jekyll-commonmark-ghpages' +``` + +```yaml +# _config.yml +markdown: CommonMarkGhPages +commonmark: + options: ["SMART", "FOOTNOTES"] + extensions: ["strikethrough", "autolink", "table"] +``` + +## Liquid Templating + +### Variables + +```liquid +{{ page.title }} +{{ site.title }} +{{ content }} +{{ page.date | date: "%B %d, %Y" }} +``` + +### Loops + +```liquid +{% for post in site.posts %} + +{% endfor %} +``` + +### Conditionals + +```liquid +{% if page.title %} +

{{ page.title }}

+{% endif %} + +{% unless page.draft %} + {{ content }} +{% endunless %} +``` + +### Includes + +```liquid +{% include header.html %} +{% include footer.html param="value" %} +``` + +## Layouts + +### Basic Layout (_layouts/default.html) + +```html + + + + {{ page.title }} | {{ site.title }} + + + + {% include header.html %} +
+ {{ content }} +
+ {% include footer.html %} + + +``` + +### Post Layout (_layouts/post.html) + +```html +--- +layout: default +--- +
+

{{ page.title }}

+ + {{ content }} +
+``` + +## Plugins + +### Common Plugins + +```ruby +# Gemfile +group :jekyll_plugins do + gem 'jekyll-feed' # RSS feed + gem 'jekyll-seo-tag' # SEO meta tags + gem 'jekyll-sitemap' # XML sitemap + gem 'jekyll-paginate' # Pagination + gem 'jekyll-archives' # Archive pages +end +``` + +### Using Plugins + +```yaml +# _config.yml +plugins: + - jekyll-feed + - jekyll-seo-tag + - jekyll-sitemap +``` + +## Troubleshooting + +| Issue | Solution | +|-------|----------| +| Ruby 3.0+ webrick error | `bundle add webrick` | +| Permission denied | Use `--user-install` or rbenv | +| Slow builds | Use `--incremental` | +| Liquid errors | Check for unescaped `{` `}` | +| Encoding issues | Add `encoding: utf-8` to config | +| Plugin not loading | Add to both Gemfile and _config.yml | + +## Resources + +- [Jekyll Documentation](https://jekyllrb.com/docs/) +- [Liquid Template Language](https://shopify.github.io/liquid/) +- [Kramdown Documentation](https://kramdown.gettalong.org/) +- [GitHub Repository](https://github.com/jekyll/jekyll) +- [Jekyll Themes](https://jekyllthemes.io/) diff --git a/skills/markdown-to-html/references/marked.md b/skills/markdown-to-html/references/marked.md new file mode 100644 index 00000000..caadd69c --- /dev/null +++ b/skills/markdown-to-html/references/marked.md @@ -0,0 +1,121 @@ +# Marked + +## Quick Conversion Methods + +Expanded portions of `SKILL.md` at `### Quick Conversion Methods`. + +### Method 1: CLI (Recommended for Single Files) + +```bash +# Convert file to HTML +marked -i input.md -o output.html + +# Convert string directly +marked -s "# Hello World" + +# Output:

Hello World

+``` + +### Method 2: Node.js Script + +```javascript +import { marked } from 'marked'; +import { readFileSync, writeFileSync } from 'fs'; + +const markdown = readFileSync('input.md', 'utf-8'); +const html = marked.parse(markdown); +writeFileSync('output.html', html); +``` + +### Method 3: Browser Usage + +```html + + +``` + +--- + +## Step-by-Step Workflows + +Expanded portions of `SKILL.md` at `### Step-by-Step Workflows`. + +### Workflow 1: Single File Conversion + +1. Ensure marked is installed: `npm install -g marked` +2. Run conversion: `marked -i README.md -o README.html` +3. Verify output file was created + +### Workflow 2: Batch Conversion (Multiple Files) + +Create a script `convert-all.js`: + +```javascript +import { marked } from 'marked'; +import { readFileSync, writeFileSync, readdirSync } from 'fs'; +import { join, basename } from 'path'; + +const inputDir = './docs'; +const outputDir = './html'; + +readdirSync(inputDir) + .filter(file => file.endsWith('.md')) + .forEach(file => { + const markdown = readFileSync(join(inputDir, file), 'utf-8'); + const html = marked.parse(markdown); + const outputFile = basename(file, '.md') + '.html'; + writeFileSync(join(outputDir, outputFile), html); + console.log(`Converted: ${file} → ${outputFile}`); + }); +``` + +Run with: `node convert-all.js` + +### Workflow 3: Conversion with Custom Options + +```javascript +import { marked } from 'marked'; + +// Configure options +marked.setOptions({ + gfm: true, // GitHub Flavored Markdown + breaks: true, // Convert \n to
+ pedantic: false, // Don't conform to original markdown.pl +}); + +const html = marked.parse(markdownContent); +``` + +### Workflow 4: Complete HTML Document + +Wrap converted content in a full HTML template: + +```javascript +import { marked } from 'marked'; +import { readFileSync, writeFileSync } from 'fs'; + +const markdown = readFileSync('input.md', 'utf-8'); +const content = marked.parse(markdown); + +const html = ` + + + + + Document + + + +${content} + +`; + +writeFileSync('output.html', html); +``` diff --git a/skills/markdown-to-html/references/pandoc.md b/skills/markdown-to-html/references/pandoc.md new file mode 100644 index 00000000..6fbe1d0f --- /dev/null +++ b/skills/markdown-to-html/references/pandoc.md @@ -0,0 +1,226 @@ +# Pandoc Reference + +Pandoc is a universal document converter that can convert between numerous markup formats, including Markdown, HTML, LaTeX, Word, and many more. + +## Installation + +### Windows + +```powershell +# Using Chocolatey +choco install pandoc + +# Using Scoop +scoop install pandoc + +# Or download installer from https://pandoc.org/installing.html +``` + +### macOS + +```bash +# Using Homebrew +brew install pandoc +``` + +### Linux + +```bash +# Debian/Ubuntu +sudo apt-get install pandoc + +# Fedora +sudo dnf install pandoc + +# Or download from https://pandoc.org/installing.html +``` + +## Basic Usage + +### Convert Markdown to HTML + +```bash +# Basic conversion +pandoc input.md -o output.html + +# Standalone document with headers +pandoc input.md -s -o output.html + +# With custom CSS +pandoc input.md -s --css=style.css -o output.html +``` + +### Convert to Other Formats + +```bash +# To PDF (requires LaTeX) +pandoc input.md -s -o output.pdf + +# To Word +pandoc input.md -s -o output.docx + +# To LaTeX +pandoc input.md -s -o output.tex + +# To EPUB +pandoc input.md -s -o output.epub +``` + +### Convert from Other Formats + +```bash +# HTML to Markdown +pandoc -f html -t markdown input.html -o output.md + +# Word to Markdown +pandoc input.docx -o output.md + +# LaTeX to HTML +pandoc -f latex -t html input.tex -o output.html +``` + +## Common Options + +| Option | Description | +|--------|-------------| +| `-f, --from ` | Input format | +| `-t, --to ` | Output format | +| `-s, --standalone` | Produce standalone document | +| `-o, --output ` | Output file | +| `--toc` | Include table of contents | +| `--toc-depth ` | TOC depth (default: 3) | +| `-N, --number-sections` | Number section headings | +| `--css ` | Link to CSS stylesheet | +| `--template ` | Use custom template | +| `--metadata =` | Set metadata | +| `--mathml` | Use MathML for math | +| `--mathjax` | Use MathJax for math | +| `-V, --variable =` | Set template variable | + +## Markdown Extensions + +Pandoc supports many markdown extensions: + +```bash +# Enable specific extensions +pandoc -f markdown+emoji+footnotes input.md -o output.html + +# Disable specific extensions +pandoc -f markdown-pipe_tables input.md -o output.html + +# Use strict markdown +pandoc -f markdown_strict input.md -o output.html +``` + +### Common Extensions + +| Extension | Description | +|-----------|-------------| +| `pipe_tables` | Pipe tables (default on) | +| `footnotes` | Footnote support | +| `emoji` | Emoji shortcodes | +| `smart` | Smart quotes and dashes | +| `task_lists` | Task list checkboxes | +| `strikeout` | Strikethrough text | +| `superscript` | Superscript text | +| `subscript` | Subscript text | +| `raw_html` | Raw HTML passthrough | + +## Templates + +### Using Built-in Templates + +```bash +# View default template +pandoc -D html + +# Use custom template +pandoc --template=mytemplate.html input.md -o output.html +``` + +### Template Variables + +```html + + + + $title$ + $for(css)$ + + $endfor$ + + +$body$ + + +``` + +## YAML Metadata + +Include metadata in your markdown files: + +```markdown +--- +title: My Document +author: John Doe +date: 2025-01-28 +abstract: | + This is the abstract. +--- + +# Introduction + +Document content here... +``` + +## Filters + +### Using Lua Filters + +```bash +pandoc --lua-filter=filter.lua input.md -o output.html +``` + +Example Lua filter (`filter.lua`): + +```lua +function Header(el) + if el.level == 1 then + el.classes:insert("main-title") + end + return el +end +``` + +### Using Pandoc Filters + +```bash +pandoc --filter pandoc-citeproc input.md -o output.html +``` + +## Batch Conversion + +### Bash Script + +```bash +#!/bin/bash +for file in *.md; do + pandoc "$file" -s -o "${file%.md}.html" +done +``` + +### PowerShell Script + +```powershell +Get-ChildItem -Filter *.md | ForEach-Object { + $output = $_.BaseName + ".html" + pandoc $_.Name -s -o $output +} +``` + +## Resources + +- [Pandoc User's Guide](https://pandoc.org/MANUAL.html) +- [Pandoc Demos](https://pandoc.org/demos.html) +- [Pandoc FAQ](https://pandoc.org/faqs.html) +- [GitHub Repository](https://github.com/jgm/pandoc) diff --git a/skills/markdown-to-html/references/tables-to-html.md b/skills/markdown-to-html/references/tables-to-html.md new file mode 100644 index 00000000..2e3e6771 --- /dev/null +++ b/skills/markdown-to-html/references/tables-to-html.md @@ -0,0 +1,169 @@ +# Tables to HTML + +## Creating a table + +### Markdown + +```markdown + +| First Header | Second Header | +| ------------- | ------------- | +| Content Cell | Content Cell | +| Content Cell | Content Cell | +``` + +### Parsed HTML + +```html + + + + + + + + + + + + + + + + + +
First HeaderSecond Header
Content CellContent Cell
Content CellContent Cell
+``` + +### Markdown + +```markdown +| Command | Description | +| --- | --- | +| git status | List all new or modified files | +| git diff | Show file differences that haven't been staged | +``` + +### Parsed HTML + +```html + + + + + + + + + + + + + + + + + +
CommandDescription
git statusList all new or modified files
git diffShow file differences that haven't been staged
+``` + +## Formatting Content in Tables + +### Markdown + +```markdown +| Command | Description | +| --- | --- | +| `git status` | List all *new or modified* files | +| `git diff` | Show file differences that **haven't been** staged | +``` + +### Parsed HTML + +```html + + + + + + + + + + + + + + + + + +
CommandDescription
git statusList all new or modified files
git diffShow file differences that haven't been staged
+``` + +### Markdown + +```markdown +| Left-aligned | Center-aligned | Right-aligned | +| :--- | :---: | ---: | +| git status | git status | git status | +| git diff | git diff | git diff | +``` + +### Parsed HTML + +```html + + + + + + + + + + + + + + + + + + + + +
Left-alignedCenter-alignedRight-aligned
git statusgit statusgit status
git diffgit diffgit diff
+``` + +### Markdown + +```markdown +| Name | Character | +| --- | --- | +| Backtick | ` | +| Pipe | \| | +``` + +### Parsed HTML + +```html + + + + + + + + + + + + + + + + + +
NameCharacter
Backtick`
Pipe|
+``` \ No newline at end of file diff --git a/skills/markdown-to-html/references/tables.md b/skills/markdown-to-html/references/tables.md new file mode 100644 index 00000000..ab5e2833 --- /dev/null +++ b/skills/markdown-to-html/references/tables.md @@ -0,0 +1,72 @@ +# Organizing information with tables + +You can build tables to organize information in comments, issues, pull requests, and wikis. + +## Creating a table + +You can create tables with pipes `|` and hyphens `-`. Hyphens are used to create each column's header, while pipes separate each column. You must include a blank line before your table in order for it to correctly render. + +```markdown + +| First Header | Second Header | +| ------------- | ------------- | +| Content Cell | Content Cell | +| Content Cell | Content Cell | +``` + +![Screenshot of a GitHub Markdown table rendered as two equal columns. Headers are shown in boldface, and alternate content rows have gray shading.](https://docs.github.com/assets/images/help/writing/table-basic-rendered.png) + +The pipes on either end of the table are optional. + +Cells can vary in width and do not need to be perfectly aligned within columns. There must be at least three hyphens in each column of the header row. + +```markdown +| Command | Description | +| --- | --- | +| git status | List all new or modified files | +| git diff | Show file differences that haven't been staged | +``` + +![Screenshot of a GitHub Markdown table with two columns of differing width. Rows list the commands "git status" and "git diff" and their descriptions.](https://docs.github.com/assets/images/help/writing/table-varied-columns-rendered.png) + +If you are frequently editing code snippets and tables, you may benefit from enabling a fixed-width font in all comment fields on GitHub. For more information, see [About writing and formatting on GitHub](https://docs.github.comn/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/about-writing-and-formatting-on-github#enabling-fixed-width-fonts-in-the-editor). + +## Formatting content within your table + +You can use [formatting](https://docs.github.comn/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax) such as links, inline code blocks, and text styling within your table: + +```markdown +| Command | Description | +| --- | --- | +| `git status` | List all *new or modified* files | +| `git diff` | Show file differences that **haven't been** staged | +``` + +![Screenshot of a GitHub Markdown table with the commands formatted as code blocks. Bold and italic formatting are used in the descriptions.](https://docs.github.com/assets/images/help/writing/table-inline-formatting-rendered.png) + +You can align text to the left, right, or center of a column by including colons `:` to the left, right, or on both sides of the hyphens within the header row. + +```markdown +| Left-aligned | Center-aligned | Right-aligned | +| :--- | :---: | ---: | +| git status | git status | git status | +| git diff | git diff | git diff | +``` + +![Screenshot of a Markdown table with three columns as rendered on GitHub, showing how text within cells can be set to align left, center, or right.](https://docs.github.com/assets/images/help/writing/table-aligned-text-rendered.png) + +To include a pipe `|` as content within your cell, use a `\` before the pipe: + +```markdown +| Name | Character | +| --- | --- | +| Backtick | ` | +| Pipe | \| | +``` + +![Screenshot of a Markdown table as rendered on GitHub showing how pipes, which normally close cells, are shown when prefaced by a backslash.](https://docs.github.com/assets/images/help/writing/table-escaped-character-rendered.png) + +## Further reading + +* [GitHub Flavored Markdown Spec](https://github.github.com/gfm/) +* [Basic writing and formatting syntax](https://docs.github.comn/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax) \ No newline at end of file diff --git a/skills/markdown-to-html/references/writing-mathematical-expressions-to-html.md b/skills/markdown-to-html/references/writing-mathematical-expressions-to-html.md new file mode 100644 index 00000000..ccf60b59 --- /dev/null +++ b/skills/markdown-to-html/references/writing-mathematical-expressions-to-html.md @@ -0,0 +1,350 @@ +# Writing Mathematical Expressions to HTML + +## Writing Inline Expressions + +### Markdown + +```markdown +This sentence uses `$` delimiters to show math inline: $\sqrt{3x-1}+(1+x)^2$ +``` + +### Parsed HTML + +```html +

This sentence uses $ delimiters to show math inline: + + + 3 + x + + 1 + + + + ( + 1 + + + x + + ) + 2 + + + +

+``` + +### Markdown + +```markdown +This sentence uses $\` and \`$ delimiters to show math inline: $`\sqrt{3x-1}+(1+x)^2`$ +``` + +### Parsed HTML + +```html +

This sentence uses + + + + a + n + d + + + delimiters to show math inline: + + + + 3 + x + + 1 + + + + ( + 1 + + + x + + ) + 2 + + + +

+``` + +--- + +## Writing Expressions as Blocks + +### Markdown + +```markdown +**The Cauchy-Schwarz Inequality**\ +$$\left( \sum_{k=1}^n a_k b_k \right)^2 \leq \left( \sum_{k=1}^n a_k^2 \right) \left( \sum_{k=1}^n b_k^2 \right)$$ +``` + +### Parsed HTML + +```html +

+ The Cauchy-Schwarz Inequality
+ + + + + ( + + + + k + = + 1 + + n + + + a + k + + + b + k + + ) + + 2 + + + + ( + + + + k + = + 1 + + n + + + a + k + 2 + + ) + + + ( + + + + k + = + 1 + + n + + + b + k + 2 + + ) + + + +

+``` + +### Markdown + +```markdown +**The Cauchy-Schwarz Inequality** + + ```math + \left( \sum_{k=1}^n a_k b_k \right)^2 \leq \left( \sum_{k=1}^n a_k^2 \right) \left( \sum_{k=1}^n b_k^2 \right) + ``` +``` + +### Parsed HTML + +```html +

The Cauchy-Schwarz Inequality

+ + + + + + ( + + + + k + = + 1 + + n + + + a + k + + + b + k + + ) + + 2 + + + + ( + + + + k + = + 1 + + n + + + a + k + 2 + + ) + + + ( + + + + k + = + 1 + + n + + + b + k + 2 + + ) + + + +``` + +### Markdwon + +```markdown +The equation $a^2 + b^2 = c^2$ is the Pythagorean theorem. +``` + +### Parsed HTML + +```html +

The equation + + + a + 2 + + + + + b + 2 + + = + + c + 2 + + is the Pythagorean theorem. +

+``` + +### Markdown + +``` +$$ +\int_0^\infty e^{-x} dx = 1 +$$ +``` + +### Parsed HTML + +```html +

+ + + 0 + + + + e + + + x + + + d + x + = + 1 +

+``` + +--- + +## Dollar Sign Inline with Mathematical Expression + +### Markdown + +```markdown +This expression uses `\$` to display a dollar sign: $`\sqrt{\$4}`$ +``` + +### Parsed HTML + +```html +

This expression uses + \$ to display a dollar sign: + + + + $ + 4 + + + +

+``` + +### Markdown + +```markdown +To split $100 in half, we calculate $100/2$ +``` + +### Parsed HTML + +```html +

To split + $100 in half, we calculate + + + 100 + + / + + 2 + + +

+``` diff --git a/skills/markdown-to-html/references/writing-mathematical-expressions.md b/skills/markdown-to-html/references/writing-mathematical-expressions.md new file mode 100644 index 00000000..84808b43 --- /dev/null +++ b/skills/markdown-to-html/references/writing-mathematical-expressions.md @@ -0,0 +1,76 @@ +# Writing mathematical expressions + +Use Markdown to display mathematical expressions on GitHub. + +## About writing mathematical expressions + +To enable clear communication of mathematical expressions, GitHub supports LaTeX formatted math within Markdown. For more information, see [LaTeX/Mathematics](http://en.wikibooks.org/wiki/LaTeX/Mathematics) in Wikibooks. + +GitHub's math rendering capability uses MathJax; an open source, JavaScript-based display engine. MathJax supports a wide range of LaTeX macros, and several useful accessibility extensions. For more information, see [the MathJax documentation](http://docs.mathjax.org/en/latest/input/tex/index.html#tex-and-latex-support) and [the MathJax Accessibility Extensions Documentation](https://mathjax.github.io/MathJax-a11y/docs/#reader-guide). + +Mathematical expressions rendering is available in GitHub Issues, GitHub Discussions, pull requests, wikis, and Markdown files. + +## Writing inline expressions + +There are two options for delimiting a math expression inline with your text. You can either surround the expression with dollar symbols (`$`), or start the expression with $\` and end it with \`$. The latter syntax is useful when the expression you are writing contains characters that overlap with markdown syntax. For more information, see [Basic writing and formatting syntax](https://docs.github.comn/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax). + +```text +This sentence uses `$` delimiters to show math inline: $\sqrt{3x-1}+(1+x)^2$ +``` + +![Screenshot of rendered Markdown showing an inline mathematical expression: the square root of 3x minus 1 plus (1 plus x) squared.](https://docs.github.com/assets/images/help/writing/inline-math-markdown-rendering.png) + +```text +This sentence uses $\` and \`$ delimiters to show math inline: $`\sqrt{3x-1}+(1+x)^2`$ +``` + +![Screenshot of rendered Markdown showing an inline mathematical expression with backtick syntax: the square root of 3x minus 1 plus (1 plus x) squared.](https://docs.github.com/assets/images/help/writing/inline-backtick-math-markdown-rendering.png) + +## Writing expressions as blocks + +To add a math expression as a block, start a new line and delimit the expression with two dollar symbols `$$`. + +> [!TIP] If you're writing in an .md file, you will need to use specific formatting to create a line break, such as ending the line with a backslash as shown in the example below. For more information on line breaks in Markdown, see [Basic writing and formatting syntax](https://docs.github.comn/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax#line-breaks). + +```text +**The Cauchy-Schwarz Inequality**\ +$$\left( \sum_{k=1}^n a_k b_k \right)^2 \leq \left( \sum_{k=1}^n a_k^2 \right) \left( \sum_{k=1}^n b_k^2 \right)$$ +``` + +![Screenshot of rendered Markdown showing a complex equation. Bold text reads "The Cauchy-Schwarz Inequality" above the formula for the inequality.](https://docs.github.com/assets/images/help/writing/math-expression-as-a-block-rendering.png) + +Alternatively, you can use the \`\`\`math code block syntax to display a math expression as a block. With this syntax, you don't need to use `$$` delimiters. The following will render the same as above: + +````text +**The Cauchy-Schwarz Inequality** + +```math +\left( \sum_{k=1}^n a_k b_k \right)^2 \leq \left( \sum_{k=1}^n a_k^2 \right) \left( \sum_{k=1}^n b_k^2 \right) +``` +```` + +## Writing dollar signs in line with and within mathematical expressions + +To display a dollar sign as a character in the same line as a mathematical expression, you need to escape the non-delimiter `$` to ensure the line renders correctly. + +* Within a math expression, add a `\` symbol before the explicit `$`. + + ```text + This expression uses `\$` to display a dollar sign: $`\sqrt{\$4}`$ + ``` + + ![Screenshot of rendered Markdown showing how a backslash before a dollar sign displays the sign as part of a mathematical expression.](https://docs.github.com/assets/images/help/writing/dollar-sign-within-math-expression.png) + +* Outside a math expression, but on the same line, use span tags around the explicit `$`. + + ```text + To split $100 in half, we calculate $100/2$ + ``` + + ![Screenshot of rendered Markdown showing how span tags around a dollar sign display the sign as inline text not as part of a mathematical equation.](https://docs.github.com/assets/images/help/writing/dollar-sign-inline-math-expression.png) + +## Further reading + +* [The MathJax website](http://mathjax.org) +* [Getting started with writing and formatting on GitHub](https://docs.github.comn/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github) +* [GitHub Flavored Markdown Spec](https://github.github.com/gfm/) \ No newline at end of file From 1782c9814eea3c0f79b8da0e54616ea079fba883 Mon Sep 17 00:00:00 2001 From: John Haugabook Date: Thu, 29 Jan 2026 00:49:17 -0500 Subject: [PATCH 2/2] Apply suggestions from code review Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- skills/markdown-to-html/SKILL.md | 2 +- skills/markdown-to-html/references/basic-markdown.md | 6 +++--- skills/markdown-to-html/references/code-blocks.md | 8 ++++---- skills/markdown-to-html/references/collapsed-sections.md | 2 +- skills/markdown-to-html/references/tables.md | 6 +++--- .../writing-mathematical-expressions-to-html.md | 2 +- .../references/writing-mathematical-expressions.md | 6 +++--- 7 files changed, 16 insertions(+), 16 deletions(-) diff --git a/skills/markdown-to-html/SKILL.md b/skills/markdown-to-html/SKILL.md index cf70ef71..430ad69a 100644 --- a/skills/markdown-to-html/SKILL.md +++ b/skills/markdown-to-html/SKILL.md @@ -7,7 +7,7 @@ description: 'Convert Markdown files to HTML similar to `marked.js`, `pandoc`, ` Expert skill for converting Markdown documents to HTML using the marked.js library, or writing data conversion scripts; in this case scripts similar to [markedJS/marked](https://github.com/markedjs/marked) repository. For custom scripts knowledge is not confined to `marked.js`, but data conversion methods are utilized from tools like [pandoc](https://github.com/jgm/pandoc) and [gomarkdown/markdown](https://github.com/gomarkdown/markdown) for data conversion; [jekyll/jekyll](https://github.com/jekyll/jekyll) and [gohugoio/hugo](https://github.com/gohugoio/hugo) for templating systems. -The conversion script or tool should handles single files, batch conversions, and advanced configurations. +The conversion script or tool should handle single files, batch conversions, and advanced configurations. ## When to Use This Skill diff --git a/skills/markdown-to-html/references/basic-markdown.md b/skills/markdown-to-html/references/basic-markdown.md index 9181c3aa..acb7e890 100644 --- a/skills/markdown-to-html/references/basic-markdown.md +++ b/skills/markdown-to-html/references/basic-markdown.md @@ -16,7 +16,7 @@ To create a heading, add one to six # symbols before your heading tex When you use two or more headings, GitHub automatically generates a table of contents that you can access by clicking the "Outline" menu icon within the file header. Each heading title is listed in the table of contents and you can click a title to navigate to the selected section. -![Screenshot of a README file with the drop-down menu for the table of contents exposed. The table of contents icon is outlined in dark orange.](https://docs.github.comhttps://docs.github.com/assets/images/help/repository/headings-toc.png) +![Screenshot of a README file with the drop-down menu for the table of contents exposed. The table of contents icon is outlined in dark orange.](https://docs.github.com/assets/images/help/repository/headings-toc.png) ## Styling text @@ -45,7 +45,7 @@ Text that is not a quote Quoted text is indented with a vertical line on the left and displayed using gray type. -![Screenshot of rendered GitHub Markdown showing the difference between normal and quoted text.](https://docs.github.comhttps://docs.github.com/assets/images/help/writing/quoted-text-rendered.png) +![Screenshot of rendered GitHub Markdown showing the difference between normal and quoted text.](https://docs.github.com/assets/images/help/writing/quoted-text-rendered.png) > \[!NOTE] > When viewing a conversation, you can automatically quote text in a comment by highlighting the text, then typing R. You can quote an entire comment by clicking , then **Quote reply**. For more information about keyboard shortcuts, see [Keyboard shortcuts](https://docs.github.com/en/get-started/accessibility/keyboard-shortcuts). @@ -252,7 +252,7 @@ Will have a blank line separating both lines You can display an image by adding ! and wrapping the alt text in `[ ]`. Alt text is a short text equivalent of the information in the image. Then, wrap the link for the image in parentheses `()`. -`![Screenshot of a comment on a GitHub issue showing an image, added in the Markdown, of an Octocat smiling and raising a tentacle.](https://docs.github.comhttps://myoctocat.com/assets/images/base-octocat.svg)` +`![Screenshot of a comment on a GitHub issue showing an image, added in the Markdown, of an Octocat smiling and raising a tentacle.](https://myoctocat.com/assets/images/base-octocat.svg)` ![Screenshot of a comment on a GitHub issue showing an image, added in the Markdown, of an Octocat smiling and raising a tentacle.](https://docs.github.com/assets/images/help/writing/image-rendered.png) diff --git a/skills/markdown-to-html/references/code-blocks.md b/skills/markdown-to-html/references/code-blocks.md index 729c8874..0f9ef2bd 100644 --- a/skills/markdown-to-html/references/code-blocks.md +++ b/skills/markdown-to-html/references/code-blocks.md @@ -31,7 +31,7 @@ Look! You can see my backticks. ![Screenshot of rendered Markdown showing that when you write triple backticks between quadruple backticks they are visible in the rendered content.](https://docs.github.com/assets/images/help/writing/fenced-code-show-backticks-rendered.png) -If you are frequently editing code snippets and tables, you may benefit from enabling a fixed-width font in all comment fields on GitHub. For more information, see [About writing and formatting on GitHub](https://docs.github.comn/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/about-writing-and-formatting-on-github#enabling-fixed-width-fonts-in-the-editor). +If you are frequently editing code snippets and tables, you may benefit from enabling a fixed-width font in all comment fields on GitHub. For more information, see [About writing and formatting on GitHub](https://docs.github.com/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/about-writing-and-formatting-on-github#enabling-fixed-width-fonts-in-the-editor). ## Syntax highlighting @@ -56,15 +56,15 @@ This will display the code block with syntax highlighting: ![Screenshot of three lines of Ruby code as displayed on GitHub. Elements of the code display in purple, blue, and red type for scannability.](https://docs.github.com/assets/images/help/writing/code-block-syntax-highlighting-rendered.png) > \[!TIP] -> When you create a fenced code block that you also want to have syntax highlighting on a GitHub Pages site, use lower-case language identifiers. For more information, see [About GitHub Pages and Jekyll](https://docs.github.comn/pages/setting-up-a-github-pages-site-with-jekyll/about-github-pages-and-jekyll#syntax-highlighting). +> When you create a fenced code block that you also want to have syntax highlighting on a GitHub Pages site, use lower-case language identifiers. For more information, see [About GitHub Pages and Jekyll](https://docs.github.com/pages/setting-up-a-github-pages-site-with-jekyll/about-github-pages-and-jekyll#syntax-highlighting). We use [Linguist](https://github.com/github-linguist/linguist) to perform language detection and to select [third-party grammars](https://github.com/github-linguist/linguist/blob/main/vendor/README.md) for syntax highlighting. You can find out which keywords are valid in [the languages YAML file](https://github.com/github-linguist/linguist/blob/main/lib/linguist/languages.yml). ## Creating diagrams -You can also use code blocks to create diagrams in Markdown. GitHub supports Mermaid, GeoJSON, TopoJSON, and ASCII STL syntax. For more information, see [Creating diagrams](https://docs.github.comn/get-started/writing-on-github/working-with-advanced-formatting/creating-diagrams). +You can also use code blocks to create diagrams in Markdown. GitHub supports Mermaid, GeoJSON, TopoJSON, and ASCII STL syntax. For more information, see [Creating diagrams](https://docs.github.com/get-started/writing-on-github/working-with-advanced-formatting/creating-diagrams). ## Further reading * [GitHub Flavored Markdown Spec](https://github.github.com/gfm/) -* [Basic writing and formatting syntax](https://docs.github.comn/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax) \ No newline at end of file +* [Basic writing and formatting syntax](https://docs.github.com/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax) \ No newline at end of file diff --git a/skills/markdown-to-html/references/collapsed-sections.md b/skills/markdown-to-html/references/collapsed-sections.md index b2caf30a..11309e4b 100644 --- a/skills/markdown-to-html/references/collapsed-sections.md +++ b/skills/markdown-to-html/references/collapsed-sections.md @@ -45,4 +45,4 @@ Optionally, to make the section display as open by default, add the `open` attri ## Further reading * [GitHub Flavored Markdown Spec](https://github.github.com/gfm/) -* [Basic writing and formatting syntax](https://docs.github.comn/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax) \ No newline at end of file +* [Basic writing and formatting syntax](https://docs.github.com/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax) \ No newline at end of file diff --git a/skills/markdown-to-html/references/tables.md b/skills/markdown-to-html/references/tables.md index ab5e2833..b0581c69 100644 --- a/skills/markdown-to-html/references/tables.md +++ b/skills/markdown-to-html/references/tables.md @@ -29,11 +29,11 @@ Cells can vary in width and do not need to be perfectly aligned within columns. ![Screenshot of a GitHub Markdown table with two columns of differing width. Rows list the commands "git status" and "git diff" and their descriptions.](https://docs.github.com/assets/images/help/writing/table-varied-columns-rendered.png) -If you are frequently editing code snippets and tables, you may benefit from enabling a fixed-width font in all comment fields on GitHub. For more information, see [About writing and formatting on GitHub](https://docs.github.comn/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/about-writing-and-formatting-on-github#enabling-fixed-width-fonts-in-the-editor). +If you are frequently editing code snippets and tables, you may benefit from enabling a fixed-width font in all comment fields on GitHub. For more information, see [About writing and formatting on GitHub](https://docs.github.com/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/about-writing-and-formatting-on-github#enabling-fixed-width-fonts-in-the-editor). ## Formatting content within your table -You can use [formatting](https://docs.github.comn/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax) such as links, inline code blocks, and text styling within your table: +You can use [formatting](https://docs.github.com/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax) such as links, inline code blocks, and text styling within your table: ```markdown | Command | Description | @@ -69,4 +69,4 @@ To include a pipe `|` as content within your cell, use a `\` before the pipe: ## Further reading * [GitHub Flavored Markdown Spec](https://github.github.com/gfm/) -* [Basic writing and formatting syntax](https://docs.github.comn/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax) \ No newline at end of file +* [Basic writing and formatting syntax](https://docs.github.com/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax) \ No newline at end of file diff --git a/skills/markdown-to-html/references/writing-mathematical-expressions-to-html.md b/skills/markdown-to-html/references/writing-mathematical-expressions-to-html.md index ccf60b59..4691850d 100644 --- a/skills/markdown-to-html/references/writing-mathematical-expressions-to-html.md +++ b/skills/markdown-to-html/references/writing-mathematical-expressions-to-html.md @@ -240,7 +240,7 @@ $$\left( \sum_{k=1}^n a_k b_k \right)^2 \leq \left( \sum_{k=1}^n a_k^2 \right) \ ``` -### Markdwon +### Markdown ```markdown The equation $a^2 + b^2 = c^2$ is the Pythagorean theorem. diff --git a/skills/markdown-to-html/references/writing-mathematical-expressions.md b/skills/markdown-to-html/references/writing-mathematical-expressions.md index 84808b43..ae911f9c 100644 --- a/skills/markdown-to-html/references/writing-mathematical-expressions.md +++ b/skills/markdown-to-html/references/writing-mathematical-expressions.md @@ -12,7 +12,7 @@ Mathematical expressions rendering is available in GitHub Issues, GitHub Discuss ## Writing inline expressions -There are two options for delimiting a math expression inline with your text. You can either surround the expression with dollar symbols (`$`), or start the expression with $\` and end it with \`$. The latter syntax is useful when the expression you are writing contains characters that overlap with markdown syntax. For more information, see [Basic writing and formatting syntax](https://docs.github.comn/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax). +There are two options for delimiting a math expression inline with your text. You can either surround the expression with dollar symbols (`$`), or start the expression with $\` and end it with \`$. The latter syntax is useful when the expression you are writing contains characters that overlap with markdown syntax. For more information, see [Basic writing and formatting syntax](https://docs.github.com/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax). ```text This sentence uses `$` delimiters to show math inline: $\sqrt{3x-1}+(1+x)^2$ @@ -30,7 +30,7 @@ This sentence uses $\` and \`$ delimiters to show math inline: $`\sqrt{3x-1}+(1+ To add a math expression as a block, start a new line and delimit the expression with two dollar symbols `$$`. -> [!TIP] If you're writing in an .md file, you will need to use specific formatting to create a line break, such as ending the line with a backslash as shown in the example below. For more information on line breaks in Markdown, see [Basic writing and formatting syntax](https://docs.github.comn/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax#line-breaks). +> [!TIP] If you're writing in an .md file, you will need to use specific formatting to create a line break, such as ending the line with a backslash as shown in the example below. For more information on line breaks in Markdown, see [Basic writing and formatting syntax](https://docs.github.com/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax#line-breaks). ```text **The Cauchy-Schwarz Inequality**\ @@ -72,5 +72,5 @@ To display a dollar sign as a character in the same line as a mathematical expre ## Further reading * [The MathJax website](http://mathjax.org) -* [Getting started with writing and formatting on GitHub](https://docs.github.comn/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github) +* [Getting started with writing and formatting on GitHub](https://docs.github.com/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github) * [GitHub Flavored Markdown Spec](https://github.github.com/gfm/) \ No newline at end of file