Skip to content

Commit

Permalink
Merge branch 'cheeseng-feature-commonmark' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
bvenners committed Jul 2, 2022
2 parents 66e835b + afc6c7a commit a6666a1
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 12 deletions.
13 changes: 5 additions & 8 deletions jvm/core/src/main/scala/org/scalatest/tools/HtmlReporter.scala
Expand Up @@ -46,10 +46,8 @@ import Suite.unparsedXml
import Suite.xmlContent
import org.scalatest.exceptions.TestFailedException

import com.vladsch.flexmark.parser.PegdownExtensions
import com.vladsch.flexmark.profile.pegdown.PegdownOptionsAdapter
import com.vladsch.flexmark.parser.Parser
import com.vladsch.flexmark.html.HtmlRenderer
import org.commonmark.parser.Parser
import org.commonmark.renderer.html.HtmlRenderer

/**
* A <code>Reporter</code> that prints test status information in HTML format to a file.
Expand Down Expand Up @@ -122,11 +120,10 @@ private[scalatest] class HtmlReporter(
new ClassNotFoundException(Resources.flexmarkClassNotFound)
}

private val pegdownOptions = PegdownOptionsAdapter.flexmarkOptions(PegdownExtensions.ALL)
private val markdownParser = Parser.builder(pegdownOptions).build()
private val htmlRenderer = HtmlRenderer.builder(pegdownOptions).build()
private val parser = Parser.builder().build()
private val renderer = HtmlRenderer.builder().build()

private def markdownToHtml(s: String): String = htmlRenderer.render(markdownParser.parse(s))
private def markdownToHtml(s: String): String = renderer.render(parser.parse(s))

private def withPossibleLineNumber(stringToPrint: String, throwable: Option[Throwable]): String = {
throwable match {
Expand Down
2 changes: 1 addition & 1 deletion project/BuildCommons.scala
Expand Up @@ -26,7 +26,7 @@ trait BuildCommons {

val plusJUnitVersion = "3.2.10.0"
val plusTestNGVersion = "3.2.10.0"
val flexmarkVersion = "0.62.2"
val commonmarkVersion = "0.19.0"

def rootProject: Project

Expand Down
5 changes: 2 additions & 3 deletions project/scalatest.scala
Expand Up @@ -148,7 +148,7 @@ object ScalatestBuild extends BuildCommons with DottyBuild with NativeBuild with
"com.google.inject" % "guice" % "4.0" % "optional",
"org.apache.ant" % "ant" % "1.10.12" % "optional",
"org.ow2.asm" % "asm-all" % "4.1" % "optional",
flexmarkAll
commonmark
)

def crossBuildTestLibraryDependencies = Def.setting {
Expand All @@ -157,7 +157,7 @@ object ScalatestBuild extends BuildCommons with DottyBuild with NativeBuild with
)
}

val flexmarkAll = "com.vladsch.flexmark" % "flexmark-all" % flexmarkVersion % "optional"
val commonmark = "org.commonmark" % "commonmark" % commonmarkVersion % "optional"

def scalatestTestLibraryDependencies(theScalaVersion: String) =
Seq(
Expand Down Expand Up @@ -1202,7 +1202,6 @@ object ScalatestBuild extends BuildCommons with DottyBuild with NativeBuild with

def gentestsLibraryDependencies =
Seq(
flexmarkAll,
"org.scalatestplus" %% "testng-6-7" % plusTestNGVersion % "test",
"org.scalatestplus" %% "junit-4-13" % plusJUnitVersion % "test"
)
Expand Down

0 comments on commit a6666a1

Please sign in to comment.