Skip to content

Commit

Permalink
Fixes #455
Browse files Browse the repository at this point in the history
  • Loading branch information
yuin committed Jun 14, 2024
1 parent fde4948 commit df3d77e
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 7 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ jobs:
strategy:
fail-fast: false
matrix:
go-version: [1.19.x, 1.20.x]
go-version: [1.21.x, 1.22.x]
platform: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.platform }}
steps:
Expand All @@ -16,7 +16,7 @@ jobs:
- name: Checkout code
uses: actions/checkout@v3
- name: Run lints
uses: golangci/golangci-lint-action@v3
uses: golangci/golangci-lint-action@v6
with:
version: latest
if: "matrix.platform == 'ubuntu-latest'" # gofmt linter fails on Windows for CRLF problems
Expand Down
20 changes: 16 additions & 4 deletions extension/_test/strikethrough.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
<p><del>Hi</del> Hello, world!</p>
//= = = = = = = = = = = = = = = = = = = = = = = =//



2
//- - - - - - - - -//
This ~~has a
Expand All @@ -17,11 +15,25 @@ new paragraph~~.
<p>new paragraph~~.</p>
//= = = = = = = = = = = = = = = = = = = = = = = =//



3
//- - - - - - - - -//
~Hi~ Hello, world!
//- - - - - - - - -//
<p><del>Hi</del> Hello, world!</p>
//= = = = = = = = = = = = = = = = = = = = = = = =//

4: Three or more tildes do not create a strikethrough
//- - - - - - - - -//
This will ~~~not~~~ strike.
//- - - - - - - - -//
<p>This will ~~~not~~~ strike.</p>
//= = = = = = = = = = = = = = = = = = = = = = = =//

5: Leading three or more tildes do not create a strikethrough, create a code block
//- - - - - - - - -//
~~~Hi~~~ Hello, world!
//- - - - - - - - -//
<pre><code class="language-Hi~~~"></code></pre>
//= = = = = = = = = = = = = = = = = = = = = = = =//


3 changes: 2 additions & 1 deletion extension/strikethrough.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,10 @@ func (s *strikethroughParser) Parse(parent gast.Node, block text.Reader, pc pars
before := block.PrecendingCharacter()
line, segment := block.PeekLine()
node := parser.ScanDelimiter(line, before, 1, defaultStrikethroughDelimiterProcessor)
if node == nil {
if node == nil || node.OriginalLength > 2 || before == '~' {
return nil
}

node.Segment = segment.WithStop(segment.Start + node.OriginalLength)
block.Advance(node.OriginalLength)
pc.PushDelimiter(node)
Expand Down

0 comments on commit df3d77e

Please sign in to comment.