A small toolkit to parse Markdown into searchable segments
Project description
sheetah
sheetah is a lightweight Python library for working with Markdown documents. It splits a Markdown file into segments based on H2 headers ("##"), provides fuzzy search over segment titles and content, and includes an interactive command-line interface with clipboard copy support.
Installation
Install from PyPI:
pip install sheetah
Or install and develop locally in a virtual environment:
cd sheetah
python -m venv .venv
# Windows
. .venv/Scripts/activate
# macOS / Linux
source .venv/bin/activate
python -m pip install -e .[all]
The optional extras include prompt_toolkit and pyperclip for the
interactive UI.
Usage
Programmatic
from sheetah import Document
md = """Introduction
## Section 1
Text1
## Section 2
Text2
"""
doc = Document.from_markdown(md)
print(doc.description)
for seg in doc.search("Text"):
print(seg.name)
print(seg.text())
Command line
sheetah path/to/file.md
The interactive UI lets you:
- Enter a search query at the top.
- See results listed with the best match selected by default.
- Navigate results with the arrow keys and preview the segment.
- Press Enter to copy the selected segment's text to the clipboard.
- Press Ctrl-C or Ctrl-Q to exit.
The document description (everything before the first ##) is shown above
the search input.
API
Document.from_markdown(markdown: str) -> Document— create a document from a Markdown string.Document.items— list ofSegmentinstances.Document.description— Markdown text before the first H2 header.Document.search(query: str, limit: Optional[int] = None)— fuzzy search.Segment.name— segment title (header).Segment.text()— plain-text representation of the segment.Segment.html()— HTML representation of the segment.
Tests
Run the test suite with:
pytest
Contributing
Contributions are welcome. Please open issues or pull requests on GitHub.
License
MIT — see the LICENSE file for details.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sheetah-0.2.0.tar.gz.
File metadata
- Download URL: sheetah-0.2.0.tar.gz
- Upload date:
- Size: 5.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.2 {"installer":{"name":"uv","version":"0.10.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c35e4237ad08ee6d41893fb0487074e16589584612cb174532b4f87c2186fa25
|
|
| MD5 |
cc66cefb456d6a656c8c761a4ad33d62
|
|
| BLAKE2b-256 |
fb56161a3dfe3a8547f7a07725fc6438e52c79560bf536fc0672f79c3bf3b9a3
|
File details
Details for the file sheetah-0.2.0-py3-none-any.whl.
File metadata
- Download URL: sheetah-0.2.0-py3-none-any.whl
- Upload date:
- Size: 7.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.2 {"installer":{"name":"uv","version":"0.10.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ea1efec98dcbcc64ccce585d27eb2511b70e39314536ffa345620cd2efcfb5ea
|
|
| MD5 |
fb334528723fb8302011f9f00612055d
|
|
| BLAKE2b-256 |
86a254fde8be5ee7ab84472ca62cc77bc1ba24e8455c659f26c19f4f22042792
|