Debian Codegraph @

docs/content/en/render-hooks/introduction.md

raw
1 ---
2 title: Introduction
3 description: An introduction to Hugo's render hooks.
4 categories: []
5 keywords: []
6 weight: 10
7 ---
8
9 When rendering Markdown to HTML, render hooks override the conversion. Each render hook is a template, with one template for each supported element type:
10
11 - [Blockquotes][]
12 - [Code blocks][]
13 - [Headings][]
14 - [Images][]
15 - [Links][]
16 - [Passthrough elements][]
17 - [Tables][]
18
19 > [!NOTE]
20 > Hugo supports multiple [content formats][] including Markdown, HTML, AsciiDoc, Emacs Org Mode, Pandoc, and reStructuredText.
21 >
22 > The render hook capability is limited to Markdown. You cannot create render hooks for the other content formats.
23
24 For example, consider this Markdown:
25
26 ```md
27 [Hugo](https://gohugo.io)
28
29 ![kitten](kitten.jpg)
30 ```
31
32 Without link or image render hooks, the example above is rendered to:
33
34 ```html
35 <p><a href="https://gohugo.io">Hugo</a></p>
36 <p><img alt="kitten" src="kitten.jpg"></p>
37 ```
38
39 By creating link and image render hooks, you can alter the conversion from Markdown to HTML. For example:
40
41 ```html
42 <p><a href="https://gohugo.io" rel="external">Hugo</a></p>
43 <p><img alt="kitten" src="kitten.jpg" width="600" height="400"></p>
44 ```
45
46 Each render hook is a template, with one template for each supported element type:
47
48 ```tree
49 layouts/
50 └── _markup/
51 ├── render-blockquote.html
52 ├── render-codeblock.html
53 ├── render-heading.html
54 ├── render-image.html
55 ├── render-link.html
56 ├── render-passthrough.html
57 └── render-table.html
58 ```
59
60 The template lookup order allows you to create different render hooks for each page [type](g), [kind](g), language, and [output format](g). For example:
61
62 ```tree
63 layouts/
64 ├── _markup/
65 │ ├── render-link.html
66 │ └── render-link.rss.xml
67 ├── books/
68 │ └── _markup/
69 │ ├── render-link.html
70 │ └── render-link.rss.xml
71 └── films/
72 └── _markup/
73 ├── render-link.html
74 └── render-link.rss.xml
75 ```
76
77 The remaining pages in this section describe each type of render hook, including examples and the context received by each template.
78
79 [Blockquotes]: /render-hooks/blockquotes/
80 [Code blocks]: /render-hooks/code-blocks/
81 [Headings]: /render-hooks/headings/
82 [Images]: /render-hooks/images/
83 [Links]: /render-hooks/links/
84 [Passthrough elements]: /render-hooks/passthrough/
85 [Tables]: /render-hooks/tables/
86 [content formats]: /content-management/formats/