Skip to content

Escape the backticks in Sharpie's kaomoji - #15

Merged
HarryCordewener merged 1 commit into
mainfrom
claude/kaomoji-backticks
Dec 3, 2026
Merged

HarryCordewener merged 1 commit into
mainfrom
claude/kaomoji-backticks

Conversation

@HarryCordewener

@HarryCordewener HarryCordewener commented Dec 2, 2026 •

Copy link
Copy Markdown
Member

Requested by Grave · project thread

Why

Personality.md offered (・`ω´・) as an example kaomoji. Sharpie keeps using it, and Discord reads its bare backtick as the start of inline code. That code runs to the next backtick in the reply, which breaks the rest of the answer's formatting.

What changes

  • ReplyText.EscapeKaomoji: escapes unescaped backticks inside kaomoji, outside ``` blocks.
    • A kaomoji means a parenthesised run on one line, at most 24 characters, with a non-ASCII character in it.
    • Softcode such as u(me/FN`X) doesn't match, so it's left alone.
  • Answerer: runs it on the final reply and the rewrite, before WritingCheck. A kaomoji no longer triggers the stray-backtick rewrite.
  • DocsTools: runs it on edit_answer text too.
  • Personality.md: the examples are now ( ̄ー ̄) and ( ̄▽ ̄)ゞ, and it says to pick kaomoji with no backtick, asterisk, underscore or backslash.
  • CHANGELOG: has an entry.

Testing

  • EscapesBackticksInKaomoji, six cases:

    • a kaomoji alone, and next to real inline code
    • an already-escaped kaomoji
    • a plain kaomoji
    • softcode with a backtick
    • a kaomoji inside a code block

    The tests failed to build before EscapeKaomoji existed.

  • NoExampleKaomojiHasABacktick.

  • 112 tests pass, dotnet build has no warnings, and dotnet format is clean.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Kaomoji containing backticks are now escaped before answers are posted, preventing unintended inline-code formatting. Backticks in fenced code and elsewhere remain unchanged.
  • Documentation
    • Updated guidance and examples to avoid backticks and other formatting characters in kaomoji.

The personality offered (・`ω´・) as an example, and its bare backtick
opened inline code that ran to the next backtick in the reply. Replies
and edits now have kaomoji backticks escaped before the writing check
and posting, and the example kaomoji are ones with no Markdown in them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@HarryCordewener HarryCordewener self-assigned this Dec 2, 2026
@HarryCordewener
HarryCordewener marked this pull request as draft December 2, 2026 23:57
@coderabbitai

coderabbitai Bot commented Dec 2, 2026 •

Copy link
Copy Markdown

Explain Change →

Caution

Review failed

The pull request is closed.

Walkthrough

Sharpie adds ReplyText.EscapeKaomoji and applies it to generated replies and edited answers. The function escapes unescaped backticks in matching kaomoji outside fenced code blocks. Prompt guidance, tests, and the changelog are updated.

Changes

Kaomoji backtick escaping

Layer / File(s) Summary
Kaomoji matching and escaping
src/Sharpie.Core/Replies/ReplyText.cs, tests/Sharpie.Tests/ReplyTextTests.cs
EscapeKaomoji normalizes CRLF to LF and escapes unescaped backticks in matching single-line parenthesized runs outside fenced code blocks. Tests cover escaped and unescaped backticks, plain text, and fenced code.
Answer path integration
src/Sharpie.Core/Answering/Answerer.cs, src/Sharpie.Core/Answering/DocsTools.cs
Answerer applies escaping to trimmed replies and rewrite candidates. DocsTools.RunEdit applies it before existing checks and returns the escaped answer.
Prompt guidance and release notes
src/Sharpie.Core/Answering/Personality.md, tests/Sharpie.Tests/PromptTests.cs, CHANGELOG.md
The personality guidance changes its example and adds restrictions on special characters in kaomoji. The prompt test checks the guidance, and the changelog documents the escaping change.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: claude

Merge Risk: Low · up to f6af5

Replies that put non-ASCII text inside parenthesised inline code may show literal backticks instead of code formatting. This affects a narrow set of replies and does not break the main reply flow. Merging is low risk, but consider fixing it.

- [ ] Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@HarryCordewener
HarryCordewener marked this pull request as ready for review December 3, 2026 00:01
@HarryCordewener
HarryCordewener merged commit 402365a into main Dec 3, 2026
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant