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.3.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.3-py3-none-any.whl (7.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: sheetah-0.1.3.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.3.tar.gz
Algorithm Hash digest
SHA256 9e4f8bea811e8d230c01a5f77ec7f9e9687af6771d21b1096a79db2d1eedb40f
MD5 e3b98b6f759801eca19d1f7c219abc45
BLAKE2b-256 d7ffbe960acb51031dead0ff2fd597b57be56365cf76ecae1aa3f416bb93b07e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: sheetah-0.1.3-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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 d7c2d2a9f86c1b009a659f9802aaf986dd7d46bb9943fb4a19442e28dc57c400
MD5 f7b5d8aa022886932e738f2dad21ec71
BLAKE2b-256 3db387d12f13ac50d875176fadd368cbae83b9e9afc2a31719adb7bac8ff17b7

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