### Question:
PotentialBracketEndDelimiter extends InlineWithText { String toReferenceName(String stringWithBackslashEscapes) { String referenceName = stringWithBackslashEscapes.replaceAll("(?s)\\\\(\\[|\\])", "$1").replaceAll("\\s+", " "); if (CharMatcher.WHITESPACE.matchesAllOf(referenceName)) { return null; } return referenceName; } PotentialBracketEndDelimiter(Line line, int offset); @Override void emit(DocumentBuilder builder); @Override void apply(ProcessingContext context, List<Inline> inlines, Cursor cursor); void truncate(List<Inline> inlines, int indexOfOpeningDelimiter);  }### Answer:
@Test public void unescapeBackslashEscapeBrackets() { PotentialBracketEndDelimiter delimiter = new PotentialBracketEndDelimiter(line, 0); assertEquals("a[b", delimiter.toReferenceName("a\\[b")); assertEquals("a]b", delimiter.toReferenceName("a\\]b")); assertEquals("a\\!b", delimiter.toReferenceName("a\\!b")); assertEquals("a\\![b c", delimiter.toReferenceName("a\\![b\n c")); }