Studd snið¶
snapper classifies text into prose regions (reflowed at sentence boundaries), structure regions (passed through unchanged), and code regions (fenced or delimited source blocks).
Code regions keep fence/open/close lines as structure; the body reflows comment lines when [code.<lang>] is configured, and may run an external formatter when --format-code is set.
The classification depends on the format.
Org-mode (--format org)¶
Uppbyggingarsvæði (varðveitt)¶
Non-source
#+BEGIN_*…
#+END_* blocks (example, quote, etc.)
:PROPERTIES:…
:END: skúffur
#+KEYWORD:lýsiorð (TITLE, AUTHOR, DATE, OPTIONS, o.fl.)Töflulínur (línur sem byrja á
|)Athugasemdarlínur (byrja á
#en ekki#+)Full headline lines (stars, optional TODO keyword, and title text)
Listaatriðamerki (
-,+,1.)LaTeX environments (
\begin{equation}…\end{equation},\begin{align}, etc.)Display math (
\[…\])Inline export snippets (
@@latex:\newpage@@,@@html:<br>@@)
Code regions (#+BEGIN_SRC … #+END_SRC)¶
Header and footer lines are structure
Body non-comment lines pass through verbatim
Body comment lines reflow at sentence boundaries when the language has
line_commentand/orblock_commentunder[code.<lang>]With
--format-code, optionalformatterargv runs on the body (graceful fallback on failure)
Textasvæði (endurflætt)¶
Málsgreinatexti
Texti listaatriðis (á eftir merkinu)
Innleidd tákn (haldin óbrotin)¶
Þessum táknum innan texta er ekki skipt á milli lína:
Tenglar:
[[url][description]]Emphasis:
\*bold*,/italic/,_underline_,+strike+Innleiður kóði:
~code~,==verbatim==Inline export snippets:
@@backend:value@@URLs:
https://...(trailing sentence punctuation not swallowed)
LaTeX (--format latex)¶
Uppbyggingarsvæði (varðveitt)¶
Formáli (allt á undan
\begin{document})Non-prose environments: equation, align, figure, table, tabular, tikzpicture, and their starred variants (plus other non-code envs)
Sýnistærðfræði:
\[...\]Athugasemdarlínur (byrja á
%)\end{document}Full sectioning command lines (
\section{...},\subsection{...}, and friends, including title text)
Code regions (minted, lstlisting, verbatim)¶
\\begin{...}/\\end{...}lines are structureBody follows the same comment-reflow and optional
--format-coderules as other formats when language is known (mintedlanguage arg,lstlistinglanguage=option)
Textasvæði (endurflætt)¶
Meginmálstexti á milli uppbyggingareininga
Markdown (--format markdown)¶
Uppbyggingarsvæði (varðveitt)¶
Framefni (
---eða+++afmarkað í byrjun skráar)Full ATX heading lines (
#…######including title text)Setext headings (title line plus
====or —— underline)Listaatriðamerki (
-,\*,+,1.)Pipe tables
Code regions (fenced ``` / ~~~)¶
Opening and closing fence lines are structure
Indented fence bodies preserve indentation on reflowed comment lines
Language from the fence info string selects
[code.<lang>]; unknown or missing lang passes the body through unchanged (unless--format-codeis not applicable without a formatter entry)
Textasvæði (endurflætt)¶
Málsgreinatexti
Texti listaatriðis (á eftir merkinu)
reStructuredText (--format rst)¶
Uppbyggingarsvæði (varðveitt)¶
Non-code directives (
.. math::,.. image::, etc.) and their indented bodiesLiteral 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+)
Code regions (.. code-block:: LANG)¶
Directive line and trailing blank handling stay structure
Indented body uses the language token for
[code.<lang>]comment reflow and optional--format-code
Textasvæði (endurflætt)¶
Paragraph text between structural elements
Auto-detection¶
Extensions: .rst, .rest
Ósniðinn texti (--format plaintext)¶
Allt er texti. Auðar línur eru varðveittar sem málsgreinaskil.
Setningargreining¶
snapper uses Unicode UAX #29 sentence boundary detection as a baseline (or optional --neural / nnsplit), then applies the same post-pipeline: abbreviation merges, then delimiter-span rejoin so dialogue and balanced ()[]{} spans are not fractured.
Delimiter-span policy (residual cases)¶
Balanced ASCII/curly/guillemet quotes, LaTeX ``
…'', and()[]{}must not gain a semantic line break mid-span (seetests/sentence_delim_props.rs).Unclosed
"(or open‘without’) glues the rest of the paragraph; snapper does not invent closers.Nested semantic ASCII quotes (
say "hi" nowwith an inner pair) remain toggle-ambiguous; prefer typographic quotes or escapes in source.Apostrophes in contractions (
don't,it's) are not treated as dialogue openers.Markdown fences (
```) are not treated as LaTeX``openers.--neuralruns the same abbreviation + span post-pipeline after the model proposes cuts (English papers can still prefer the rules path for fully offline, deterministic CI).
snapper merges false splits caused by known abbreviations:
Titlar¶
Mr., Mrs., Ms., Dr., Prof., Sr., Jr., St., Rev., Gen., o.fl.
Fræðilegt¶
Fig., Figs., Eq., Eqs., Ref., Refs., Tab., Sec., Ch., Vol., No., Thm., Lem., Prop., Def., Cor., Rem., Ex.
Latneskt¶
e.g., i.e., et al., cf., etc., viz., ibid., ca., approx.
Stakir upphafsstafir¶
A., B., C., … Z.
Dagsetning og tími¶
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.