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

Uploaded Python 3

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

Hashes for sheetah-0.2.0.tar.gz
Algorithm Hash digest
SHA256 c35e4237ad08ee6d41893fb0487074e16589584612cb174532b4f87c2186fa25
MD5 cc66cefb456d6a656c8c761a4ad33d62
BLAKE2b-256 fb56161a3dfe3a8547f7a07725fc6438e52c79560bf536fc0672f79c3bf3b9a3

See more details on using hashes here.

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

Hashes for sheetah-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ea1efec98dcbcc64ccce585d27eb2511b70e39314536ffa345620cd2efcfb5ea
MD5 fb334528723fb8302011f9f00612055d
BLAKE2b-256 86a254fde8be5ee7ab84472ca62cc77bc1ba24e8455c659f26c19f4f22042792

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