https://github.com/kach/englipsum
Usable loremtext
https://github.com/kach/englipsum
Last synced: 28 days ago
JSON representation
Usable loremtext
- Host: GitHub
- URL: https://github.com/kach/englipsum
- Owner: kach
- License: mit
- Created: 2014-10-05T21:38:31.000Z (over 11 years ago)
- Default Branch: gh-pages
- Last Pushed: 2014-10-07T03:41:36.000Z (over 11 years ago)
- Last Synced: 2025-10-30T22:53:39.022Z (7 months ago)
- Language: JavaScript
- Size: 184 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# Englipsum
See http://hardmath123.github.io/englipsum.
## Usage
Simply include `englipsum.js` in your HTML file:
```html
```
OR (an easy-to-remember-but-not-guaranteed-to-always-exist alternative)
```html
```
OR (an it-works-offline-but-I-need-to-download-a-file alternative)
```html
$ curl https://github.com/Hardmath123/englipsum/raw/gh-pages/englipsum.js > englipsum.js
```
Elements of class `englipsum` will be populated with placeholder text automatically.
```html
```
You can customize settings by including JSON in the element:
```html
{
"paragraphs": 3,
"links": true
}
```
## Reference
| Property | Value |
| ------------ | ----- |
| `paragraphs` | The number of paragraphs to generate |
| `sentences` | The number of sentences per paragraph |
| `links` | Generate random links? (they are uniquely stamped so that testing `a:visited` is easy) |
| `ems` | Italicize random words? |
| `dict` | Provide your own dictionary. Object with fields (all optional) `nouns`, `verbs`, `adjs`, `advs` |
| `dict` | Reference a provided dictionary. Possible values: `"farm"` |
## Examples
Create a to-do list:
```html
- {"sentences": 1, "paragraphs": 1}
- {"sentences": 1, "paragraphs": 1}
- {"sentences": 1, "paragraphs": 1}
- {"sentences": 1, "paragraphs": 1}
```
Placeholder text about animals:
```html
{
"dict": {
"nouns": ["cow", "pig", "sheep", "fish"],
"verbs": ["eats", "hunts", "protects", "kills", "loves", "adores", "licks"]
}
}
```
## How does this thing work?
Short answer: by not using Markov chains.
Less short answer: Englipsum contains lots of templates, which reference other templates recursively (for example, the template for a sentence references the template for a noun and a verb). The generator walks this template-tree, choosing random paths when asked to branch. It's the opposite of parsing.
## Node
Englipsum is published on `npm`. I'm not sure how it'll help you, but feel free to `npm install englipsum`. Maybe someone will invent a good lipsum command-line tool someday.
## Contributing
Yeah. PRs are appreciated. Ideally, there would be larger dictionaries, and more phrases.