markdown_to_docx matched _..._ anywhere, so prose mentioning an identifier like
snake_case_word was exported with "case" italicized and the surrounding
underscores dropped ("snakecaseword"). Per CommonMark, _ only opens or closes
emphasis at a word boundary (unlike *, which may emphasise intra-word).
Guard the _ emphasis branch with word-boundary lookarounds, matching the
pattern already used for Anki export in deeptutor/notes/anki_export.py.
Word-bounded _italic_ is unchanged.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
CoWriterStorage.locked() is taken by every document save, note-thread
change, proposal and review. Its Windows branch appended b"0" to the
append-mode .write.lock file before each msvcrt lock, so the file grew
by one byte per acquisition (1,000 saves: 1,000 bytes) and never shrank.
Write the byte only when the file is empty, as the other msvcrt locks
in the codebase do.
_add_inline_runs masks backslash escapes with the sentinel _MASK = '\x00' and
pops one saved character per sentinel in _unmask. A NUL already present in the
input collides with the sentinel but has no saved entry, so _unmask called
deque.popleft() on an empty deque and raised IndexError, aborting the entire
Word export. NUL is not valid XML text content, so strip it at the single
inline-text choke point before masking.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>