Skip to content

Commit

Permalink
feat: added typst support
Browse files Browse the repository at this point in the history
  • Loading branch information
AlphaJack committed Oct 30, 2024
1 parent c9a168b commit 0c10990
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 1 deletion.
11 changes: 11 additions & 0 deletions tests/input/typst-simple.typ
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// This is a minimal Typst document with multi-level headings and comments

= Document Title

== Heading Level 2

=== Heading Level 3

==== Heading Level 4

=== Heading Level 3
23 changes: 23 additions & 0 deletions tests/reference/typst-simple.typ
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// ┌───────────────────────────────────────────────────────────────┐
// │ Contents of typst-simple.typ │
// ├───────────────────────────────────────────────────────────────┘
// │
// ├──┐Document Title
// │ └──┐Heading Level 2
// │ ├──┐Heading Level 3
// │ │ └── Heading Level 4
// │ └── Heading Level 3
// │
// └───────────────────────────────────────────────────────────────

// This is a minimal Typst document with multi-level headings and comments

= Document Title

== Heading Level 2

=== Heading Level 3

==== Heading Level 4

=== Heading Level 3
2 changes: 1 addition & 1 deletion toc/toc.py
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,7 @@ def _toc_body(self) -> list:
_data = self._read_file()
_lines = _data.splitlines()
match self.extension:
case "ad" | "adoc" | "asc" | "asciidoc":
case "ad" | "adoc" | "asc" | "asciidoc" | "typ":
_newtoc = self._process_increasing(_lines, "=")
case "beancount":
_newtoc = self._process_increasing(_lines, "*")
Expand Down

0 comments on commit 0c10990

Please sign in to comment.