Skip to content

Support Typst (.typ) documents in file detection #2826

Open

Description

@bergmorten

Summary

Graphify currently does not classify Typst source files (.typ) as documents, so repositories that author reports/specs/datasheets in Typst lose those files from semantic document ingestion.

I hit this in a hardware/firmware repository where the main technical report is authored in Typst. Markdown and generated PDFs were picked up, but the source .typ chapters were invisible to Graphify.

Current behavior

On the published package I was using (graphifyy 0.8.38), classify_file(Path("main.typ")) returns None.

Upstream main appears to have the same gap in graphify/detect.py:

DOC_EXTENSIONS = {'.md', '.mdx', '.qmd', '.skill', '.txt', '.rst', '.html', '.yaml', '.yml'}

There is no .typ entry, so Typst files are skipped during detect(...) and do not reach semantic extraction.

Expected behavior

.typ files should be treated as document/prose inputs, roughly like Markdown/RST/HTML:

classify_file(Path("main.typ")) == FileType.DOCUMENT

Minimal repro

mkdir /tmp/graphify-typst-repro
cat >/tmp/graphify-typst-repro/main.typ <<'TYP'
= Test Report

This is prose documentation authored in Typst.
TYP

graphify /tmp/graphify-typst-repro --no-viz

Expected: main.typ appears in the document set and contributes semantic nodes/edges.

Actual: no supported document is detected from the .typ file alone.

Suggested fix

The minimal fix may be as small as:

  1. Add .typ to DOC_EXTENSIONS in graphify/detect.py.
  2. Add a unit test asserting .typ files classify as FileType.DOCUMENT and appear in detect(...) output.

A richer follow-up could add Typst-aware text cleanup, but simple document classification would already make Typst-authored repos much more usable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions