summaryrefslogtreecommitdiffstats
path: root/docs/content/en/render-hooks/tables.md
diff options
context:
space:
mode:
Diffstat (limited to 'docs/content/en/render-hooks/tables.md')
-rwxr-xr-xdocs/content/en/render-hooks/tables.md66
1 files changed, 27 insertions, 39 deletions
diff --git a/docs/content/en/render-hooks/tables.md b/docs/content/en/render-hooks/tables.md
index d131664fc..c7671aff4 100755
--- a/docs/content/en/render-hooks/tables.md
+++ b/docs/content/en/render-hooks/tables.md
@@ -2,14 +2,8 @@
title: Table render hooks
linkTitle: Tables
description: Create a table render hook to override the rendering of Markdown tables to HTML.
-categories: [render hooks]
+categories: []
keywords: []
-menu:
- docs:
- parent: render-hooks
- weight: 90
-weight: 90
-toc: true
---
{{< new-in 0.134.0 />}}
@@ -18,50 +12,44 @@ toc: true
Table render hook templates receive the following [context](g):
-###### Attributes
+Attributes
+: (`map`) The [Markdown attributes], available if you configure your site as follows:
-(`map`) The [Markdown attributes], available if you configure your site as follows:
+ {{< code-toggle file=hugo >}}
+ [markup.goldmark.parser.attribute]
+ block = true
+ {{< /code-toggle >}}
-[Markdown attributes]: /content-management/markdown-attributes/
-
-{{< code-toggle file=hugo >}}
-[markup.goldmark.parser.attribute]
-block = true
-{{< /code-toggle >}}
+Ordinal
+: (`int`) The zero-based ordinal of the table on the page.
-###### Ordinal
+Page
+: (`page`) A reference to the current page.
-(`int`) The zero-based ordinal of the table on the page.
+PageInner
+: (`page`) A reference to a page nested via the [`RenderShortcodes`] method. [See details](#pageinner-details).
-###### Page
+Position
+: (`string`) The position of the table within the page content.
-(`page`) A reference to the current page.
+THead
+: (`slice`) A slice of table header rows, where each element is a slice of table cells.
-###### PageInner
-
-(`page`) A reference to a page nested via the [`RenderShortcodes`] method. [See details](#pageinner-details).
+TBody
+: (`slice`) A slice of table body rows, where each element is a slice of table cells.
+[Markdown attributes]: /content-management/markdown-attributes/
[`RenderShortcodes`]: /methods/page/rendershortcodes
-###### Position
-
-(`string`) The position of the table within the page content.
-
-###### THead
-(`slice`) A slice of table header rows, where each element is a slice of table cells.
-
-###### TBody
-(`slice`) A slice of table body rows, where each element is a slice of table cells.
-
## Table cells
Each table cell within the slice of slices returned by the `THead` and `TBody` methods has the following fields:
-###### Alignment
-(`string`) The alignment of the text within the table cell, one of `left`, `center`, or `right`.
+Alignment
+: (`string`) The alignment of the text within the table cell, one of `left`, `center`, or `right`.
-###### Text
-(`template.HTML`) The text within the table cell.
+Text
+: (`template.HTML`) The text within the table cell.
## Example
@@ -69,7 +57,7 @@ In its default configuration, Hugo renders Markdown tables according to the [Git
[GitHub Flavored Markdown specification]: https://github.github.com/gfm/#tables-extension-
-{{< code file=layouts/_default/_markup/render-table.html copy=true >}}
+```go-html-template {file="layouts/_default/_markup/render-table.html" copy=true}
<table
{{- range $k, $v := .Attributes }}
{{- if $v }}
@@ -107,6 +95,6 @@ In its default configuration, Hugo renders Markdown tables according to the [Git
{{- end }}
</tbody>
</table>
-{{< /code >}}
+```
-{{% include "/render-hooks/_common/pageinner.md" %}}
+{{% include "/_common/render-hooks/pageinner.md" %}}