Skip to content

Commit

Permalink
Fix buggy upgrade in MdocModifier.
Browse files Browse the repository at this point in the history
There was no regression in mdoc, my refactoring from flexmark
`MutableDataSet` forgot to preserve an important
`context.copy(reporter = myReporter)` transformation.
  • Loading branch information
Olafur Pall Geirsson committed Oct 30, 2019
1 parent 33b19a7 commit 8b5c6d2
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions mdoc-docs/src/main/scala/mdoc/docs/MdocModifier.scala
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,25 @@ import mdoc.internal.markdown.DocumentLinks
import mdoc.internal.markdown.GitHubIdGenerator
import mdoc.internal.markdown.LinkHygiene
import mdoc.internal.pos.PositionSyntax._
import mdoc.internal.markdown.MarkdownFile

class MdocModifier(context: Context) extends StringModifier {
private val myStdout = new ByteArrayOutputStream()
private val myReporter = new ConsoleReporter(new PrintStream(myStdout))
private val markdownSettings = Markdown.mdocSettings(context.copy(reporter = myReporter))
private val myContext = context.copy(reporter = myReporter)
override val name: String = "mdoc"
override def process(info: String, code: Input, reporter: Reporter): String = {
myStdout.reset()
myReporter.reset()
val cleanInput = Input.VirtualFile(code.filename, code.text)
val relpath = RelativePath("readme.md")
val relpath = RelativePath(code.filename)
val markdown = Markdown.toMarkdown(
cleanInput,
context,
myContext,
relpath,
Map.empty[String, String],
myContext.settings.site,
myReporter,
context.settings
myContext.settings
)
val links = DocumentLinks.fromMarkdown(GitHubIdGenerator, relpath, cleanInput)
LinkHygiene.lint(List(links), myReporter, verbose = false)
Expand Down

0 comments on commit 8b5c6d2

Please sign in to comment.