-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Laika integration #102
Comments
I had a quick look at the existing code and have a bunch of questions. I think the answers will make it easier for me to make a few useful suggestions.
|
Hi folks, sorry for the delay.
|
No problem with the delay, I'm not building this, I'm just assisting... 🙂 Although it would probably be to your advantage if we'd have at least a rough design idea before Laika 1.0 goes into its RC cycle which is only a few weeks away. The intention there is to seal the APIs for the next 127 years 🙂 , so if we spot something where you'd need new hooks it would be good to squeeze them in before that. Unfortunately I still cannot give some concrete suggestions, as with the info you gave I have a few more questions...
When I looked at the code I could only see the interim structure ( |
Hey @jenshalm, thanks for your thoughts on the matter :) It sounds like you're suggesting that we should two functions:
Does that sound about right? If so, that sounds doable to me. And is there a good example of the post-processor workflow you describe? |
The key issue for deeper integration into existing APIs is only whether you can merge the two index files into one. Everything I write below assumes that this is possible. If you look at the code examples for renderers in the manual you could then simply add the search index as the 4th renderer. Meaning in the 2nd code block you would add val indexRenderer = Renderer.of(SearchIndex).withConfig(config).parallel[IO].build and in the 4th code block you would then add val indexOp = indexRenderer.from(tree.root).toFile("whatever-your-name-pattern-is").render This would be the integration layer for API users. For users of This means the only public type your glue library would need to provide is the The The If you want to look at existing implementations you can look at the EPUB renderer and the PDF renderer, but of course their processing logic is very different from what you need (and in fact very different from each other, too). I think overall it's most likely quite straightforward compared to the complexity you have to deal with for the underlying search engine. |
Thanks again @jenshalm I think I have a silly I'm now wondering how I can use this in an existing sbt build using laika. I was poking around the laika sbt plugin but couldn't find anything obvious to me. |
Oh, I should also confirm that I think the per-document and then merge to one index approach will work fine. :) |
That's excellent and good for both, the end user and the maintainers.
Yes, there is no corresponding hook in the plugin setup yet. I was aware of that, but since our discussion did not reach the concrete stage before 1.0 was out and I knew a hook can be added later for 1.1 in a backwards-compatible way I didn't do anything yet. What you can do as a temporary workaround until such a hook exists is creating a custom task that invokes the renderer manually. Just make sure you use the configured parser for creating the AST: val tree = Settings.parser.value.use(_.fromInput(laikaInputs.value.delegate).parse).unsafeRunSync() The downsides of this temporary workaround are: a) some unnecessary temporary boilerplate, b) the need to parse twice for the site output and the index and c) not participating in sbt caching that the Laika plugin taps into. Once you are getting closer to having something you want to release as part of sbt-typelevel we can look into adding a more convenient and more deeply integrated hook to the Laika plugin. It would add a customization option for the existing We could add a new setting Ideally I'd add that hook once you are getting closer to integrating with sbt-typelevel and have you testing everything based on snapshots before releasing to avoid the risk of needing to break the new API after 1.1 is out. |
An umbrella issue to discuss the Laika integration. Some work has already been done in this area.
In typelevel/Laika#495 I sketched an integration as follows:
The text was updated successfully, but these errors were encountered: