Commit graph

28 commits

Author SHA1 Message Date
Bjørn Erik Pedersen
ebdd8cba3f
helpers: Avoid unescape in highlight
Fixes #4219
2018-01-23 09:48:04 +01:00
Bjørn Erik Pedersen
fb33d8286d Use Chroma as new default syntax highlighter
If you want to use Pygments, set `pygmentsUseClassic=true` in your site config.

Fixes #3888
2017-09-25 08:59:02 +02:00
Daniel Karlsson
c8257f8b72 Render task list item inside label for correct accessibility
Fixes #3303
2017-08-09 20:09:43 +02:00
Bjørn Erik Pedersen
f768c27f0d helpers: Remove some unused funcs 2017-08-03 15:59:10 +02:00
Jorin Vogel
81c13171a9 Add some missing doc comments
As pointed out by the linter, some exported functions and types are
missing doc comments.
The linter warnings have been reduced from 194 to 116.
Not all missing comments have been added in this commit though.
2017-08-03 15:57:51 +02:00
Bjørn Erik Pedersen
9891c0fb0e Remove sourceRelativeLinks
Fixes #3766
2017-08-02 22:04:38 +02:00
Abdullah Diab
481924b34d helpers: Fix broken TaskList in Markdown
As per the referenced issue, if the task list in Markdown has
nothing before it, it will be rendered wrongly:

```
---
title: "My First Post"
date: 2017-07-29T20:21:57+02:00
draft: true
---

* [ ] TaskList

```

is rendered as:

```
<ul> class="task-list"
<li><input type="checkbox" disabled class="task-list-item"> TaskList</li>
</ul>
```

The problem lies in the `List` function of `HugoHTMLRenderer`, it had
a hardocded index of `4` for the first `>` of the list, it is used to
insert the class into the text before the closing bracket, but that
hardcoded index is only right when there is a newline before the
opening bracket, which is the case when there is anything in the
document before the task list, but if there is nothing, then there is
no newline, and the correct index of the first `>` will be `3`.

To fix that we're changing the hardcoded index to be dynamic by using
`bytes.Index` to find it properly. We're also adding a test case to
make sure this is tested against.

Fixes #3710
2017-08-02 00:33:37 +02:00
Bjørn Erik Pedersen
873a6f1885 Run gofmt to get imports in line vs gohugoio/hugo 2017-06-13 19:12:10 +02:00
Bjørn Erik Pedersen
d8717cd4c7 all: Update import paths to gohugoio/hugo 2017-06-13 18:42:45 +02:00
Bjørn Erik Pedersen
93ca7c9e95 all: Refactor to nonglobal Viper, i18n etc.
This is a final rewrite that removes all the global state in Hugo, which also enables
the use if `t.Parallel` in tests.

Updates #2701
Fixes #3016
2017-02-17 17:15:26 +01:00
Albert Nigmatzianov
f21e2f25c9 all: Unify case of config variable names
All config variables starts with low-case and uses camelCase.

If there is abbreviation at the beginning of the name, the whole
abbreviation will be written in low-case.
If there is abbreviation at the end of the name, the
whole abbreviation will be written in upper-case.
For example, rssURI.
2016-10-24 20:56:00 +02:00
Bjørn Erik Pedersen
eaf2f9bce5 Add TODO list support for Blackfriday
* Add CSS class to TODO list and list items
* Add a flag to turn task list support off

Fixes #2269
2016-09-09 13:08:20 +02:00
Bjørn Erik Pedersen
76bf2dcdd2 Fix shortcode vs pygments
This is the nth attempt to fix an issue by changing the placeholder token pattern, but
now we actually have tests for all the historic trouble cases.

Fixes #2223
2016-09-08 21:23:01 +02:00
Bjørn Erik Pedersen
91b61b976d Simplify the configuration of HugoHTMLRenderer 2016-07-22 11:00:52 +02:00
Bjørn Erik Pedersen
34f40044d7 Fix shortcode in markdown headers
This issue was introduced as a fix to shortcode not working in RST.

One could argue that Blackfriday and friends should handle `#` in titles, but that will be a discussion
for another day.

The new placeholder pattern should be RST safe and work with titles.

And now with a test so this doesn't break again.

Fixes #2192
Fixes #2209
Closes #2210
2016-06-15 09:12:07 +02:00
Sven Dowideit
1648e327c0 Document and clean SourceRelativeLinksEval code 2016-04-07 20:10:38 +02:00
Philipp Oppermann
43b5dfabb5 Disable syntax guessing for PygmentsCodeFences by default
This disables highlighting for fenced code blocks without explicitly specified language. It also introduces a new `PygmentsCodeFencesGuessSyntax` config option (defaulting to false).

To enable syntax guessing again, add the following to your config file: `PygmentsCodeFencesGuessSyntax = true`

This is a breaking change.
2016-04-04 22:19:36 +02:00
digitalcraftsman
5d3705df16 helpers: Apply GoLint rules 2016-03-24 23:16:18 +01:00
Bjørn Erik Pedersen
5b065a27a2 Some missing shortcode replacements
See #1904
2016-03-01 13:51:46 +01:00
Bjørn Erik Pedersen
7f682d7802 Fix shortcode handling in RST
Fixes #1904
2016-03-01 11:04:25 +01:00
Sven Dowideit
0f6b334b67 Source file based relative linking
ala GitHub repository markdown for both md files and non-md files

Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2016-01-01 15:23:11 -05:00
Anthony Fok
8509727fe8 Add copyright header to that source files that don’t have one.
See #1646
2015-12-10 15:19:38 -07:00
Andrew Brampton
c3931ef748 Add PygmentsOptions option
This allows default pygments settings to be used, if none are explictly set per shortcode.

Fixes #1260
2015-11-23 17:50:54 +01:00
Bjørn Erik Pedersen
72f14a8202 Apply project wide go fmt 2015-10-12 20:47:06 +02:00
Andrew Brampton
c2c694f136 Add GitHub style code fence support to mmark
Fixes #1258.
2015-10-05 17:45:37 -04:00
Bjørn Erik Pedersen
b05a292c21 Revert "Fix some Go code doc issues"
This reverts commit de7dd70bbc.

Broke the code fence feat.
2015-08-07 20:09:40 +02:00
Bjørn Erik Pedersen
de7dd70bbc Fix some Go code doc issues 2015-08-06 22:58:10 +02:00
Andrew Brampton
c139c6e1ef Add support for GitHub-flavoured markdown code fences for highlighting
This commit adds a new PygmentsCodeFences config option (default false), which if true will allow GitHub style backtick code fences around code, which will then be rendered by Pygments.

For example:

``` language
your code
```

can be used instead of {{< highlight language >}}your code {{< /highlight >}}.

Fixes #362
2015-07-08 08:12:52 +02:00