summaryrefslogtreecommitdiffstats
path: root/markup
AgeCommit message (Collapse)Author
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
2022-06-15markup/highlight: Add hl_inline optionBjørn Erik Pedersen
Closes #9442 Closes #9635 Closes #9638
2022-06-14deps: Udpate to github.com/alecthomas/chroma/v2Bjørn Erik Pedersen
Fixes #9932 Fixes #9931
2022-06-04helpers: Fix panic with invalid defaultMarkdownHandlerBjørn Erik Pedersen
Fixes #9968
2022-05-29Remove Blackfriday markdown engineBjørn Erik Pedersen
It has been deprecated for a long time, its v1 version is not maintained anymore, and there are many known issues. Goldmark should be a mature replacement by now. Closes #9934
2022-05-15postcss: Fix import error handlingBjørn Erik Pedersen
Note that we will now fail if `inlineImports` is enabled and we cannot resolve an import. You can work around this by either: * Use url imports or imports with media queries. * Set `skipInlineImportsNotFound=true` in the options Also get the argument order in the different NewFileError* funcs in line. Fixes #9895
2022-05-14errors: Misc improvementsBjørn Erik Pedersen
* Redo the server error template * Always add the content file context if relevant * Remove some now superflous error string matching * Move the server error template to _server/error.html * Add file context (with position) to codeblock render blocks * Improve JS build errors Fixes #9892 Fixes #9891 Fixes #9893
2022-05-06Improve error messages, esp. when the server is runningBjørn Erik Pedersen
* Add file context to minifier errors when publishing * Misc fixes (see issues) * Allow custom server error template in layouts/server/error.html To get to this, this commit also cleans up and simplifies the code surrounding errors and files. This also removes the usage of `github.com/pkg/errors`, mostly because of https://github.com/pkg/errors/issues/223 -- but also because most of this is now built-in to Go. Fixes #9852 Fixes #9857 Fixes #9863
2022-04-27markup/goldmark: Fix attribute nilpointerBjørn Erik Pedersen
Fixes 9819
2022-04-27deps: Update github.com/yuin/goldmark v1.4.11 => v1.4.12Joe Mooring
Fixes #9054 Fixes #9756 Fixes #9757
2022-04-08Rework the Destination filesystem to make --renderStaticToDisk workBjørn Erik Pedersen
See #9626
2022-03-22Fix some typoscuishuang
Signed-off-by: cuishuang <imcusg@gmail.com> [foka@debian.org: Resolve merge conflict and squash 2 commits] Signed-off-by: Anthony Fok <foka@debian.org>
2022-03-17all: gofmt -w -r 'interface{} -> any' .Bjørn Erik Pedersen
Updates #9687
2022-03-12deps: Update github.com/yuin/goldmark v1.4.9 => v1.4.10Bjørn Erik Pedersen
Fixes #9658
2022-03-11deps: Fix Goldmark regression with HTML commentsBjørn Erik Pedersen
Fixes #9650
2022-03-10Revert "markup/highlight: Add hl_inline option"Bjørn Erik Pedersen
This reverts commit a360cab75a073c2a8d47dcd27f52a6847e8d8d13.
2022-03-10Fail with error when double-rendering text in markdownify/RenderStringBjørn Erik Pedersen
This commit prevents the most commons case of infinite recursion in link render hooks when the `linkify` option is enabled (see below). This is always a user error, but getting a `stack overflow` (the current stack limit in Go is 1 GB on 64-bit, 250 MB on 32-bit) error isn't very helpful. This fix will not prevent all such errors, though, but we may do better once #9570 is in place. So, these will fail: ``` <a href="{{ .Destination | safeURL }}" >{{ .Text | markdownify }}</a> <a href="{{ .Destination | safeURL }}" >{{ .Text | .Page.RenderString }}</a> ``` `.Text` is already rendered to `HTML`. The above needs to be rewritten to: ``` <a href="{{ .Destination | safeURL }}" >{{ .Text | safeHTML }}</a> <a href="{{ .Destination | safeURL }}" >{{ .Text | safeHTML }}</a> ``` Fixes #8959
2022-03-09markup/goldmark: Default to https for linkifyBjørn Erik Pedersen
Fixes #9639
2022-03-09markup/highlight: Add hl_inline optionBjørn Erik Pedersen
If set to true, the highlighted code will not be wrapped in any div. Closes #9442
2022-03-08markup/goldmark/codeblocks: Fix slice bounds out of rangeBjørn Erik Pedersen
For the Position in code blocks we try to match the .Inner with the original source. This isn't always possible. This commits avoids panics in these situations. Fixes #9627
2022-03-02markup/goldmark: Escape image alt attributeJoe Mooring
Fixes #9594
2022-03-02tpl/transform: Fix it when template.HTML is passes as option to HightlightBjørn Erik Pedersen
Fixes #9591
2022-02-28markup/highlight: Ignore HL_lines_parsed in the gen docsBjørn Erik Pedersen
2022-02-27tpl/diagrams: Rename the SVG accessor to WrappedBjørn Erik Pedersen
Not perfect, but it gets it in line with the other .Inner/.Wrapped combos.
2022-02-27markup/highlight: Rework the return value from HighlightCodeblockBjørn Erik Pedersen
To make it possible to render it with a custom HTML ("<div>") wrapper. Updates #9573
2022-02-27CodeblockContext method renamesBjørn Erik Pedersen
Fixes #9577
2022-02-26markup/goldmark: Adjust test for WindowsBjørn Erik Pedersen
2022-02-26markup/goldmark: Improve attributes vs optionsBjørn Erik Pedersen
Fixes #9571
2022-02-26markup/goldmark: Add Position to CodeblockContextBjørn Erik Pedersen
But note that this is not particulary fast and the recommendad usage is error logging only. Updates #9574