This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
dotnet restore # Restore dependencies
dotnet build # Build all projects
dotnet test # Run all tests
dotnet test --filter "FullyQualifiedName~UtilityTests" # Run specific test classRun the web app:
cd src/ConvertLearnToDoc && dotnet run
# Access at https://localhost:5001/Run CLI tool:
dotnet run --project src/ConvertDocx -- <input> <output> [options]This is a .NET 8.0 solution for bidirectional conversion between Microsoft Word documents and Microsoft Learn modules/articles.
Word → Learn Module:
DocxToLearn.ConvertAsync()orchestrates the conversionMarkdownRendererconverts .docx → intermediate Markdown using registry ofIMarkdownObjectRendererimplementationsDocToMarkdownRenderer.PostProcessMarkdown()cleans up the outputModuleBuildersplits Markdown into YAML + unit files based on H1 headers
Learn → Word:
LearnToDocx.ConvertFromRepoAsync()orConvertFromFolderAsync()ModuleCombinerdownloads/combines Learn module filesMarkdownToDocConverteruses Markdig to parse, thenDocxRendererwithIDocxObjectRendererregistry renders to Word
Both conversion directions use a registry pattern:
- Docx.Renderer.Markdown:
IMarkdownObjectRendererimplementations (ParagraphRenderer, TableRenderer, RunRenderer, IgnoredBlocks) - Markdig.Renderer.Docx:
IDocxObjectRendererimplementations inBlocks/andInlines/directories
To add rendering for a new element type:
- Implement the appropriate interface
- Implement
CanRender(object element)for type matching - Register in the renderer constructor
| Library | Purpose |
|---|---|
LearnDocUtils |
Core conversion logic, module building |
Docx.Renderer.Markdown |
Word → Markdown rendering |
Markdig.Renderer.Docx |
Markdown → Word rendering |
DocsToMarkdown |
Downloads Learn content from URLs |
ConvertLearnToDoc.Shared |
DTOs shared between web app and libraries |
Julmar.DxPlus- Word document I/OMarkdig- Markdown parsingMicrosoft.DocAsCode.MarkdigEngine.Extensions- DocFX triple-colon syntax (:::type)YamlDotNet- YAML serialization
Blazor Server app with API controllers:
DocConverterController(/api/docconverter) - Word ↔ Learn conversionsContentConverterController(/api/contentconverter) - URL-based conversions- Pages:
DocToModule.razor,DocToArticle.razor,ContentToDoc.razor,ContentToMarkdown.razor
Authentication via GitHub OAuth with email allowlist validation.
- Module units are split on H1 headers (
#) in the Markdown - Post-processing removes:
\r\n,\xA0(NBSP),\u200b(ZWSP),\u202f(NNBSP) - Markdown formatting options are stored in Word custom properties (UseAsterisksForBullets, UseAsterisksForEmphasis)
- YAML templates are embedded resources in
LearnDocUtils/templates/ - Debug mode (
-dflag oroptions.Debug) preserves intermediate files for troubleshooting - Max upload size: 1GB (configurable in
ArticleOrModuleRef.cs)