Pomijanie regionów za pomocą pragm¶
Przegląd¶
Czasami trzeba zapobiec przeformatowaniu określonych regionów przez snappera: ręcznie sformatowanej poezji, wyrównanego tekstu, starannie ułożonych tabel w prozie lub dowolnego tekstu, w którym podziały wierszy niosą znaczenie.
Use snapper:off and snapper:on pragmas to mark regions that should pass through unchanged.
LaTeX chapter files included with \input can add % snapper:no-preamble so snapper treats the file as body instead of waiting for \begin{document}.
Składnia według formatu¶
Org-mode¶
Some prose that gets reformatted normally.
# snapper:off
This text will not
be reformatted. Line breaks
are preserved exactly.
# snapper:on
More prose that gets reformatted.
LaTeX¶
Some prose that gets reformatted normally.
% snapper:off
This text will not
be reformatted.
% snapper:on
More prose that gets reformatted.
A \input chapter with no \begin{document} is body by default.
Use % snapper:no-preamble when the file also has \documentclass or you want the flag written down:
% snapper:no-preamble
This sentence is a test. This sentence is also a test.
Markdown¶
Some prose that gets reformatted normally.
<!-- snapper:off -->
This text will not
be reformatted.
<!-- snapper:on -->
More prose that gets reformatted.
reStructuredText¶
A bare line (the same payload as plaintext).
A .. comment is not stripped, so .. snapper:off is not a pragma.
Some prose that gets reformatted normally.
snapper:off
This text will not
be reformatted.
snapper:on
More prose that gets reformatted.
Zwykły tekst¶
Some prose that gets reformatted normally.
snapper:off
This text will not
be reformatted.
snapper:on
More prose that gets reformatted.
Przypadki użycia¶
Poezja lub wiersze z celowymi podziałami wierszy
Grafika ASCII lub diagramy w komentarzach
Starannie wyrównane listy odniesień
Nagłówki licencji ze specyficznym formatowaniem
Tekst, który musi dokładnie odpowiadać zewnętrznemu źródłu
Zagnieżdżanie¶
Pragmy nie zagnieżdżają się. snapper:off wyłącza formatowanie aż do następnego snapper:on. Jeśli plik kończy się bez snapper:on, reszta pliku przechodzi bez zmian.
Interakcja z innymi funkcjami¶
Pragmy mają priorytet nad wszystkimi innymi operacjami parsowania. Wewnątrz regionu wyłączonego nie następuje podział zdań, parser rozpoznający format ani obsługa skrótów. Same linie komentarzy pragm zawsze przechodzą jako struktura.
The pandoc path keeps snapper:off / snapper:on in the written output (the reader would otherwise delete them).
Off-region text is shielded so it is not reflowed.
Pass --native to force today’s line parsers.