feat(hook): support table render hook#1034
Open
eureka0928 wants to merge 1 commit intodillonzq:masterfrom
Open
feat(hook): support table render hook#1034eureka0928 wants to merge 1 commit intodillonzq:masterfrom
eureka0928 wants to merge 1 commit intodillonzq:masterfrom
Conversation
Replace default table rendering with Hugo's table render hook (available since v0.134.0) for server-side table markup generation. - Add render-table.html hook delegating to plugin/table.html partial - Wrap tables in .table-wrapper div for proper horizontal scrolling - Apply text alignment via inline styles from Markdown column alignment - Move overflow-x and scrollbar styles from table to .table-wrapper - Bump minimum Hugo version to 0.134.0 Closes dillonzq#1015
✅ Deploy Preview for hugo-loveit ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Author
|
Hi @dillonzq how are you? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
render-table.html) to generate table markup at build time, replacing Hugo's default table rendering.table-wrapperdiv for proper horizontal scrolling on narrow viewportsCloses #1015
Changes
layouts/_markup/render-table.html– Render hook entry point, delegates to partiallayouts/_partials/plugin/table.html– Table template using.THead/.TBodycontext with alignment support and Markdown attribute passthroughassets/css/_page/_single.scss– Add.table-wrapperwithoverflow-x: autoand scrollbar styles; keeptablebase styles unchangedhugo.toml/theme.toml– Bump minimum Hugo version to0.134.0(required for table render hooks)Verification
Build the example site and inspect the HTML output:
hugo --source exampleSite --themesDir ../.. grep -B 1 -A 5 '<table' exampleSite/public/basic-markdown-syntax/index.htmlTables are now wrapped in
<div class="table-wrapper">and alignment styles (text-align: center,text-align: right) are applied to cells.Screenshots