#ifndef HUSH_INLINE_PARSE_H
#define HUSH_INLINE_PARSE_H

typedef enum {
    RUN_PLAIN,
    RUN_BOLD,
    RUN_ITALIC,
    RUN_BOLD_ITALIC,
    RUN_CODE,
    RUN_LINK,      /* also used for bare-URL autolinks: rawStart==contentStart, rawEnd==contentEnd */
    RUN_STRIKE,
    RUN_HIGHLIGHT,
    RUN_SUB,
    RUN_SUPER,
} RunKind;

typedef struct {
    RunKind kind;
    /* Byte range in the block's raw text, INCLUDING markdown markers (e.g. "**bold**"). */
    int rawStart, rawEnd;
    /* Byte range of the actual displayable content, EXCLUDING markers (e.g. "bold"). */
    int contentStart, contentEnd;
} InlineRun;

typedef struct {
    InlineRun *runs;
    int count, cap;
} InlineRunList;

void inline_runs_init(InlineRunList *list);
void inline_runs_free(InlineRunList *list);

/* Parses `text[0..len)` into a sequence of runs covering the whole range with no gaps. */
void inline_parse(const char *text, int len, InlineRunList *out);

#endif
