Algengar spurningar

Af hverju ekki bara að umbróta við 80 dálka?

Dálkaumbrot valda endurflæði á allri málsgreininni þegar eitt orð breytist. Rýfjarar sjá alla málsgreinina í diff-inu, sem hylur raunverulega breytinguna. Með einni setningu á línu gefur eins orðs breyting eins línu diff.

Hefur þetta áhrif á hvernig skjalið birtist?

No. LaTeX, Org-mode, Markdown, RST, and most prose formats treat single newlines as whitespace. Two consecutive newlines start a new paragraph. Snapper preserves paragraph breaks (blank lines) and only changes where single newlines occur within a paragraph.

Samstarfsfólk mitt notar ekki snapper.

Veldur þetta vandamáli?

:CUSTOMID: collaborators

Nei. Sníðmótunin hefur aðeins áhrif á bil innan málsgreina. Samstarfsfólk getur breytt eins og venjulega og breytingar þeirra sameinast hreint. Notaðu git smudge/clean síu (sjá leiðbeiningar) til fullkomlega gagnsærrar samþættingar.

Why does snapper handle „Dr. Smith“ correctly?

Snapper maintains curated abbreviation lists for English (80+), German, French, Icelandic, and Polish. After Unicode sentence boundary detection, it merges any splits that occurred at known abbreviation periods. Select a language with --lang de (or set lang = "de" in .snapperrc.toml). You can also add project-specific abbreviations via extra_abbreviations in the config file.

Hvað með texta á öðrum tungumáli en ensku?

Snapper supports non-English text in two ways:

  1. Rule-based abbreviation sets for German (de), French (fr), Icelandic (is), and Polish (pl).

Select with --lang de. The Unicode UAX #29 sentence boundary algorithm works across all languages.

  1. Neural sentence detection via nnsplit for 9 languages (en, de, fr, no, sv, zh, tr, ru, uk).

Enable with --neural --lang de. Models download on first use (~4MB, cached).

The rule-based approach handles most academic text well and runs about 40x faster than neural (~5ms vs ~200ms per file; see the neural-detection howto). Use neural for languages where abbreviation rules fall short (Chinese, Turkish, etc.).

Why does snapper conflict with openSUSE?

openSUSE snapper is a different project (Btrfs/LVM volume snapshots) that also installs a snapper binary. This formatter’s crate name is snapper-fmt; installers ship both snapper and snapper-fmt as names for the same program. On systems where openSUSE already owns /usr/bin/snapper, invoke snapper-fmt (or put the TurtleTech install directory first on PATH).

Get ég notað snapper sem forritasafn?

Já. Crate-ið (snapper-fmt) birtir format_text() og allar innri einingar:

use snapper_fmt::{format_text, FormatConfig};
use snapper_fmt::format::Format;

let config = FormatConfig {
    format: Format::Org,
    ..Default::default()
};
let output = format_text(input, &config).unwrap();

Hversu hratt er það?

Snapper processes typical academic papers (10-50 pages) in under 10ms with the rule-based splitter. Neural mode adds ~200ms per file (model load + inference via tract, pure Rust ONNX). No external runtime dependencies.

Hvað með CRLF línuendingar?

Snapper greinir línuendingarvenju inntaksins (LF eða CRLF) og varðveitir hana í úttaki. Innbyrðis staðlar vinnslan á LF og umbreytir aftur áður en skrifað er.

Can I skip formatting for specific sections?

Yes. Use snapper:off and snapper:on pragmas in comments:

  • Org: # snapper:off / # snapper:on

  • LaTeX: % snapper:off / % snapper:on; % snapper:no-preamble on \input chapters

  • Markdown: <!-- snapper:off --> / <!-- snapper:on -->

  • RST/Plaintext: snapper:off / snapper:on on their own line

Text between these markers passes through unchanged. Useful for poetry, aligned text, or ASCII art.

What formats does snapper support?

Org-mode, LaTeX, Markdown, reStructuredText, and plaintext. Format auto-detects from the file extension (.org, .tex, .md, .rst, .txt). Unknown extensions (.rs, .py, no extension) are refused so source files are not treated as prose. Override with --format rst (or org, latex, markdown, plaintext).

How do I compare versions at the sentence level?

Use snapper sdiff to diff two files at sentence granularity:

snapper sdiff paper_v1.org paper_v2.org

Or diff against a git ref:

snapper git-diff HEAD~1 paper.org

Whitespace reflow produces zero diff. Only actual content changes appear.

Hvernig tilkynni ég villu eða bið um nýjan eiginleika?

Skráðu mál á github.com/TurtleTech-ehf/snapper/issues.