Obsługiwane formaty

snapper klasyfikuje tekst na regiony prozy (przeformatowywane na granicach zdań) i regiony strukturalne (przepuszczane bez zmian). Klasyfikacja zależy od formatu.

Org-mode (--format org)

Regiony strukturalne (zachowane)

  • #+BEGIN_*

bloki #+END_* (source, example, quote itp.)

  • :PROPERTIES:

szuflady :END:

  • dyrektywy #+KEYWORD: (TITLE, AUTHOR, DATE, OPTIONS itp.)

  • Wiersze tabeli (linie zaczynające się od |)

  • Linie komentarzy (zaczynające się od #, ale nie #+)

  • Gwiazdki nagłówków i słowa kluczowe TODO

  • Znaczniki elementów listy (-, +, 1.)

  • LaTeX environments (\begin{equation}\end{equation}, \begin{align}, etc.)

  • Display math (\[\])

  • Inline export snippets (@@latex:\newpage@@, @@html:<br>@@)

Regiony prozy (przeformatowywane)

  • Tekst akapitowy

  • Tekst nagłówka (po gwiazdkach i słowie kluczowym)

  • Tekst elementu listy (po znaczniku)

Tokeny inline (zachowane jako niepodzielne)

Te tokeny wewnątrz prozy nie są dzielone między liniami:

  • Linki: [[url][opis]]

  • Kod inline: ~code~, ==verbatim==

  • Inline export snippets: @@backend:value@@

  • URLs: https://... (trailing sentence punctuation not swallowed)

LaTeX (--format latex)

Regiony strukturalne (zachowane)

  • Preambuła (wszystko przed \begin{document})

  • Środowiska nie-prozatorskie: equation, align, figure, table, tabular, lstlisting, verbatim, minted, tikzpicture oraz ich warianty z gwiazdką

  • Wzory wyświetlane: \[...\]

  • Linie komentarzy (zaczynające się od %)

  • \end{document}

Regiony prozy (przeformatowywane)

  • Tekst główny pomiędzy elementami strukturalnymi

Markdown (--format markdown)

Regiony strukturalne (zachowane)

  • Ogrodzone bloki kodu (``` lub ~~~)

  • Front matter (--- lub +++ na początku pliku)

  • Znaczniki nagłówków (#, ## itp.)

  • Znaczniki elementów listy (-, \*, +, 1.)

Regiony prozy (przeformatowywane)

  • Tekst akapitowy

  • Tekst nagłówka (po znaczniku)

  • Tekst elementu listy (po znaczniku)

reStructuredText (--format rst)

Regiony strukturalne (zachowane)

  • Directives (.. code-block::, .. math::, .. image::, etc.) and their indented bodies

  • Literal blocks (text after :: with indented content)

  • Section titles and underlines (===, -----, etc.)

  • Field lists (:Author:, :Date:, etc.)

  • Comments (.. without a directive)

  • Grid and simple tables (lines starting with | or +)

Regiony prozy (przeformatowywane)

  • Paragraph text between structural elements

Auto-detection

Extensions: .rst, .rest

Zwykły tekst (--format plaintext)

Całość traktowana jako proza. Puste linie są zachowane jako separatory akapitów.

Wykrywanie zdań

snapper używa wykrywania granic zdań Unicode UAX #29 jako punktu wyjścia, a następnie łączy fałszywe podziały spowodowane znanymi skrótami:

Tytuły

Mr., Mrs., Ms., Dr., Prof., Sr., Jr., St., Rev., Gen. itp.

Naukowe

Fig., Figs., Eq., Eqs., Ref., Refs., Tab., Sec., Ch., Vol., No., Thm., Lem., Prop., Def., Cor., Rem., Ex.

Łacińskie

e.g., i.e., et al., cf., etc., viz., ibid., ca., approx.

Pojedyncze inicjały

A., B., C., … Z.

Data i czas

Jan., Feb., …, Dec., Mon., Tue., …, Sun., a.m., p.m.

Quoted and parenthesized punctuation

Sentence punctuation inside quotes or parentheses does not trigger a false split when the next word starts lowercase. For example, He said "wow!" and left. stays on one line because "!" followed by lowercase and signals a continuation, not a new sentence. Patterns handled: !", ?", .", !), ?), .), and similar combinations with single quotes or brackets.