Git Product home page Git Product logo

mark's Issues

CommonMark support

Hey, how CommonMark is this?

Markdown parsers all seem to build their own unique flavor of Markdown each and every time, usually because they copy and paste around test suites from random other projects then miss updates and changes without noticing.

Sorry for the self link, but I wrote about the mess a bit here.

CommonMark would be awesome, especially if you work from their spec.

Set an <br> and <hr>

What ist the common way to set a line breake <br> and a <hr>.
I tried

**What's new?** /
---
    
* The release notes now use HTML to look friendlier
* A lot of small improvements on Courier2                                    
       
       
/There should be no visible changes for Courier 1 users.

in this code.

package main

import (
	"fmt"
	"io/ioutil"

	"github.com/a8m/mark"
)

func main() {
	markdown_text, err := ioutil.ReadFile("testdata/test3.md")
	html := mark.Render(string(markdown_text))
	fmt.Print(html, err)
}

But it dont set an <br> after two spaces or an <hr> for ---.
I got this

</p>strong>Test This</strong>
</p> ---
<pre><code>
</code></pre>
<ul>
<li>Bla 1</li>
<li>Bla 2

Did it work?</li>
</ul><nil>

Package contains data races

Upon running the tests with a --race flag, you'll find the package is riddled with many race conditions. Due to this, the package cannot safely be utilized in any concurrent fashion.

I will only paste a snippet example here as the actual result errors totalled in over 3000 lines. A simple invocation of the tests with go test --race should be sufficient enough to investigate.

WARNING: DATA RACE
Read at 0x00c42031d818 by goroutine 161:
  github.com/a8m/mark.(*lexer).nextItem()
      /Users/henryhenderson/go/src/github.com/a8m/mark/lexer.go:279 +0xb5
  github.com/a8m/mark.(*parse).peek()
      /Users/henryhenderson/go/src/github.com/a8m/mark/parser.go:126 +0x154
  github.com/a8m/mark.(*parse).parse()
      /Users/henryhenderson/go/src/github.com/a8m/mark/parser.go:38 +0x50
  github.com/a8m/mark.(*parse).parseBlockQuote()
      /Users/henryhenderson/go/src/github.com/a8m/mark/parser.go:280 +0x194
  github.com/a8m/mark.(*parse).parse()
      /Users/henryhenderson/go/src/github.com/a8m/mark/parser.go:59 +0x422
  github.com/a8m/mark.(*Mark).Render()
      /Users/henryhenderson/go/src/github.com/a8m/mark/mark.go:45 +0x4d
  github.com/a8m/mark.Render()
      /Users/henryhenderson/go/src/github.com/a8m/mark/mark.go:59 +0x5d
  github.com/a8m/mark.TestCommonMark()
      /Users/henryhenderson/go/src/github.com/a8m/mark/mark_test.go:1666 +0x14d
  testing.tRunner()
      /usr/local/Cellar/go/1.10/libexec/src/testing/testing.go:777 +0x16d

Previous write at 0x00c42031d818 by goroutine 447:
  github.com/a8m/mark.(*lexer).next()
      /Users/henryhenderson/go/src/github.com/a8m/mark/lexer.go:114 +0x138
  github.com/a8m/mark.(*lexer).peek()
      /Users/henryhenderson/go/src/github.com/a8m/mark/lexer.go:262 +0x3c
  github.com/a8m/mark.lexText()
      /Users/henryhenderson/go/src/github.com/a8m/mark/lexer.go:231 +0x78
  github.com/a8m/mark.(*lexer).run()
      /Users/henryhenderson/go/src/github.com/a8m/mark/lexer.go:101 +0xa1

Goroutine 161 (running) created at:
  testing.(*T).Run()
      /usr/local/Cellar/go/1.10/libexec/src/testing/testing.go:824 +0x564
  testing.runTests.func1()
      /usr/local/Cellar/go/1.10/libexec/src/testing/testing.go:1063 +0xa4
  testing.tRunner()
      /usr/local/Cellar/go/1.10/libexec/src/testing/testing.go:777 +0x16d
  testing.runTests()
      /usr/local/Cellar/go/1.10/libexec/src/testing/testing.go:1061 +0x4e1
  testing.(*M).Run()
      /usr/local/Cellar/go/1.10/libexec/src/testing/testing.go:978 +0x2cd
  main.main()
      _testmain.go:56 +0x22a

Goroutine 447 (running) created at:
  github.com/a8m/mark.lex()
      /Users/henryhenderson/go/src/github.com/a8m/mark/lexer.go:84 +0x112
  github.com/a8m/mark.(*parse).parseBlockQuote()
      /Users/henryhenderson/go/src/github.com/a8m/mark/parser.go:279 +0xbe
  github.com/a8m/mark.(*parse).parse()
      /Users/henryhenderson/go/src/github.com/a8m/mark/parser.go:59 +0x422
  github.com/a8m/mark.(*Mark).Render()
      /Users/henryhenderson/go/src/github.com/a8m/mark/mark.go:45 +0x4d
  github.com/a8m/mark.Render()
      /Users/henryhenderson/go/src/github.com/a8m/mark/mark.go:59 +0x5d
  github.com/a8m/mark.TestCommonMark()
      /Users/henryhenderson/go/src/github.com/a8m/mark/mark_test.go:1666 +0x14d
  testing.tRunner()
      /usr/local/Cellar/go/1.10/libexec/src/testing/testing.go:777 +0x16d
==================

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.