Commit graph

12 commits

Author SHA1 Message Date
Karel Bilek
7cdc0fb06f Fix leading tabs with codeblocks
Note that this is a breaking change and will require new goldmark major version.

I have tried to fix problem with leading tabs in fenced code blocks (and probably normal code blocks too).

Important note - tabs do not behave like "just 4 spaces". They "finish" 4 space columns. So tab can behave like anything between 1 space to 4 spaces, depending on position.

If you have MD like this (. represents space, [tb] , [t] or [] tabs)

```
*.some.text
..```
..foo
..[]foo
..```
```

you expect the tab to be kept in the code. This did not work properly in goldmark and I fixed that.

However, if you have a code like this

```
*.some.text
..```
..foo
.[t]foo
..```
```

what should happen? I decided that it should be two spaces, as the tab is not "completely" in the code block. Similarly, what should happen in this case

```
*.some.text
..```
..foo
.[t][tb]foo
..```
```

I decided that it should be first three spaces and then tab. Not sure what even is the correct solution here...

The crux of the fix is - text segments don't have just padding, but also remember what chars is the padding and then print that, if they are called to do so in the code blocks. In other cases, the paddingChars are ignored.

This should fix #177 .
2021-01-29 14:55:55 +07:00
jsteuer
b91c802b8c html escape img alt attribute 2020-07-11 23:54:26 +02:00
yuin
3c3d4481ef Fixes #141 2020-07-02 15:44:34 +09:00
yuin
5ab7c64e28 Fixes #111 2020-03-08 17:55:02 +09:00
yuin
a727b5adb2 Fixes #103 2020-02-18 21:18:57 +09:00
jsteuer
3a828e641d move test to its correct place... 2020-02-16 18:07:23 +01:00
yuin
39db45a099 Fixes #94 2020-01-27 14:56:49 +09:00
yuin
26fb0b56e6 Fixes gohugoio/hugo#6626 2019-12-18 15:46:54 +09:00
yuin
ac8e225cd3 Fix invalid handling of consecutive code spans 2019-12-02 17:13:37 +09:00
yuin
2f292e5b74 Fixes #44, Fixes #45 2019-12-02 03:10:06 +09:00
yuin
8549b83b0c Fixes gohugoio/hugo#6549 2019-11-29 17:21:05 +09:00
LI Tao
6369ad43e8 Fix inaccurate indent calculation of list_item and add extra test to cover the case 2019-07-16 13:05:14 +08:00