feat: change compile
option to files
#103
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR introduces a new option to
traverse
calledfiles
, which replacescompile
option, that filters the files in the directory tree and executes thehydrate
function, which is now a required parameter.The
HydrateChunk
also receivesmarker
as a new passthrough argument for convenience and full control of the renderer.The
compile
option intraverse
is confusing and hard to differentiate between thecompile
function that is exported. It also checks if it returns true for apath
and.. calls compile with the samehydrate
? To make it even more confusing, it checks if the returned data is truthy, else it will.. executeshydrate
again (what)?Okay, the first one which passes it to the
compile
function wants thecontent
to be rendered to HTML. The!hydrate
checking also kind of makes sense in a way that we just want to compile a markdown file and get its content, but in that case it's better to just call thecompile
function directly without passing inhydrate
. For cases where we want to compile all the markdown files in a or multiple directories, we can do them withbuffer
+parse
and nowmarker.render