summaryrefslogtreecommitdiffstats
path: root/markup
AgeCommit message (Collapse)Author
2024-05-14Create pages from _content.gotmplBjørn Erik Pedersen
Closes #12427 Closes #12485 Closes #6310 Closes #5074
2024-05-10markup/goldmark: Support extras extensionJoe Mooring
Enables inclusion of these HTML elements in Markdown: - Inserted Text (++inserted++) - Mark Text (==marked==) - Subscript (H~2~O) - Superscript (1^st^)
2024-04-22markup/goldmark: Fix data race in the hugocontext wrapperBjørn Erik Pedersen
The window for this to happen is very small, but it has been reported by Go's race detector (-race flag) in a tests once.
2024-04-15Pass .RenderShortcodes' Page to render hooks as .PageInnerBjørn Erik Pedersen
The main use case for this is to resolve links and resources (e.g. images) relative to the included `Page`. A typical `include` would similar to this: ```handlebars {{ with site.GetPage (.Get 0) }} {{ .RenderShortcodes }} {{ end }} ``` And when used in a Markdown file: ```markdown {{% include "/posts/p1" %}} ``` Any render hook triggered while rendering `/posts/p1` will get `/posts/p1` when calling `.PageInner`. Note that * This is only relevant for shortcodes included with `{{%` that calls `.RenderShortcodes`. * `.PageInner` is available in all render hooks that, before this commit, received `.Page`. * `.PageInner` will fall back to the value of `.Page` if not relevant and will always have a value. Fixes #12356
2024-04-11all: Fix duplicate words in commentsEitan Adler
2024-04-11all: Typo fixesChristian Oliff
2024-03-21markup/asciidocext: Add Level to Heading structJoe Mooring
Closes #12291
2024-03-16deps: Upgrade github.com/gohugoio/hugo-goldmark-extensions/passthrough ↵Bjørn Erik Pedersen
v0.1.0 => v0.2.0
2024-03-15all: Typo fixesChristian Oliff
2024-03-07markup/goldmark: TOC: render strikethrough, emojisJonas Zeiger
Configure the TOC (TableOfContents, toc.go) goldmark renderer to always enable the Strikethrough and Emoji extensions. This allows handling ast.KindStrikethrough and ast.KindEmoji AST nodes when rendering the TOC. Fixes #7169 Fixes #11783 Fixes #12022
2024-02-18all: Fix typos and some URLsChristian Oliff
2024-02-10markup/goldmark: Update TOC testJoe Mooring
- Change copyright date - Change name of site configuration file - Reference issue numbers in failing tests
2024-02-10markup/goldmark: Improve TOC testsJoe Mooring
2024-01-30Create default link and image render hooksBjørn Erik Pedersen
Fixes #11933
2024-01-28all: Run gofumpt -l -w .Bjørn Erik Pedersen
2024-01-28testing: Simplify some integration testsBjørn Erik Pedersen
2024-01-28testing: Rename integration_test.go to PACKAGE_integration_test.goBjørn Erik Pedersen
Primary motivation making them easier to find in the code editor.
2024-01-27all: Rework page store, add a dynacache, improve partial rebuilds, and some ↵develop2024Bjørn Erik Pedersen
general spring cleaning There are some breaking changes in this commit, see #11455. Closes #11455 Closes #11549 This fixes a set of bugs (see issue list) and it is also paying some technical debt accumulated over the years. We now build with Staticcheck enabled in the CI build. The performance should be about the same as before for regular sized Hugo sites, but it should perform and scale much better to larger data sets, as objects that uses lots of memory (e.g. rendered Markdown, big JSON files read into maps with transform.Unmarshal etc.) will now get automatically garbage collected if needed. Performance on partial rebuilds when running the server in fast render mode should be the same, but the change detection should be much more accurate. A list of the notable new features: * A new dependency tracker that covers (almost) all of Hugo's API and is used to do fine grained partial rebuilds when running the server. * A new and simpler tree document store which allows fast lookups and prefix-walking in all dimensions (e.g. language) concurrently. * You can now configure an upper memory limit allowing for much larger data sets and/or running on lower specced PCs. We have lifted the "no resources in sub folders" restriction for branch bundles (e.g. sections). Memory Limit * Hugos will, by default, set aside a quarter of the total system memory, but you can set this via the OS environment variable HUGO_MEMORYLIMIT (in gigabytes). This is backed by a partitioned LRU cache used throughout Hugo. A cache that gets dynamically resized in low memory situations, allowing Go's Garbage Collector to free the memory. New Dependency Tracker: Hugo has had a rule based coarse grained approach to server rebuilds that has worked mostly pretty well, but there have been some surprises (e.g. stale content). This is now revamped with a new dependency tracker that can quickly calculate the delta given a changed resource (e.g. a content file, template, JS file etc.). This handles transitive relations, e.g. $page -> js.Build -> JS import, or $page1.Content -> render hook -> site.GetPage -> $page2.Title, or $page1.Content -> shortcode -> partial -> site.RegularPages -> $page2.Content -> shortcode ..., and should also handle changes to aggregated values (e.g. site.Lastmod) effectively. This covers all of Hugo's API with 2 known exceptions (a list that may not be fully exhaustive): Changes to files loaded with template func os.ReadFile may not be handled correctly. We recommend loading resources with resources.Get Changes to Hugo objects (e.g. Page) passed in the template context to lang.Translate may not be detected correctly. We recommend having simple i18n templates without too much data context passed in other than simple types such as strings and numbers. Note that the cachebuster configuration (when A changes then rebuild B) works well with the above, but we recommend that you revise that configuration, as it in most situations should not be needed. One example where it is still needed is with TailwindCSS and using changes to hugo_stats.json to trigger new CSS rebuilds. Document Store: Previously, a little simplified, we split the document store (where we store pages and resources) in a tree per language. This worked pretty well, but the structure made some operations harder than they needed to be. We have now restructured it into one Radix tree for all languages. Internally the language is considered to be a dimension of that tree, and the tree can be viewed in all dimensions concurrently. This makes some operations re. language simpler (e.g. finding translations is just a slice range), but the idea is that it should also be relatively inexpensive to add more dimensions if needed (e.g. role). Fixes #10169 Fixes #10364 Fixes #10482 Fixes #10630 Fixes #10656 Fixes #10694 Fixes #10918 Fixes #11262 Fixes #11439 Fixes #11453 Fixes #11457 Fixes #11466 Fixes #11540 Fixes #11551 Fixes #11556 Fixes #11654 Fixes #11661 Fixes #11663 Fixes #11664 Fixes #11669 Fixes #11671 Fixes #11807 Fixes #11808 Fixes #11809 Fixes #11815 Fixes #11840 Fixes #11853 Fixes #11860 Fixes #11883 Fixes #11904 Fixes #7388 Fixes #7425 Fixes #7436 Fixes #7544 Fixes #7882 Fixes #7960 Fixes #8255 Fixes #8307 Fixes #8863 Fixes #8927 Fixes #9192 Fixes #9324
2024-01-26markup/goldmark: Support passthrough extensionJeremy Kun
Fixes #10894
2023-12-18all: Remove unused codeBjørn Erik Pedersen
Using x/tools/cmd/deadcode
2023-12-04markup: Add Level to Heading structJoe Mooring
Closes #10776
2023-11-30deps: Update github.com/tdewolff/minify/v2 v2.20.7 => v2.20.8Joe Mooring
Closes #5748
2023-11-16markup/goldmark: Sync image render hook code with GoldmarkJoe Mooring
Fixes #11681
2023-10-29markup/goldmark: Update the CJK extension to allow specifying line break stylesOMOTO Tsukasa
This commit follows https://github.com/yuin/goldmark/pull/411
2023-10-24markdown: Pass emoji codes to yuin/goldmark-emojiJoe Mooring
Removes emoji code conversion from the page and shortcode parsers. Emoji codes in markdown are now passed to Goldmark, where the goldmark-emoji extension converts them to decimal numeric character references. This disables emoji rendering for the alternate content formats: html, asciidoc, org, pandoc, and rst. Fixes #7332 Fixes #11587 Closes #11598
2023-10-09markup/tableofcontents: Return template.HTML from .Fragments.ToHTMLJoe Mooring
Closes #11545
2023-08-30markup/goldmark: Add CJK extensionOMOTO Tsukasa
Fixes #10472
2023-08-07Add all config to docshelper.jsonBjørn Erik Pedersen
Also consolidate so the mediaTypes and outputFormats are listed once only. Fixes #11328
2023-07-31deps: Fix Chroma dependency versionJoe Mooring
Fixes #11311
2023-06-28Don't panic on invalid security whitelist regexpBjørn Erik Pedersen
Fixes #11176
2023-06-18Replace the old log setup, with structured logging etc.Bjørn Erik Pedersen
Fixes #11124
2023-06-01markup: Fix typo in function and struct namesOleksandr Redko
2023-05-30Prevent double escaping of image alt-text in Goldmar typographerBjørn Erik Pedersen
Fixes #11045
2023-05-18all: Fix comments for exported functions and packagesOleksandr Redko
2023-05-16Create a struct with all of Hugo's config optionsBjørn Erik Pedersen
Primary motivation is documentation, but it will also hopefully simplify the code. Also, * Lower case the default output format names; this is in line with the custom ones (map keys) and how it's treated all the places. This avoids doing `stringds.EqualFold` everywhere. Closes #10896 Closes #10620
2023-04-12markup/goldmark: Add config options for the typographer extensionBjørn Erik Pedersen
Note that the config per language part of this will be handled in #10602. Updates #9772
2023-03-15markup/goldmark: Fail on invalid Markdown attributesBjørn Erik Pedersen
2023-03-12deps: Update go-org to v1.6.6Niklas Fasching
among other things, fixes a race condition in html writer and bug preventing explicit line breaks immediately following emphasis
2023-03-02Correct typos in Go commentsOleksandr Redko
2023-02-25Add a page template funcBjørn Erik Pedersen
Fixes #9339
2023-02-24Split parse and render for GoldmarkBjørn Erik Pedersen
This also speeds up situations where you only need the fragments/toc and not the rendered content, e.g. Related with fragments type indexing: ```bash name old time/op new time/op delta RelatedSite-10 12.3ms ± 2% 10.7ms ± 1% -12.95% (p=0.029 n=4+4) name old alloc/op new alloc/op delta RelatedSite-10 38.6MB ± 0% 38.2MB ± 0% -1.08% (p=0.029 n=4+4) name old allocs/op new allocs/op delta RelatedSite-10 117k ± 0% 115k ± 0% -1.36% (p=0.029 n=4+4) ``` Fixes #10750
2023-02-22tpl/internal: Sync Go template src to Go 1.20Bjørn Erik Pedersen
Updates #10691
2023-02-21Add page fragments support to RelatedBjørn Erik Pedersen
The main topic of this commit is that you can now index fragments (content heading identifiers) when calling `.Related`. You can do this by: * Configure one or more indices with type `fragments` * The name of those index configurations maps to an (optional) front matter slice with fragment references. This allows you to link page<->fragment and page<->page. * This also will index all the fragments (heading identifiers) of the pages. It's also possible to use type `fragments` indices in shortcode, e.g.: ``` {{ $related := site.RegularPages.Related .Page }} ``` But, and this is important, you need to include the shortcode using the `{{<` delimiter. Not doing so will create infinite loops and timeouts. This commit also: * Adds two new methods to Page: Fragments (can also be used to build ToC) and HeadingsFiltered (this is only used in Related Content with index type `fragments` and `enableFilter` set to true. * Consolidates all `.Related*` methods into one, which takes either a `Page` or an options map as its only argument. * Add `context.Context` to all of the content related Page API. Turns out it wasn't strictly needed for this particular feature, but it will soon become usefil, e.g. in #9339. Closes #10711 Updates #9339 Updates #10725
2023-02-05markup: Fix linenos codeblock hl option case regressionKhayyam Saleem
This fixes a regression introduced in v0.93.0 where previously, a mixed-case key for lineNos would be successfully parsed. This change moves the configuration key lowercasing step into the configuration normalization stage, which is called whether the highlighting config is being parsed from a `string` or a `map`. Fixes #10682
2023-01-04Misc doc, code refactoring to improve documentationBjørn Erik Pedersen
2022-12-05markup/goldmark: Add removeSurroundingParagraph for Markdown imagesBjørn Erik Pedersen
* Removes any surrounding paragraph nodes * And transfers any attributes from the surrounding paragraph down to the image node * Adds IsBlock and Ordinal (zero based) field to the image context passed to the image render hooks IsBlock is set to true if `wrapStandAloneImageWithinParagraph = false` and the image's parent node has only one child. Closes #8362 Fixes #10492 Fixes #10494 Fixes #10501
2022-11-24Add a cache for lexers.GetBjørn Erik Pedersen
``` name old time/op new time/op delta Codeblocks/Default-10 152ms ±11% 12ms ± 1% -92.44% (p=0.029 n=4+4) Codeblocks/Hook_no_higlight-10 142ms ± 0% 7ms ± 0% -95.36% (p=0.029 n=4+4) name old alloc/op new alloc/op delta Codeblocks/Default-10 11.9MB ± 0% 11.7MB ± 0% -1.59% (p=0.029 n=4+4) Codeblocks/Hook_no_higlight-10 4.62MB ± 1% 4.43MB ± 0% -4.08% (p=0.029 n=4+4) name old allocs/op new allocs/op delta Codeblocks/Default-10 209k ± 0% 209k ± 0% -0.03% (p=0.029 n=4+4) Codeblocks/Hook_no_higlight-10 68.4k ± 0% 68.3k ± 0% -0.06% (p=0.029 n=4+4) ```
2022-11-24markup/goldmark: Improve benchmarkBjørn Erik Pedersen
2022-11-19deps: Upgrade github.com/alecthomas/chroma/v2 v2.4.0Bjørn Erik Pedersen
2022-08-03markup/goldmark/codeblock: Fix attributes when no language identifier in ↵piyo
CodeBlock Fixes #10118