Skip to main content

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:

  1. Enter a search query at the top.
  2. See results listed with the best match selected by default.
  3. Navigate results with the arrow keys and preview the segment.
  4. Press Enter to copy the selected segment's text to the clipboard.
  5. 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 of Segment instances.
  • 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

sheetah-0.1.1.tar.gz (5.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sheetah-0.1.1-py3-none-any.whl (7.2 kB view details)

Uploaded Python 3

File details

Details for the file sheetah-0.1.1.tar.gz.

File metadata

  • Download URL: sheetah-0.1.1.tar.gz
  • Upload date:
  • Size: 5.7 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

Hashes for sheetah-0.1.1.tar.gz
Algorithm Hash digest
SHA256 c010239ae0628d271603494fc40fbf7b72a31bca6d89b2b1dab4268bb9b8027c
MD5 17d1f70684e5a730b883671f90c1e3f5
BLAKE2b-256 a91be9210525a0d86a546e096993e65cdc1c1c94d020c7b358be684a51f8a1f9

See more details on using hashes here.

File details

Details for the file sheetah-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: sheetah-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 7.2 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

Hashes for sheetah-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 530fb38457590ea8199a4e02ee302b47200033ffef95fddf6be10b718c0702a7
MD5 4ffe18d27ae23e17ca1c39c4fce833d3
BLAKE2b-256 03ec30f688bf011547047c7cfc73e309cfc3ecabb6426b520b08c7b142ad51e6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page