Skip to content

Teach Sharpie Discord's Markdown and catch softcode left outside code - #11

Merged
HarryCordewener merged 1 commit into
mainfrom
claude/discord-markdown
Dec 2, 2026
Merged

HarryCordewener merged 1 commit into
mainfrom
claude/discord-markdown

Conversation

@HarryCordewener

Copy link
Copy Markdown
Member

Requested by Grave · project thread

Why

Discord renders a message as Markdown, and softcode's characters are Markdown syntax: backticks in attribute trees, * and _ in wildcards and names, ~ and |. Written as plain text, DATA`42`TO renders as "DATA", then "42" in inline code, then "TO". The prompt's only guidance was "code in ``` blocks", and its own examples wrote CMD`SETRANK bare, so Sharpie copied them.

What changes

  • A new # Discord formatting section in the rules:
    • Every piece of softcode goes in code: commands, functions, attribute names, substitutions, dbrefs, wildcards.
    • Code blocks have no language tag and need no escaping.
    • Inline code that contains a backtick is wrapped in two backticks, padded with a space when it starts or ends with one.
    • Outside code, a character meant literally gets a backslash.
    • It lists what Discord shows (bold, italics, lists, quotes, masked links) and what it doesn't (tables, HTML, images, and in replies no headings or subtext).
  • The rules' own examples: they now use ``CMD`SETRANK``.
  • WritingCheck: it now also flags two things, which get the existing one-shot rewrite:
    • A backtick left in the prose that's neither inside a code span or block nor escaped.
    • A single-backtick span with a letter or digit against both ends, like DATA`42`TO. That's an attribute tree written as plain text.

Sources for the rules

  • Discord's own help article, "Markdown Text 101", covers the syntax list and says that inline code and blocks use backticks. It doesn't cover escaping or how to put a backtick inside inline code.
  • For those, I used simple-markdown, the parser Discord's Markdown is based on.
    • Inline code is /^(`+)([\s\S]*?[^`])\1(?!`)/, so a span closes on a backtick run as long as the one that opened it.
    • A space next to a delimiting backtick is dropped.
    • \ escapes any punctuation character: /^\\([^0-9A-Za-z\s])/.

Testing

  • Two new WritingCheckTests groups, covering both ways softcode ends up outside code and the coded forms that must pass. They failed to build before BacktickOutsideCode existed.
  • A PromptTests check that the Discord formatting section is present and the bare example is gone.
  • 99 tests pass and dotnet format --verify-no-changes is clean.
  • Nothing tests the model's replies offline. After you redeploy, ask a question about attribute trees to see it in Discord.

🤖 Generated with Claude Code

Softcode's backticks, asterisks and underscores are Discord formatting,
so an attribute tree written as plain text came out as broken inline
code. The prompt now has a Discord formatting section, its own examples
use double backticks, and WritingCheck sends back a reply with a stray
backtick or a tree like DATA`42`TO outside code for one rewrite.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@HarryCordewener HarryCordewener self-assigned this Dec 2, 2026
@coderabbitai

coderabbitai Bot commented Dec 2, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

  • Run on-demand review

This review includes 5 billable files and costs up to $1.25.

  • Ask an admin to make reviews automatic

Open in CodeRabbit

Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing.

Or wait 29 minutes for your next included review.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available. Your 62 included PR review attempts over the past 7 days set your current allowance at 1 review per hour.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Essentials
  • Run ID: 58e9177c-5c70-46c5-9e8b-c5b7aa02d286
Commits

Reviewing files that changed from the base of the PR and between c428d6e and 4603db1.

Files selected for processing: 5

  • CHANGELOG.md
  • src/Sharpie.Core/Answering/SharpiePrompt.cs
  • src/Sharpie.Core/Answering/WritingCheck.cs
  • tests/Sharpie.Tests/PromptTests.cs
  • tests/Sharpie.Tests/WritingCheckTests.cs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@HarryCordewener
HarryCordewener added this pull request to stack #13 December 2, 2026 22:57
@HarryCordewener
HarryCordewener marked this pull request as ready for review December 2, 2026 22:57
@HarryCordewener
HarryCordewener merged commit 2bbb770 into main Dec 2, 2026
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