{"id":16005880,"url":"https://github.com/thibaudcolas/markov_draftjs","last_synced_at":"2026-02-12T19:04:06.565Z","repository":{"id":45172638,"uuid":"108128618","full_name":"thibaudcolas/markov_draftjs","owner":"thibaudcolas","description":"Draft.js sample content generated with Markov chains of Project Gutenberg books.","archived":false,"fork":false,"pushed_at":"2025-02-11T23:09:05.000Z","size":1524,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-29T11:45:56.424Z","etag":null,"topics":["draft-js","markov","markov-chain","react"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/thibaudcolas.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-10-24T13:11:41.000Z","updated_at":"2025-02-11T23:09:08.000Z","dependencies_parsed_at":"2022-09-01T03:50:38.669Z","dependency_job_id":null,"html_url":"https://github.com/thibaudcolas/markov_draftjs","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thibaudcolas%2Fmarkov_draftjs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thibaudcolas%2Fmarkov_draftjs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thibaudcolas%2Fmarkov_draftjs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thibaudcolas%2Fmarkov_draftjs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thibaudcolas","download_url":"https://codeload.github.com/thibaudcolas/markov_draftjs/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247276188,"owners_count":20912288,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["draft-js","markov","markov-chain","react"],"created_at":"2024-10-08T11:22:14.267Z","updated_at":"2026-02-12T19:04:06.560Z","avatar_url":"https://github.com/thibaudcolas.png","language":"JavaScript","readme":"# markov_draftjs [![PyPI](https://img.shields.io/pypi/v/markov_draftjs.svg)](https://pypi.python.org/pypi/markov_draftjs) [![npm](https://img.shields.io/npm/v/markov_draftjs.svg)](https://www.npmjs.com/package/markov_draftjs)\n\n\u003e Draft.js sample content generated with [Markov chains](https://en.wikipedia.org/wiki/Markov_chain) of [Project Gutenberg](https://www.gutenberg.org/) books.\n\nThis sample content is meant to be used while testing projects based on Draft.js, in particular [Draftail](https://www.draftail.org/) and [draftjs_exporter](https://github.com/springload/draftjs_exporter).\n\n## Why\n\nSample content can be useful to stress-test and benchmark tools built to handle Draft.js content. For the exporter, this is a great way to reliably assess its performance.\n\nThe content from this repository isn't generated randomly – while the text and metadata values are fake, the content’s structure and the distribution of rich text formatting amongst the text is representative of that of 3 big CMS sites combined.\n\nHere are rich text formats used in the content:\n\n- Blocks\n  - `unstyled`\n  - `header-two`\n  - `header-three`\n  - `header-four`\n  - `ordered-list-item`, depth: 0 or 1\n  - `unordered-list-item`, depth: 0 or 1\n  - `atomic`\n- Inline styles\n  - `BOLD`\n  - `ITALIC`\n- Entities\n  - `LINK`, `MUTABLE` with `url` (URL), `linkType` (`page|external|email`), optionally `id` (number)\n  - `DOCUMENT`, `MUTABLE` with `label` (plain text), `id` (string containing a number)\n  - `IMAGE`, `IMMUTABLE` with `title` (plain text), `id` (string containing a number), `src` (URL)\n  - `HORIZONTAL_RULE`, `IMMUTABLE` without data\n\n## Using the sample content\n\nIn order to simplify using the samples across multiple projects, they are published as packages on [npm](https://www.npmjs.com/package/markov_draftjs) and [PyPI](https://pypi.python.org/pypi/markov_draftjs).\n\n```sh\n# JavaScript projects.\nnpm install markov_draftjs\n# Python projects.\npip install markov_draftjs\n```\n\nThen, in JavaScript:\n\n```js\nconst contentStates = require(\"markov_draftjs\");\n```\n\nAnd in Python:\n\n```py\nfrom markov_draftjs import get_content_sample\n\ncontent_states = get_content_sample()\n```\n\nThe sample content is also available from GitHub, eg. with RawGit (warning - big file): [https://cdn.rawgit.com/thibaudcolas/markov_draftjs/44827d98/markov_draftjs/content.json](https://cdn.rawgit.com/thibaudcolas/markov_draftjs/44827d98/markov_draftjs/content.json).\n\n## Development\n\n\u003e Requirements: [`uv`](https://docs.astral.sh/uv/), `fnm`\n\n```sh\ngit clone git@github.com:thibaudcolas/markov_draftjs.git\ncd markov_draftjs/\n\n# Install the git hooks.\n./.githooks/deploy\n\n# Install JavaScript dependencies.\nfnm install\nnpm install\n\n# Unarchive sample text.\ncd corpora/\ntar -xzvf *.tar.gz\ncd ..\n\n# Install the Python environment (creates .venv/).\nuv sync --group dev\n# (Equivalent to running `make init`.)\n\n# Generate new sample content.\nuv run python -X dev -W error example.py\nnpm run start\n```\n\n## Releases\n\n- Use `irish-pub` to confirm the content of the npm package.\n- Make a new branch for the release of the new version.\n- Update the [CHANGELOG](CHANGELOG.md).\n- Update the version number in `pyproject.toml`, `markov_draftjs/__init__.py`, and `package.json`, following semver.\n- Make a PR and squash merge it.\n- Back on main with the PR merged, use `make publish` (powered by `uv publish`) and `npm publish`.\n- Finally, go to GitHub and create a release and a tag for the new version.\n- Done!\n\n## See also\n\n- https://github.com/jsvine/markovify\n- https://github.com/catseye/Guten-gutter\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthibaudcolas%2Fmarkov_draftjs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthibaudcolas%2Fmarkov_draftjs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthibaudcolas%2Fmarkov_draftjs/lists"}