Help with migrating to 1.0 #552
-
Hi, thanks for keeping Laika great! I'd like to migrate my Markdown-to-HTML transformer from 0.19.5 to 1.0.0 and hit a couple of obstacles:
Thanks for your help! |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 3 replies
-
I'm a little unclear on what the actual problem is, as the two things you mention haven't really changed. Can you post a code snippet that used to work in 0.19.5 and doesn't in 1.0.0? |
Beta Was this translation helpful? Give feedback.
-
Actually, even without seeing code, I suspect it's most likely just imports (there was a fairly big repackaging for 1.0). For your case the issue might be that |
Beta Was this translation helpful? Give feedback.
-
Thanks for the reply. The code snippet that used to work in 0.19.5 is under the link above, but here it is for completeness: import cats.effect.IO
import cats.effect.unsafe.implicits.global
import laika.api.Transformer
import laika.format.{HTML, Markdown}
import laika.helium.Helium
import laika.helium.config.TextLink
import laika.io.implicits._
import laika.markdown.github.GitHubFlavor
import laika.parse.code.SyntaxHighlighting
import laika.theme.Theme
Transformer
.from(Markdown)
.to(HTML)
.withRawContent
.using(GitHubFlavor, SyntaxHighlighting)
.parallel[IO]
.withTheme(
Helium.defaults
.site.topNavigationBar(
homeLink = TextLink.external("https://github.com/TomasMikula/libretto", "GitHub"),
)
.site.fontResources(/* Empty overrides Default! We use our custom CSS for the fonts. */)
.build
)
.build
.use { transformer =>
transformer
.fromDirectory(srcDir)
.toDirectory(tgtDir)
.transform
}
.unsafeRunSync() I have managed to find But the |
Beta Was this translation helpful? Give feedback.
-
Yes, as I suspected, my previous answer applies to your code. |
Beta Was this translation helpful? Give feedback.
This error implies that the code you are trying to compile is not exactly the code you posted. I assume you removed the call to
.parallel[IO]
which is still needed to get into the richer builder API. Without it you are building a base transformer that can only transform from string to string in memory and does not support themes.