Markdown to HTML Conversion

Markdown to HTML Conversion

Teaches the AI to convert Markdown to HTML with marked.js, pandoc and similar tools, covering tables, code blocks, math and static site generators.

Skill files16 files

references/

SKILL.md917 lines
1
---
2
name: markdown-to-html
3
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.'
4
---
5
6
# Markdown to HTML Conversion
7
8
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.
9
10
The conversion script or tool should handle single files, batch conversions, and advanced configurations.
11
12
## When to Use This Skill
13
14
- User asks to "convert markdown to html" or "transform md files"
15
- User wants to "render markdown" as HTML output
16
- User needs to generate HTML documentation from .md files
17
- User is building static sites from Markdown content
18
- User is building template system that converts markdown to html
19
- User is working on a tool, widget, or custom template for an existing templating system
20
- User wants to preview Markdown as rendered HTML
21
22
## Converting Markdown to HTML
23
24
### Essential Basic Conversions
25
26
For more see [basic-markdown-to-html.md](references/basic-markdown-to-html.md)
27
28
```text
29
```markdown
30
# Level 1
31
## Level 2
32
33
One sentence with a [link](https://example.com), and a HTML snippet like `<p>paragraph tag</p>`.
34
35
- `ul` list item 1
36
- `ul` list item 2
37
38
1. `ol` list item 1
39
2. `ol` list item 1
40
41
| Table Item | Description |
42
| One | One is the spelling of the number `1`. |
43
| Two | Two is the spelling of the number `2`. |
44
45
```js
46
var one = 1;
47
var two = 2;
48
49
function simpleMath(x, y) {
50
return x + y;
51
}
52
console.log(simpleMath(one, two));
53
```
54
```
55
56
```html
57
<h1>Level 1</h1>
58
<h2>Level 2</h2>
59
60
<p>One sentence with a <a href="https://example.com">link</a>, and a HTML snippet like <code>&lt;p&gt;paragraph tag&lt;/p&gt;</code>.</p>
61
62
<ul>
63
<li>`ul` list item 1</li>
64
<li>`ul` list item 2</li>
65
</ul>
66
67
<ol>
68
<li>`ol` list item 1</li>
69
<li>`ol` list item 2</li>
70
</ol>
71
72
<table>
73
<thead>
74
<tr>
75
<th>Table Item</th>
76
<th>Description</th>
77
</tr>
78
</thead>
79
<tbody>
80
<tr>
81
<td>One</td>
82
<td>One is the spelling of the number `1`.</td>
83
</tr>
84
<tr>
85
<td>Two</td>
86
<td>Two is the spelling of the number `2`.</td>
87
</tr>
88
</tbody>
89
</table>
90
91
<pre>
92
<code>var one = 1;
93
var two = 2;
94
95
function simpleMath(x, y) {
96
return x + y;
97
}
98
console.log(simpleMath(one, two));</code>
99
</pre>
100
```
101
```
102
103
### Code Block Conversions
104
105
For more see [code-blocks-to-html.md](references/code-blocks-to-html.md)
106
107
```text
108
109
```markdown
110
your code here
111
```
112
113
```html
114
<pre><code class="language-md">
115
your code here
116
</code></pre>
117
```
118
119
```js
120
console.log("Hello world");
121
```
122
123
```html
124
<pre><code class="language-js">
125
console.log("Hello world");
126
</code></pre>
127
```
128
129
```markdown
130
```
131
132
```
133
visible backticks
134
```
135
136
```
137
```
138
139
```html
140
<pre><code>
141
```
142
143
visible backticks
144
145
```
146
</code></pre>
147
```
148
```
149
150
### Collapsed Section Conversions
151
152
For more see [collapsed-sections-to-html.md](references/collapsed-sections-to-html.md)
153
154
```text
155
```markdown
156
<details>
157
<summary>More info</summary>
158
159
### Header inside
160
161
- Lists
162
- **Formatting**
163
- Code blocks
164
165
```js
166
console.log("Hello");
167
```
168
169
</details>
170
```
171
172
```html
173
<details>
174
<summary>More info</summary>
175
176
<h3>Header inside</h3>
177
178
<ul>
179
<li>Lists</li>
180
<li><strong>Formatting</strong></li>
181
<li>Code blocks</li>
182
</ul>
183
184
<pre>
185
<code class="language-js">console.log("Hello");</code>
186
</pre>
187
188
</details>
189
```
190
```
191
192
### Mathematical Expression Conversions
193
194
For more see [writing-mathematical-expressions-to-html.md](references/writing-mathematical-expressions-to-html.md)
195
196
```text
197
```markdown
198
This sentence uses `$` delimiters to show math inline: $\sqrt{3x-1}+(1+x)^2$
199
```
200
201
```html
202
<p>This sentence uses <code>$</code> delimiters to show math inline:
203
<math-renderer><math xmlns="http://www.w3.org/1998/Math/MathML">
204
<msqrt><mn>3</mn><mi>x</mi><mo>−</mo><mn>1</mn></msqrt>
205
<mo>+</mo><mo>(</mo><mn>1</mn><mo>+</mo><mi>x</mi>
206
<msup><mo>)</mo><mn>2</mn></msup>
207
</math>
208
</math-renderer>
209
</p>
210
```
211
212
```markdown
213
**The Cauchy-Schwarz Inequality**\
214
$$\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)$$
215
```
216
217
```html
218
<p><strong>The Cauchy-Schwarz Inequality</strong><br>
219
<math-renderer>
220
<math xmlns="http://www.w3.org/1998/Math/MathML">
221
<msup>
222
<mrow><mo>(</mo>
223
<munderover><mo data-mjx-texclass="OP">∑</mo>
224
<mrow><mi>k</mi><mo>=</mo><mn>1</mn></mrow><mi>n</mi>
225
</munderover>
226
<msub><mi>a</mi><mi>k</mi></msub>
227
<msub><mi>b</mi><mi>k</mi></msub>
228
<mo>)</mo>
229
</mrow>
230
<mn>2</mn>
231
</msup>
232
<mo>≤</mo>
233
<mrow><mo>(</mo>
234
<munderover><mo>∑</mo>
235
<mrow><mi>k</mi><mo>=</mo><mn>1</mn></mrow>
236
<mi>n</mi>
237
</munderover>
238
<msubsup><mi>a</mi><mi>k</mi><mn>2</mn></msubsup>
239
<mo>)</mo>
240
</mrow>
241
<mrow><mo>(</mo>
242
<munderover><mo>∑</mo>
243
<mrow><mi>k</mi><mo>=</mo><mn>1</mn></mrow>
244
<mi>n</mi>
245
</munderover>
246
<msubsup><mi>b</mi><mi>k</mi><mn>2</mn></msubsup>
247
<mo>)</mo>
248
</mrow>
249
</math>
250
</math-renderer></p>
251
```
252
```
253
254
### Table Conversions
255
256
For more see [tables-to-html.md](references/tables-to-html.md)
257
258
```text
259
```markdown
260
| First Header | Second Header |
261
| ------------- | ------------- |
262
| Content Cell | Content Cell |
263
| Content Cell | Content Cell |
264
```
265
266
```html
267
<table>
268
<thead><tr><th>First Header</th><th>Second Header</th></tr></thead>
269
<tbody>
270
<tr><td>Content Cell</td><td>Content Cell</td></tr>
271
<tr><td>Content Cell</td><td>Content Cell</td></tr>
272
</tbody>
273
</table>
274
```
275
276
```markdown
277
| Left-aligned | Center-aligned | Right-aligned |
278
| :--- | :---: | ---: |
279
| git status | git status | git status |
280
| git diff | git diff | git diff |
281
```
282
283
```html
284
<table>
285
<thead>
286
<tr>
287
<th align="left">Left-aligned</th>
288
<th align="center">Center-aligned</th>
289
<th align="right">Right-aligned</th>
290
</tr>
291
</thead>
292
<tbody>
293
<tr>
294
<td align="left">git status</td>
295
<td align="center">git status</td>
296
<td align="right">git status</td>
297
</tr>
298
<tr>
299
<td align="left">git diff</td>
300
<td align="center">git diff</td>
301
<td align="right">git diff</td>
302
</tr>
303
</tbody>
304
</table>
305
```
306
```
307
308
## Working with [`markedJS/marked`](references/marked.md)
309
310
### Prerequisites
311
312
- Node.js installed (for CLI or programmatic usage)
313
- Install marked globally for CLI: `npm install -g marked`
314
- Or install locally: `npm install marked`
315
316
### Quick Conversion Methods
317
318
See [marked.md](references/marked.md) **Quick Conversion Methods**
319
320
### Step-by-Step Workflows
321
322
See [marked.md](references/marked.md) **Step-by-Step Workflows**
323
324
### CLI Configuration
325
326
### Using Config Files
327
328
Create `~/.marked.json` for persistent options:
329
330
```json
331
{
332
"gfm": true,
333
"breaks": true
334
}
335
```
336
337
Or use a custom config:
338
339
```bash
340
marked -i input.md -o output.html -c config.json
341
```
342
343
### CLI Options Reference
344
345
| Option | Description |
346
|--------|-------------|
347
| `-i, --input <file>` | Input Markdown file |
348
| `-o, --output <file>` | Output HTML file |
349
| `-s, --string <string>` | Parse string instead of file |
350
| `-c, --config <file>` | Use custom config file |
351
| `--gfm` | Enable GitHub Flavored Markdown |
352
| `--breaks` | Convert newlines to `<br>` |
353
| `--help` | Show all options |
354
355
### Security Warning
356
357
⚠️ **Marked does NOT sanitize output HTML.** For untrusted input, use a sanitizer:
358
359
```javascript
360
import { marked } from 'marked';
361
import DOMPurify from 'dompurify';
362
363
const unsafeHtml = marked.parse(untrustedMarkdown);
364
const safeHtml = DOMPurify.sanitize(unsafeHtml);
365
```
366
367
Recommended sanitizers:
368
369
- [DOMPurify](https://github.com/cure53/DOMPurify) (recommended)
370
- [sanitize-html](https://github.com/apostrophecms/sanitize-html)
371
- [js-xss](https://github.com/leizongmin/js-xss)
372
373
### Supported Markdown Flavors
374
375
| Flavor | Support |
376
|--------|---------|
377
| Original Markdown | 100% |
378
| CommonMark 0.31 | 98% |
379
| GitHub Flavored Markdown | 97% |
380
381
### Troubleshooting
382
383
| Issue | Solution |
384
|-------|----------|
385
| Special characters at file start | Strip zero-width chars: `content.replace(/^[\u200B\u200C\u200D\uFEFF]/,"")` |
386
| Code blocks not highlighting | Add a syntax highlighter like highlight.js |
387
| Tables not rendering | Ensure `gfm: true` option is set |
388
| Line breaks ignored | Set `breaks: true` in options |
389
| XSS vulnerability concerns | Use DOMPurify to sanitize output |
390
391
## Working with [`pandoc`](references/pandoc.md)
392
393
### Prerequisites
394
395
- Pandoc installed (download from <https://pandoc.org/installing.html>)
396
- For PDF output: LaTeX installation (MacTeX on macOS, MiKTeX on Windows, texlive on Linux)
397
- Terminal/command prompt access
398
399
### Quick Conversion Methods
400
401
#### Method 1: CLI Basic Conversion
402
403
```bash
404
# Convert markdown to HTML
405
pandoc input.md -o output.html
406
407
# Convert with standalone document (includes header/footer)
408
pandoc input.md -s -o output.html
409
410
# Explicit format specification
411
pandoc input.md -f markdown -t html -s -o output.html
412
```
413
414
#### Method 2: Filter Mode (Interactive)
415
416
```bash
417
# Start pandoc as a filter
418
pandoc
419
420
# Type markdown, then Ctrl-D (Linux/macOS) or Ctrl-Z+Enter (Windows)
421
Hello *pandoc*!
422
# Output: <p>Hello <em>pandoc</em>!</p>
423
```
424
425
#### Method 3: Format Conversion
426
427
```bash
428
# HTML to Markdown
429
pandoc -f html -t markdown input.html -o output.md
430
431
# Markdown to LaTeX
432
pandoc input.md -s -o output.tex
433
434
# Markdown to PDF (requires LaTeX)
435
pandoc input.md -s -o output.pdf
436
437
# Markdown to Word
438
pandoc input.md -s -o output.docx
439
```
440
441
### CLI Configuration
442
443
| Option | Description |
444
|--------|-------------|
445
| `-f, --from <format>` | Input format (markdown, html, latex, etc.) |
446
| `-t, --to <format>` | Output format (html, latex, pdf, docx, etc.) |
447
| `-s, --standalone` | Produce standalone document with header/footer |
448
| `-o, --output <file>` | Output file (inferred from extension) |
449
| `--mathml` | Convert TeX math to MathML |
450
| `--metadata title="Title"` | Set document metadata |
451
| `--toc` | Include table of contents |
452
| `--template <file>` | Use custom template |
453
| `--help` | Show all options |
454
455
### Security Warning
456
457
⚠️ **Pandoc processes input faithfully.** When converting untrusted markdown:
458
459
- Use `--sandbox` mode to disable external file access
460
- Validate input before processing
461
- Sanitize HTML output if displayed in browsers
462
463
```bash
464
# Run in sandbox mode for untrusted input
465
pandoc --sandbox input.md -o output.html
466
```
467
468
### Supported Markdown Flavors
469
470
| Flavor | Support |
471
|--------|---------|
472
| Pandoc Markdown | 100% (native) |
473
| CommonMark | Full (use `-f commonmark`) |
474
| GitHub Flavored Markdown | Full (use `-f gfm`) |
475
| MultiMarkdown | Partial |
476
477
### Troubleshooting
478
479
| Issue | Solution |
480
|-------|----------|
481
| PDF generation fails | Install LaTeX (MacTeX, MiKTeX, or texlive) |
482
| Encoding issues on Windows | Run `chcp 65001` before using pandoc |
483
| Missing standalone headers | Add `-s` flag for complete documents |
484
| Math not rendering | Use `--mathml` or `--mathjax` option |
485
| Tables not rendering | Ensure proper table syntax with pipes and dashes |
486
487
## Working with [`gomarkdown/markdown`](references/gomarkdown.md)
488
489
### Prerequisites
490
491
- Go 1.18 or higher installed
492
- Install the library: `go get github.com/gomarkdown/markdown`
493
- For CLI tool: `go install github.com/gomarkdown/mdtohtml@latest`
494
495
### Quick Conversion Methods
496
497
#### Method 1: Simple Conversion (Go)
498
499
```go
500
package main
501
502
import (
503
"fmt"
504
"github.com/gomarkdown/markdown"
505
)
506
507
func main() {
508
md := []byte("# Hello World\n\nThis is **bold** text.")
509
html := markdown.ToHTML(md, nil, nil)
510
fmt.Println(string(html))
511
}
512
```
513
514
#### Method 2: CLI Tool
515
516
```bash
517
# Install mdtohtml
518
go install github.com/gomarkdown/mdtohtml@latest
519
520
# Convert file
521
mdtohtml input.md output.html
522
523
# Convert file (output to stdout)
524
mdtohtml input.md
525
```
526
527
#### Method 3: Custom Parser and Renderer
528
529
```go
530
package main
531
532
import (
533
"github.com/gomarkdown/markdown"
534
"github.com/gomarkdown/markdown/html"
535
"github.com/gomarkdown/markdown/parser"
536
)
537
538
func mdToHTML(md []byte) []byte {
539
// Create parser with extensions
540
extensions := parser.CommonExtensions | parser.AutoHeadingIDs | parser.NoEmptyLineBeforeBlock
541
p := parser.NewWithExtensions(extensions)
542
doc := p.Parse(md)
543
544
// Create HTML renderer with extensions
545
htmlFlags := html.CommonFlags | html.HrefTargetBlank
546
opts := html.RendererOptions{Flags: htmlFlags}
547
renderer := html.NewRenderer(opts)
548
549
return markdown.Render(doc, renderer)
550
}
551
```
552
553
### CLI Configuration
554
555
The `mdtohtml` CLI tool has minimal options:
556
557
```bash
558
mdtohtml input-file [output-file]
559
```
560
561
For advanced configuration, use the Go library programmatically with parser and renderer options:
562
563
| Parser Extension | Description |
564
|------------------|-------------|
565
| `parser.CommonExtensions` | Tables, fenced code, autolinks, strikethrough, etc. |
566
| `parser.AutoHeadingIDs` | Generate IDs for headings |
567
| `parser.NoEmptyLineBeforeBlock` | No blank line needed before blocks |
568
| `parser.MathJax` | MathJax support for LaTeX math |
569
570
| HTML Flag | Description |
571
|-----------|-------------|
572
| `html.CommonFlags` | Common HTML output flags |
573
| `html.HrefTargetBlank` | Add `target="_blank"` to links |
574
| `html.CompletePage` | Generate complete HTML page |
575
| `html.UseXHTML` | Generate XHTML output |
576
577
### Security Warning
578
579
⚠️ **gomarkdown does NOT sanitize output HTML.** For untrusted input, use Bluemonday:
580
581
```go
582
import (
583
"github.com/microcosm-cc/bluemonday"
584
"github.com/gomarkdown/markdown"
585
)
586
587
maybeUnsafeHTML := markdown.ToHTML(md, nil, nil)
588
html := bluemonday.UGCPolicy().SanitizeBytes(maybeUnsafeHTML)
589
```
590
591
Recommended sanitizer: [Bluemonday](https://github.com/microcosm-cc/bluemonday)
592
593
### Supported Markdown Flavors
594
595
| Flavor | Support |
596
|--------|---------|
597
| Original Markdown | 100% |
598
| CommonMark | High (with extensions) |
599
| GitHub Flavored Markdown | High (tables, fenced code, strikethrough) |
600
| MathJax/LaTeX Math | Supported via extension |
601
| Mmark | Supported |
602
603
### Troubleshooting
604
605
| Issue | Solution |
606
|-------|----------|
607
| Windows/Mac newlines not parsed | Use `parser.NormalizeNewlines(input)` |
608
| Tables not rendering | Enable `parser.Tables` extension |
609
| Code blocks without highlighting | Integrate with syntax highlighter like Chroma |
610
| Math not rendering | Enable `parser.MathJax` extension |
611
| XSS vulnerabilities | Use Bluemonday to sanitize output |
612
613
## Working with [`jekyll`](references/jekyll.md)
614
615
### Prerequisites
616
617
- Ruby version 2.7.0 or higher
618
- RubyGems
619
- GCC and Make (for native extensions)
620
- Install Jekyll and Bundler: `gem install jekyll bundler`
621
622
### Quick Conversion Methods
623
624
#### Method 1: Create New Site
625
626
```bash
627
# Create a new Jekyll site
628
jekyll new myblog
629
630
# Change to site directory
631
cd myblog
632
633
# Build and serve locally
634
bundle exec jekyll serve
635
636
# Access at http://localhost:4000
637
```
638
639
#### Method 2: Build Static Site
640
641
```bash
642
# Build site to _site directory
643
bundle exec jekyll build
644
645
# Build with production environment
646
JEKYLL_ENV=production bundle exec jekyll build
647
```
648
649
#### Method 3: Live Reload Development
650
651
```bash
652
# Serve with live reload
653
bundle exec jekyll serve --livereload
654
655
# Serve with drafts
656
bundle exec jekyll serve --drafts
657
```
658
659
### CLI Configuration
660
661
| Command | Description |
662
|---------|-------------|
663
| `jekyll new <path>` | Create new Jekyll site |
664
| `jekyll build` | Build site to `_site` directory |
665
| `jekyll serve` | Build and serve locally |
666
| `jekyll clean` | Remove generated files |
667
| `jekyll doctor` | Check for configuration issues |
668
669
| Serve Options | Description |
670
|---------------|-------------|
671
| `--livereload` | Reload browser on changes |
672
| `--drafts` | Include draft posts |
673
| `--port <port>` | Set server port (default: 4000) |
674
| `--host <host>` | Set server host (default: localhost) |
675
| `--baseurl <url>` | Set base URL |
676
677
### Security Warning
678
679
⚠️ **Jekyll security considerations:**
680
681
- Avoid using `safe: false` in production
682
- Use `exclude` in `_config.yml` to prevent sensitive files from being published
683
- Sanitize user-generated content if accepting external input
684
- Keep Jekyll and plugins updated
685
686
```yaml
687
# _config.yml security settings
688
exclude:
689
- Gemfile
690
- Gemfile.lock
691
- node_modules
692
- vendor
693
```
694
695
### Supported Markdown Flavors
696
697
| Flavor | Support |
698
|--------|---------|
699
| Kramdown (default) | 100% |
700
| CommonMark | Via plugin (jekyll-commonmark) |
701
| GitHub Flavored Markdown | Via plugin (jekyll-commonmark-ghpages) |
702
| RedCarpet | Via plugin (deprecated) |
703
704
Configure markdown processor in `_config.yml`:
705
706
```yaml
707
markdown: kramdown
708
kramdown:
709
input: GFM
710
syntax_highlighter: rouge
711
```
712
713
### Troubleshooting
714
715
| Issue | Solution |
716
|-------|----------|
717
| Ruby 3.0+ fails to serve | Run `bundle add webrick` |
718
| Gem dependency errors | Run `bundle install` |
719
| Slow builds | Use `--incremental` flag |
720
| Liquid syntax errors | Check for unescaped `{` in content |
721
| Plugin not loading | Add to `_config.yml` plugins list |
722
723
## Working with [`hugo`](references/hugo.md)
724
725
### Prerequisites
726
727
- Hugo installed (download from <https://gohugo.io/installation/>)
728
- Git (recommended for themes and modules)
729
- Go (optional, for Hugo Modules)
730
731
### Quick Conversion Methods
732
733
#### Method 1: Create New Site
734
735
```bash
736
# Create a new Hugo site
737
hugo new site mysite
738
739
# Change to site directory
740
cd mysite
741
742
# Add a theme
743
git init
744
git submodule add https://github.com/theNewDynamic/gohugo-theme-ananke themes/ananke
745
echo "theme = 'ananke'" >> hugo.toml
746
747
# Create content
748
hugo new content posts/my-first-post.md
749
750
# Start development server
751
hugo server -D
752
```
753
754
#### Method 2: Build Static Site
755
756
```bash
757
# Build site to public directory
758
hugo
759
760
# Build with minification
761
hugo --minify
762
763
# Build for specific environment
764
hugo --environment production
765
```
766
767
#### Method 3: Development Server
768
769
```bash
770
# Start server with drafts
771
hugo server -D
772
773
# Start with live reload and bind to all interfaces
774
hugo server --bind 0.0.0.0 --baseURL http://localhost:1313/
775
776
# Start with specific port
777
hugo server --port 8080
778
```
779
780
### CLI Configuration
781
782
| Command | Description |
783
|---------|-------------|
784
| `hugo new site <name>` | Create new Hugo site |
785
| `hugo new content <path>` | Create new content file |
786
| `hugo` | Build site to `public` directory |
787
| `hugo server` | Start development server |
788
| `hugo mod init` | Initialize Hugo Modules |
789
790
| Build Options | Description |
791
|---------------|-------------|
792
| `-D, --buildDrafts` | Include draft content |
793
| `-E, --buildExpired` | Include expired content |
794
| `-F, --buildFuture` | Include future-dated content |
795
| `--minify` | Minify output |
796
| `--gc` | Run garbage collection after build |
797
| `-d, --destination <path>` | Output directory |
798
799
| Server Options | Description |
800
|----------------|-------------|
801
| `--bind <ip>` | Interface to bind to |
802
| `-p, --port <port>` | Port number (default: 1313) |
803
| `--liveReloadPort <port>` | Live reload port |
804
| `--disableLiveReload` | Disable live reload |
805
| `--navigateToChanged` | Navigate to changed content |
806
807
### Security Warning
808
809
⚠️ **Hugo security considerations:**
810
811
- Configure security policy in `hugo.toml` for external commands
812
- Use `--enableGitInfo` carefully with public repositories
813
- Validate shortcode parameters for user-generated content
814
815
```toml
816
# hugo.toml security settings
817
[security]
818
enableInlineShortcodes = false
819
[security.exec]
820
allow = ['^go$', '^npx$', '^postcss$']
821
[security.funcs]
822
getenv = ['^HUGO_', '^CI$']
823
[security.http]
824
methods = ['(?i)GET|POST']
825
urls = ['.*']
826
```
827
828
### Supported Markdown Flavors
829
830
| Flavor | Support |
831
|--------|---------|
832
| Goldmark (default) | 100% (CommonMark compliant) |
833
| GitHub Flavored Markdown | Full (tables, strikethrough, autolinks) |
834
| CommonMark | 100% |
835
| Blackfriday (legacy) | Deprecated, not recommended |
836
837
Configure markdown in `hugo.toml`:
838
839
```toml
840
[markup]
841
[markup.goldmark]
842
[markup.goldmark.extensions]
843
definitionList = true
844
footnote = true
845
linkify = true
846
strikethrough = true
847
table = true
848
taskList = true
849
[markup.goldmark.renderer]
850
unsafe = false # Set true to allow raw HTML
851
```
852
853
### Troubleshooting
854
855
| Issue | Solution |
856
|-------|----------|
857
| "Page not found" on paths | Check `baseURL` in config |
858
| Theme not loading | Verify theme in `themes/` or Hugo Modules |
859
| Slow builds | Use `--templateMetrics` to identify bottlenecks |
860
| Raw HTML not rendering | Set `unsafe = true` in goldmark config |
861
| Images not loading | Check `static/` folder structure |
862
| Module errors | Run `hugo mod tidy` |
863
864
## References
865
866
### Writing and Styling Markdown
867
868
- [basic-markdown.md](references/basic-markdown.md)
869
- [code-blocks.md](references/code-blocks.md)
870
- [collapsed-sections.md](references/collapsed-sections.md)
871
- [tables.md](references/tables.md)
872
- [writing-mathematical-expressions.md](references/writing-mathematical-expressions.md)
873
- Markdown Guide: <https://www.markdownguide.org/basic-syntax/>
874
- Styling Markdown: <https://github.com/sindresorhus/github-markdown-css>
875
876
### [`markedJS/marked`](references/marked.md)
877
878
- Official documentation: <https://marked.js.org/>
879
- Advanced options: <https://marked.js.org/using_advanced>
880
- Extensibility: <https://marked.js.org/using_pro>
881
- GitHub repository: <https://github.com/markedjs/marked>
882
883
### [`pandoc`](references/pandoc.md)
884
885
- Getting started: <https://pandoc.org/getting-started.html>
886
- Official documentation: <https://pandoc.org/MANUAL.html>
887
- Extensibility: <https://pandoc.org/extras.html>
888
- GitHub repository: <https://github.com/jgm/pandoc>
889
890
### [`gomarkdown/markdown`](references/gomarkdown.md)
891
892
- Official documentation: <https://pkg.go.dev/github.com/gomarkdown/markdown>
893
- Advanced configuration: <https://pkg.go.dev/github.com/gomarkdown/markdown@v0.0.0-20250810172220-2e2c11897d1a/html>
894
- Markdown processing: <https://blog.kowalczyk.info/article/cxn3/advanced-markdown-processing-in-go.html>
895
- GitHub repository: <https://github.com/gomarkdown/markdown>
896
897
### [`jekyll`](references/jekyll.md)
898
899
- Official documentation: <https://jekyllrb.com/docs/>
900
- Configuration options: <https://jekyllrb.com/docs/configuration/options/>
901
- Plugins: <https://jekyllrb.com/docs/plugins/>
902
- [Installation](https://jekyllrb.com/docs/plugins/installation/)
903
- [Generators](https://jekyllrb.com/docs/plugins/generators/)
904
- [Converters](https://jekyllrb.com/docs/plugins/converters/)
905
- [Commands](https://jekyllrb.com/docs/plugins/commands/)
906
- [Tags](https://jekyllrb.com/docs/plugins/tags/)
907
- [Filters](https://jekyllrb.com/docs/plugins/filters/)
908
- [Hooks](https://jekyllrb.com/docs/plugins/hooks/)
909
- GitHub repository: <https://github.com/jekyll/jekyll>
910
911
### [`hugo`](references/hugo.md)
912
913
- Official documentation: <https://gohugo.io/documentation/>
914
- All Settings: <https://gohugo.io/configuration/all/>
915
- Editor Plugins: <https://gohugo.io/tools/editors/>
916
- GitHub repository: <https://github.com/gohugoio/hugo>
917

© GitHub, Inc. · MIT · source · posted by @OpenSourceBuffGuy on promptparty.com

@OpenSourceBuffGuy

I find openly licensed prompts and post them here.

0 followers · 14,621 prompts

More by @OpenSourceBuffGuy

See all
Sea turtle carrying floating film studio island prompt image

Sea turtle carrying floating film studio island

Draws a giant sea turtle carrying a floating island film studio through a starry sky, where fairies polish rough film strips into golden film.

image-prompt, nano-banana, 3d-render, cartoon, fantasy-world, creatures, animals, whimsical, dreamy, cinematic, dramatic-lighting, vibrant-colors, bokeh, miniature, widescreen, night-scene, illustration, concept-art, surreal, storytelling, clay-3d

Desert buggy escapes drones past industrial outpost prompt image

Desert buggy escapes drones past industrial outpost

Builds a 15-second desert chase video where a racer in an armored buggy escapes drones past an industrial outpost, using five reference images with set jobs.

video-prompt, hailuo, action, multi-shot, timed-beats, camera-movement, reference-image, character-consistency, negative-prompt, cinematic, sci-fi, cars, landscape, aerial-view, tracking-shot, photorealistic, sound-effects, structured-output, long-form, widescreen

1 view
Cozy Pixel Art Farm Island Village prompt image

Cozy Pixel Art Farm Island Village

Draws a cozy 16-bit pixel-art farming village across six small islands joined by bridges, with exact counts for buildings, animals and crops.

image-prompt, gpt-image, pixel-art, isometric, game-assets, concept-art, maps, worldbuilding, cozy, vibrant-colors, ocean, landscape, wide-shot, widescreen, game-development, video-games, structured-output, whimsical, summer, high-angle, aerial-view, animals, negative-prompt, cityscape

1 view

Reviews

Loading reviews…

Discussion

Loading comments…