simon.vergauwen
02/13/2023, 2:36 PMknit generates it's files π€
Currently I have some snippets md inside a docusaurus project, rootDir/content/blog/my-doc.md and I have a Gradle project with KotlinX Knit setup in rootDir. My goal is to have a rootDir/guide submodule with Kotlin setup, and have KotlinX Knit generate the code in there.
Currently the only way I found. to do this is to move the generated Knit files into the rootDir/guide, but that seems like a ugly hack πsimon.vergauwen
02/13/2023, 2:47 PMguide sub directory in rootDir/content/blog/. While it should be in rootDir/guidesimon.vergauwen
02/13/2023, 2:51 PM<!--- KNIT example-knit-01.kt --> but I'd like to use > You can get the full code [here](guide/src/test/kotlin/example/example-basic-01.kt)Adam S
02/13/2023, 2:52 PMtest.dir and knit.dir properties?
from memory, Knit will read the knit.properties file in each dir
https://github.com/Kotlin/kotlinx-knit#testsAdam S
02/13/2023, 2:53 PMsimon.vergauwen
02/13/2023, 2:53 PMknit.dir setup, and it works correctly when using <!--- KNIT example-knit-01.kt --> but using a link it completely ignores that path.
So I guess it's a bug in Knit π€Adam S
02/13/2023, 3:00 PMβββ /
βββ content/
β βββ blog/
β βββ my-doc.md
β βββ knit.properties
βββ guide/
βββ src/test/kotlin/example/
βββ example-basic-01.ktAdam S
02/13/2023, 3:02 PMknit.dir=../../guide/src/test/kotlin/example
?simon.vergauwen
02/13/2023, 3:07 PMsimon.vergauwen
02/13/2023, 3:20 PM> You can get the full code [here](../../guide/src/test/kotlin/examples/example-basic-01.kt)
but breaks <!--- KNIT example-basic-02.kt --> πAdam S
02/13/2023, 3:23 PMAdam S
02/13/2023, 3:24 PMsimon.vergauwen
02/13/2023, 3:25 PMknit.properties to content/blog, and I can duplicate it between different folders π€
But now I cannot reference test.template by doing ../../ nor using symlinks ..simon.vergauwen
02/13/2023, 3:25 PMsimon.vergauwen
02/13/2023, 3:27 PMAdam S
02/13/2023, 3:29 PM./docs/) and Docusaurus (./site/).
The Knit project generates the examples & tests internally (./docs/src/test, ./docs/src/examples/), and shares the files to the Docusaurus project via Gradle Configurations. And the Docusaurus project fixes the links with a regex.simon.vergauwen
02/13/2023, 3:30 PMAdam S
02/13/2023, 3:31 PMsimon.vergauwen
02/14/2023, 11:07 AMSync or copy like tasks needed βΊοΈ Thanks for your help @Adam S! Wouldn't have been able to set it up in this way without it πsimon.vergauwen
02/14/2023, 11:10 AMβββ /
βββ content/
β βββ blog/
β βββ my-doc.md
β βββ knit.properties
β βββ knit.test.template
βββ guide/
βββ build.gradle.kts
βββ src/test/kotlin/example/
βββ example-basic-01.kt
βββ src/test/kotlin/example/test
βββ BasicTest.kt
βββ knit.properties
βββ build.gradle.kts
βββ settings.gradle.kts
This is the structure I ended up withAdam S
02/14/2023, 3:37 PMknit.properties? Did you have to do any knit {} Gradle config?simon.vergauwen
02/14/2023, 4:16 PMroot/knit.properties I am pointing to guide/src/test/kotlin/examples/ and in the nested content/blog/knit.properties I am pointing to the same directory ../../guide/src/test/kotlin/examples/.
My knit { } configured is the default, I only applied siteRoot.