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.2.1.tar.gz (5.9 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.2.1-py3-none-any.whl (7.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: sheetah-0.2.1.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

Hashes for sheetah-0.2.1.tar.gz
Algorithm Hash digest
SHA256 33f2b61515aef9787d5cb0c06dd5af736b0d337c52a4e209103d84dc6f4229d5
MD5 11dcd3213e94cd39345f898e7c2bd0d7
BLAKE2b-256 2a8996c14a48ac084eb8312b11ac6e7b3d570565f0dc9ad291e1f41361bebfcf

See more details on using hashes here.

File details

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

File metadata

  • Download URL: sheetah-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 7.5 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.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 58cdc7c888ed8da281c2feb0ab7e4c763071a2b3d38c736fa756c4644241b8d6
MD5 f0ad747b311e5a121253847c43874bbd
BLAKE2b-256 28f9b9e17fda7e5f999681aba6340c166dcd6b26e995e1f8a27cb6f9af6ad167

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