Repository navigation
Improve error handling and the output file lifecycle - #77
Merged
Merged
Conversation
MDVIEW_DIR and the Snap temp directory are created with MkdirAll, so nested paths work. check() now writes to stderr, names the failing path, and shows the Snap hint only for permission and not-found errors, not for every failure. The output file is written by writeOutput, which closes the file explicitly and returns Sync and Close errors. Before, log.Fatal skipped the deferred Close and those errors were dropped. Render errors now go through check(). Generated temp files older than 24 hours are removed from the temp directory before a new one is written. Only names that match mdview<32 hex>.html are touched. Mermaid detection now looks for a mermaid block in the AST, so raw HTML that mentions class="mermaid" no longer adds the 2.6 MB script. Closes #68
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
MDVIEW_DIRand the Snap temp dir useMkdirAll, so nested paths work.check()writes to stderr, names the failing path, and shows the Snap hint only for permission and not-found errors. Render errors go throughcheck()too.writeOutputcloses the file explicitly and returnsSyncandCloseerrors.mdview<32 hex>.html, older than 24 hours) are removed from the temp directory before a new file is written. Cleanup runs only when-ois not given.mermaid.Kind), not a string match on the HTML.CLAUDE.md.Tests cover
hasMermaidBlock,embedMermaidScript,getTempDir,writeOutputandremoveStaleTempFiles. I also checked the error output and exit codes against the built binary.Closes #68