Dependency Injection
Documentation menu
FlexiBlocks does not require a service container. Its composition model is the Markdig pipeline, and the same discipline applies: register the parts you need and keep configuration in one place.
The pipeline as composition root
A MarkdownPipelineBuilder collects the extensions that will be used for a document. Add the FlexiBlocks extensions once, build the pipeline once and reuse it. The pipeline is immutable after it is built, which makes it safe to share.
var pipeline = new MarkdownPipelineBuilder()
.UseFlexiBlocks()
.Build();
Configuration
Keep extension options near the pipeline construction. A writer should not need to know which extensions are enabled; a developer should not need to search the codebase for a second pipeline.
Testing
Build the pipeline in a test fixture and render representative documents. If an extension changes, the test shows the difference in the output before a reader sees it.