import re


def _snippet_items(snippet):
    """Return all markdown items in the snippet text.

    For this we expect it the snippet to contain *nothing* but a markdown list.
    We do not support "indented" list style, only one item per linebreak.

    Raises SyntaxError if snippet not in proper format (e.g. contains
        anything other than a markdown list).
    """
    unformatted = snippet.text and snippet.text.strip()

    # treat null text value as empty list
    if not unformatted:
        return []

    # parse out all markdown list items
    items = re.findall(r'^[-*+] +(.*)$', unformatted, re.MULTILINE)

    # if there were any lines that didn't yield an item, assume there was
    # something we didn't parse. since we never want to lose existing data
    # for a user, this is an error condition.
    if len(items) < len(unformatted.splitlines()):
        raise SyntaxError('unparsed lines in user snippet: %s' % unformatted)

    return items