git-trace

romele / git-trace public

62 commits · 1 branch · 1 tag · 1 contributor (top: Romele) · first commit 3d ago · last push 54m ago

src/highlight.h

#ifndef HIGHLIGHT_H
#define HIGHLIGHT_H

#include <stddef.h>

struct buf;

/* Emit HTML-escaped source into b, wrapped in <span class=hl-?> for
 * recognized tokens.  Language is picked from the filename extension;
 * unknown types render as plain escaped text.  The tokenizer is a
 * small state machine — it can be fooled by pathological input but it
 * can never emit unescaped bytes. */
void hl_emit(struct buf *b, const char *data, size_t len,
             const char *path);

#endif