private boolean destination(Scanner scanner) {
        scanner.whitespace();
        Position start = scanner.position();
        if (!LinkScanner.scanLinkDestination(scanner)) {
            return false;
        }

        String rawDestination = scanner.getSource(start, scanner.position()).getContent();
        destination = rawDestination.startsWith("<") ?
                rawDestination.substring(1, rawDestination.length() - 1) :
                rawDestination;

        int whitespace = scanner.whitespace();
        if (!scanner.hasNext()) {
            // Destination was at end of line, so this is a valid reference for sure (and maybe a title).
            // If not at end of line, wait for title to be valid first.
            referenceValid = true;
            paragraphLines.clear();
        } else if (whitespace == 0) {
            // spec: The title must be separated from the link destination by whitespace
            return false;
        }

        state = State.START_TITLE;
        return true;
    }
@Test
    public void testDestination() {
        parse("[foo]: /url");
        assertEquals(State.START_TITLE, parser.getState());
        assertParagraphLines("", parser);

        assertEquals(1, parser.getDefinitions().size());
        assertDef(parser.getDefinitions().get(0), "foo", "/url", null);

        parse("[bar]: </url2>");
        assertDef(parser.getDefinitions().get(1), "bar", "/url2", null);
    }