Text References
At the core of Sefaria's system is the system of text references. Understanding how they work is key to using our API, and our broader codebase.
Text References (a.k.a Citations)
Sefaria depends on the ability to unambiguously refer to particular segments of text in the repository. The implementation of text references in Sefaria has the following goals:
- References should be human and machine readable.
- References should be environment agnostic (i.e., they should not depend on database ids).
- References should flexibly accommodate human variation, such as alternate spellings.
The following are all valid refs:
Bereishit
Job 3
Mishna Berakhot 4.2
Sanhedrin 4b
Ex. 12:2-8
Song_of_Songs.2.4-3.3
Berakhot.2a.10-13
Rashi on Genesis 1:2:1
M. Peah 3
Rambam Laws of Repentance 2:1
Masekhet Shabbat 7b:12-20
Pirkei_Avot_2.1
A valid ref consists of a title string followed optionally by a sections string. A title string is any one of the known text titles or title variants. A section string lists sections of the text.
Section String Separators
Section Strings can be separated by any of the following characters:
Separator | Name | Examples |
---|---|---|
. | Period | Genesis 1.1 Berakhot 2a.1 |
, | Comma | Genesis 1,1 Berakhot 2a,1 |
| Space | Genesis 1 1 Berakhot 2a 1 |
: | Colon | Genesis 1:1 Berakhot 2a:1 |
A ranged text is indicated by use of a -
hyphen character. Some examples of ranged refs:
Genesis 1:1-2
Genesis 1:1-2:1
Rashi on Genesis 1:1:3-2:3:1
Notes
- Talmud references use a special daf syntax, which allows a number plus either 'a' or 'b' (for example:
Shabbat 31a
orPesachim 22b
). - Commentary text names inherit the structure (depth and section names) of their base text and add an additional level called 'Comment'. Thus
Ramban on Genesis 4:5:2
refers to Ramban's second comment on the fifth verse of Genesis Chapter 4. - Within a sections string,
.
,
:
are all interchangeable. - The range separator - should appear 0 or 1 times and should never appear in the title string.
- Spaces may be replaced with _ for better display in URLs, but not by - for the reason above.
Classes of References Not Yet Supported
- Appearance location of reference informs target of the reference, such as
שם
oribid
etc. (Note that partial references can includeלהלן
,לקמן
,בסימן
, etc). - References by Dibbur HaMatchil
- References by Perek Name (i.e.
Keitzad Mevarchim
) - References in the discursive flow of the text
Updated 10 months ago
What’s Next