stantronic
03/04/2025, 1:51 PMsrc/jsMain/resources/markdown
feels wrong, as I don't really want these in source control. Is there a way to tell kobweb-x markdown to look at a different folder to find the markdown-files to process?David Herman
03/05/2025, 3:41 AMbuild/generated/reporting-lib/src/jsMain/resources/markdown/
and add build/generated/reporting-lib
to your Kotlin resource dirs?David Herman
03/05/2025, 3:42 AMstantronic
03/06/2025, 12:00 PMDavid Herman
03/06/2025, 4:00 PMjsMain {
resources.srcDir(yourTaskWithDirOutputHere)
}
line?
As a test, you can call
kobweb {
markdown {
process.set {
generateMarkdown("test.md", "This is a test")
}
}
}
and see where that file ends up getting generated into at compile time.David Herman
03/28/2025, 6:27 AM0.20.5-SNAPSHOT
which contains the changes. I think you'll actually have to change your code because we no longer search all resource directories automatically anymore (we ran into a chicken and egg problem where people wanted to produce resources in response to processing their markdown). We will only look under "src/jsMain/resources/markdown"
by default moving forward.
So now what you can do is call kobweb.markdown.addSource
and give it the root directory of where your generated markdown files live. No more need to force a magical "markdown" subfolder to exist in there.
In your project's build script, I imagine the change would be:
kobweb.markdown.addSource(
project.layout.buildDirectory.dir(
"generated/reporting-lib/markdown-files"
)
)
and you should be good to go. At that point, a markdown file under .../markdown-files
will get converted into a root page in your site.
Let's say you wanted all those files to go into a subroute. For example, say .../markdown-files/ExPage.md
should become "<http://yoursite.com/reporting/ex-page|yoursite.com/reporting/ex-page>
In that case, you can associate each new source location with a target package all code should be added under.
So for the above case, that would look like:
kobweb.markdown.addSource(
project.layout.buildDirectory.dir(
"generated/reporting-lib/markdown-files"
),
".pages.reporting"
)