diff --git a/README.md b/README.md index c580bef..6e2ddc3 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -mdq - Markdown Query +# mdq - Markdown Query `mdq` is a command-line tool for searching, filtering, and highlighting content within Markdown files. It allows you to query markdown documents for specific terms and returns results with context, including headings and list items. @@ -8,6 +8,59 @@ Features - Highlight results: Search results are highlighted for better visibility using ANSI color codes. - Contextual results: Display surrounding context around matches, such as parent headings or list items. - Support for multiple search terms: Search for more than one term at once. +<<<<<<< HEAD +======= +- No dependencies: `mdq` is built using Python's standard libraries, so it’s easy to set up and use. + +Installation + +Option 1: Install via `pipx` (Recommended) + +`pipx` is a great way to install Python applications globally while keeping them isolated from the system environment. + +1. Install `pipx` if it's not already installed: + ```bash + sudo apt install pipx + ``` + +2. Install `mdq`: + ```bash + pipx install git+https://git.xle.sh/xle/mdq.git + ``` + +Option 2: Install in a Virtual Environment + +1. Create a virtual environment: + ```bash + python3 -m venv mdq-env + ``` + +2. Activate the virtual environment: + ```bash + source mdq-env/bin/activate + ``` + +3. Install `mdq` locally: + In the root of the repository (where `setup.py` is): + ```bash + pip install . + ``` + +4. Run the `mdq` command: + ```bash + mdq "search term" + ``` + +Option 3: Install Globally (Not Recommended) + +If you really want to install `mdq` globally on your system, you can override the restrictions by running: + +```bash +sudo pip install . --break-system-packages +``` + +Note: This method is not recommended, as it may interfere with system-managed Python packages. +>>>>>>> 38b7a94f22720c5ce085c217edbc49a93f326c9c Usage @@ -16,23 +69,49 @@ Once installed, you can use the `mdq` command to search through markdown files. Basic Search ```bash +<<<<<<< HEAD mdq "search term" --file /path/to/your/markdown/files/*.md +======= +cat /path/to/your/markdown/files/*.md | mdq search_term +>>>>>>> 38b7a94f22720c5ce085c217edbc49a93f326c9c ``` -This will search for the term `"search term"` in all `.md` files in the specified directory. +This will search for the term `"search_term"` in all `.md` files in the specified directory. Multiple Search Terms ```bash +<<<<<<< HEAD mdq "term1" "term2" --file /path/to/your/markdown/files/*.md +======= +cat /path/to/your/markdown/files/*.md | mdq search_term_1 search_term_2 +>>>>>>> 38b7a94f22720c5ce085c217edbc49a93f326c9c ``` -This will search for both `"term1"` and `"term2"` in the specified markdown files and show the results for both. +This will search for both `"search_term_1"` and `"search_term_2"` in the specified markdown files and show the results for both. Search with Context By default, the results will show the keyword matches with surrounding context (headings and list items). You can adjust the context size and highlighting options through various flags. +<<<<<<< HEAD +======= +Flags + +- `--raw`: Output results without any highlighting (for raw output). + + Example: + ```bash + cat /path/to/your/markdown/files/*.md | mdq --raw search_term + ``` + +- `--help`: Display help message with available options. + + Example: + ```bash + mdq --help + ``` +>>>>>>> 38b7a94f22720c5ce085c217edbc49a93f326c9c Example @@ -55,7 +134,7 @@ If you have a Markdown file like this: Running the following command: ```bash -mdq "production" /path/to/your/file.md +cat /path/to/your/markdown/file.md | mdq production ``` Will output something like: