- Report a bug or request a feature
- View project on GitHub
- View project on npm
- Download the latest release
- Install the library using npm or yarn:
npm i @digitallinguistics/scription2dlxyarn add @digitallinguistics/scription2dlx
Or download the latest release from the releases page.
- Import the library into your project:
- The library exports a single function which accepts a string and returns a DaFoDiL Text Object.
--- title: How the world began --- waxdungu qasi one day a man
const data = await ;const text = ;console; // "waxdungu qasi"
You may also pass an options hash as the second option. See the Options section below.
const text = ;
In order to keep this library small and dependency-free,
scription2dlxdoes not automatically parse the YAML header of a scription document. Instead, the header string is returned as a
headerproperty on the text object. If you would like
scription2dlxto parse the header, pass a YAML parser to the
parseroption when calling the
scription2dlxfunction:; // use your preferred YAML parsing libraryconst text = ;
||This option specifies whether the library should throw an error when it encounters an utterance which has a different number of words on each line, or a different number of morphemes in each word. The Leipzig glossing rules state that each line in an interlinear example must have the same number of words and morphemes on each line. By default, this option is set to
||This option allows you to use custom backslash codes in your interlinear glosses. It should be a hash containing the scription code as a key (without a leading backslash), and the custom code as the value; ex:
||A YAML parser to use in parsing the header of a scription document. If none is present, the header will be provided as a string in the
||Whether to parse the utterance metadata line (the first line when it begins with