** * _ not interpreted
orefalo opened this issue · 9 comments
I used the unit test from the gitblit project to do the following tests, Bold, Italic and Underscore are the most common use of markdown.
Test string -> error
"*B*" -> null pointer
"* B *" -> null pointer
**B** -> null pointer
"** B **" -> java.text.ParseException: Encountered " "*" "* "" at line 1, column 2.
Was expecting one of:
" " ...
"\t" ...
" " ...
at com.gitblit.utils.MarkdownUtils.transformMarkdown(MarkdownUtils.java:68)
at com.gitblit.utils.MarkdownUtils.transformMarkdown(MarkdownUtils.java:44)
at com.gitblit.tests.MarkdownUtilsTest.testMarkdown(MarkdownUtilsTest.java:27)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at junit.framework.TestCase.runTest(TestCase.java:168)
at junit.framework.TestCase.runBare(TestCase.java:134)
at junit.framework.TestResult$1.protect(TestResult.java:110)
at junit.framework.TestResult.runProtected(TestResult.java:128)
at junit.framework.TestResult.run(TestResult.java:113)
at junit.framework.TestCase.run(TestCase.java:124)
at junit.framework.TestSuite.runTest(TestSuite.java:243)
at junit.framework.TestSuite.run(TestSuite.java:238)
at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
=========== http://daringfireball.net/projects/markdown/basics
Markdown uses asterisks and underscores to indicate spans of emphasis.
Markdown:
Some of these words are emphasized.
Some of these words are emphasized also.
Use two asterisks for strong emphasis.
Or, if you prefer, use two underscores instead.
Output:
Some of these words are emphasized. Some of these words are emphasized also.
Use two asterisks for strong emphasis. Or, if you prefer, use two underscores instead.
Orefalo, you beat me to it. :) This issue was initially reported downstream @ the gitblit project.
I'm enabling issue notifications to see how this resolves.
Hi, there is bug detected in the grammar a fix is coming soon, thanks for reporting it
could you confirm, I had uploaded v1.1.1 jar, let me know if everything is ok, so I can deploy it to maven repo
Input: ** THIS ** is a test
Expected: <p><strong> THIS </strong> is a test</p>
Actual: <p>** THIS ** is a test</p>
Reformatted. Not sure if an update email gets sent.
I see the jar link, but not the code changes in your repo.
please publish your changes, I will probably add a few unit tests over the weekend.
Well, I know that there is not a formal grammar definition for emphasis but most implementations use this
parts that are surrounded with single asterisks * or underscores _ are treated as text with light emphasis, text parts
surrounded with two asterisks or underscores are treated as text with strong emphasis. Surrounded means that the
starting delimiter must not be followed by a space and that the stopping delimiter must not be preceded by a space.
I tested on stackoverflow and dingus and they behave like that and also github has the same behavior.
** THIS ** is a test
I saw the branch, thank you!
I tried with my own documents, it works great. thanks for the quick fix.