rjeschke / txtmark

Yet another markdown processor for the JVM
Apache License 2.0
449 stars 100 forks source link

Incorrect rendering of pre-formatted text #30

Closed nindalf closed 9 years ago

nindalf commented 9 years ago

Triple backticks are rendered as <pre> when I set forceExtended in the config. However there are a couple of issues with the text.

  1. Everything from the block appears on the same line. (This could be intended, but I'm not certain)
  2. The first few characters on every line disappears

Example

```
go test -cover // shows you what percentage of the code is covered by tests
go tool cover -html=coverage.out //opens a web browser which shows you which lines aren't covered
```

random text

```
func main() {
    return nil
}
```

renders as

forceExtendedProfile = True

<p>From <a href="http://blog.golang.org/cover">a post</a> on the Go Blog</p>
    <pre><code>est -cover // shows you what percentage of the code is covered by tests
    ool cover -html=coverage.out //opens a web browser which shows you which lines aren't covered
    </code></pre>
    <p>random text</p>
    <pre><code> main() {
    return nil
    </code></pre>

forceExtendedProfile = False

<p>From <a href="http://blog.golang.org/cover">a post</a> on the Go Blog</p>
    <p><code>`
    go test -cover // shows you what percentage of the code is covered by tests
    go tool cover -html=coverage.out //opens a web browser which shows you which lines aren't covered
    </code>`</p>
    <p>random text</p>
    <p><code>`
    func main() {
    return nil
    }
    </code>`</p>
nindalf commented 9 years ago

Thanks again for your support. If there is an alternate forum I should be asking these questions, please let me know.

rjeschke commented 9 years ago

The behaviour for forceExtendedProfile=false is correct, as there are no fenced code blocks supported.

But the other case is a bug, there was a leading of four characters removed for fenced code blocks, when no block-emitter was given.

Fixed with 77ce75867df5c6e7fcf329d7b431cac44fa30b13

nindalf commented 9 years ago

Thank you! :)