Commit graph

61 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
yuin
6c741ae251 Fixes #176 2020-12-26 18:09:14 +09:00
Yusuke Inuzuka
748fc079dc
Merge pull request #172 from moorereason/typos
Fix typos in godocs comments
2020-12-26 18:02:24 +09:00
yuin
036c8738df Fixes #164, Fixes #167 2020-12-26 17:56:42 +09:00
Cameron Moore
5e417f871d Fix typos in godocs comments 2020-12-17 10:51:19 -06:00
yuin
9e0189df27 Closes #161
- Implement footnote configurations defined in original markdown extra.
- Add OwnerDocument() method to ast.Node
- Add Meta() method to *ast.Document
2020-12-13 23:11:07 +09:00
Helder Pereira
6de424ee3b Support URLs with port in Linkify 2020-09-19 14:48:35 +01:00
yuin
7b90f04af4 Refactoring 2020-08-26 20:22:51 +09:00
yuin
91e5269fb0 Fixes #148 2020-07-30 22:33:42 +09:00
yuin
bd58441cc1 Fixes #78 2020-07-21 19:32:52 +09:00
yuin
3c3d4481ef Fixes #141 2020-07-02 15:44:34 +09:00
yuin
feff0bb82b Add case=x,x.. aruguments for tests 2020-07-02 15:28:33 +09:00
yuin
33089e232f Improve typographer 2020-06-04 15:26:24 +09:00
yuin
4709d43b81 Fixes #127 2020-05-22 18:39:02 +09:00
yuin
3393022ab6 Fixes #39, Fixes #127, Fixes #128, Fixes #129 2020-05-21 18:13:20 +09:00
yuin
1f967da77c remove debug print 2020-04-16 00:29:11 +09:00
yuin
66874b397f Fixes #122 2020-04-15 11:16:46 +09:00
yuin
54b1e988cc Fixes #121 2020-04-13 18:44:57 +09:00
yuin
785b85a76a Fixes #115 2020-03-25 15:39:51 +09:00
Alexander Scheel
5c877c8afe
Insert space after task-list checkboxes
According to the GFM spec (and per other implementations), a space
should be inserted after the checkbox input element. This gives visual
separation between the checkbox and its element. Update code and tests
to match.

Signed-off-by: Alexander Scheel <alexander.m.scheel@gmail.com>
2020-03-07 21:14:45 -05:00
pzl
8bdab9449a
documentation typo fixes 2020-02-14 22:03:49 -05:00
Daniel Tang
45fa0e2645 typographer: add basic support for apostrophes 2020-01-09 15:35:41 -08:00
yuin
4b54582dee Fixes #83, Adds options for Linkify 2020-01-02 01:36:46 +09:00
Yusuke Inuzuka
2c9db0c8fa
Merge pull request #78 from zzwx-forks/master
Additional <thead>, <tr>, <th>, <td> attributes render
2019-12-26 12:02:50 +09:00
yuin
66a48f66b8 Fixes linkify regression.
https://github.github.com/gfm/#example-627 says '<' immediately ends an autolink.
But goldmark had continued to autolink with '<' due to recently changes.
2019-12-25 15:07:45 +09:00
zzwx
224bf7d721 Additional attributes render with comments 2019-12-24 19:37:21 -05:00
yuin
12851a08ba Fixes #70, #74 2019-12-22 22:27:39 +09:00
zzwx
5690da2615 Render table attributes 2019-12-20 19:52:09 -05:00
yuin
2aab93edb4 Fixes tests 2019-12-20 11:12:24 +09:00
yuin
e0171097bf Fixes #69 2019-12-20 11:11:28 +09:00
yuin
64d4e16bf4 Fixes #65 2019-12-18 11:37:07 +09:00
yuin
6d2e5fddae Fix #64 and some lint warnings 2019-12-16 11:08:45 +09:00
yuin
7d8bee11ca Closes #33 : Now NodeRenderers render attributes 2019-12-08 18:53:01 +09:00
yuin
171dbc66a8 Fixes #50 2019-12-05 13:39:55 +09:00
Nathan Galt
6f9629fb2b Improve display of footnote backlinks
This makes three changes to backlinks:

- Inserts a space before `<a href='…'>↩</a>` to make it look better
- Uses hexadecimal references (`&#x…;`) instead of decimal references for clarity
- Adds U+FE0E VARIATION SELECTOR 15 to the ↩ to suppress emojification on both iOS and Edge on Windows

If variation selector 15 isn't appended to the ↩, then the return arrow will show up as an emoji on iOS and Edge for Windows. The Pandoc project has already run into this quirk as documented on https://github.com/jgm/pandoc/issues/5469 and they've pushed a change for their Markdown processor already.
2019-12-03 19:34:16 -08:00
yuin
511e434efc Fixes #49 2019-12-03 13:31:57 +09:00
yuin
eb2667632a Fixes #48 2019-12-02 13:17:08 +09:00
Yusuke Inuzuka
615d5706c6
Merge pull request #43 from moorereason/clean-lint
Clean lint
2019-12-02 03:17:56 +09:00
yuin
2f292e5b74 Fixes #44, Fixes #45 2019-12-02 03:10:06 +09:00
Cameron Moore
ff066ede82 Fix gofmt issues 2019-11-29 13:39:42 -06:00
Cameron Moore
748be0c096 Fix shadow declarations 2019-11-29 13:20:34 -06:00
yuin
9f9f8f0e5e Closes #41 2019-11-30 03:33:46 +09:00
yuin
54fc7c3f18 Closes #40 2019-11-29 17:03:00 +09:00
yuin
16b69522a4 Remove the WithWorkers option
Situations that concurrent inline parsing is effective are very limited
due to goroutine overheads and a parse context sharing mutex.
2019-10-31 17:46:02 +09:00
Yusuke Inuzuka
187643a437 Performance improvements, Add BlockParser.Trigger 2019-08-30 16:36:00 +09:00
Abhinav Gupta
8c55e6fa9c Move test utilities to testutil/
This moves the following functions meant for use from tests into a
testutil subpackage.

    func DoTestCase(m Markdown, testCase MarkdownTestCase, t TestingT)
    func DoTestCaseFile(m Markdown, filename string, t TestingT)
    func DoTestCases(m goldmark.Markdown, cases []MarkdownTestCase, t TestingT)

This will help keep the top-level goldmark package clean and limited to
core functionality.

(Note that tests in the top-level goldmark package that make use of
these functions must now use the package name `goldmark_test` so that
they're considered separate from the main `goldmark` package, otherwise
you'll see an import cycle: goldmark imports testutil imports goldmark.)
2019-08-25 03:18:18 -07:00
Liang Ding
e7035b1993
♻️ Remove redundant check 2019-08-10 00:39:46 +08:00
Liang Ding
0c44174564
🎨 Remove redundant slice assignment 2019-08-09 23:46:25 +08:00
yuin
21b4a046d0 Fix bugs in footnotes 2019-07-24 20:55:37 +09:00
yuin
19b18e85fc Fix bug found in fuzzing 2019-07-24 20:16:54 +09:00