Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
126 changes: 108 additions & 18 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 31 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,28 +27,38 @@ all-languages = [
"lang-clojure",
"lang-cpp",
"lang-css",
"lang-dockerfile",
"lang-elm",
"lang-go",
"lang-haskell",
"lang-html",
"lang-java",
"lang-javascript",
"lang-json",
"lang-kotlin",
"lang-lua",
"lang-make",
"lang-mq",
"lang-ocaml",
"lang-php",
"lang-python",
"lang-ruby",
"lang-rust",
"lang-scala",
"lang-sql",
"lang-swift",
"lang-toml",
"lang-typescript",
"lang-yaml",
"lang-elixir",
]
default = ["lang-rust", "lang-javascript", "lang-typescript", "lang-python", "lang-json", "lang-bash", "lang-html", "lang-css", "lang-mq", "lang-elixir"]
default = ["lang-rust", "lang-javascript", "lang-typescript", "lang-python", "lang-json", "lang-bash", "lang-html", "lang-css", "lang-mq", "lang-elixir", "lang-yaml", "lang-toml", "lang-ruby", "lang-sql"]
lang-bash = ["dep:tree-sitter-bash"]
lang-c = ["dep:tree-sitter-c"]
lang-clojure = ["dep:tree-sitter-clojure"]
lang-cpp = ["dep:tree-sitter-cpp"]
lang-css = ["dep:tree-sitter-css"]
lang-dockerfile = ["dep:tree-sitter-containerfile"]
lang-elixir = ["dep:tree-sitter-elixir"]
lang-elm = ["dep:tree-sitter-elm"]
lang-go = ["dep:tree-sitter-go"]
Expand All @@ -57,13 +67,21 @@ lang-html = ["dep:tree-sitter-html"]
lang-java = ["dep:tree-sitter-java"]
lang-javascript = ["dep:tree-sitter-javascript"]
lang-json = ["dep:tree-sitter-json"]
lang-kotlin = ["dep:tree-sitter-kotlin-ng"]
lang-lua = ["dep:tree-sitter-lua"]
lang-make = ["dep:tree-sitter-make"]
lang-mq = ["dep:tree-sitter-mq"]
lang-ocaml = ["dep:tree-sitter-ocaml"]
lang-php = ["dep:tree-sitter-php"]
lang-python = ["dep:tree-sitter-python"]
lang-ruby = ["dep:tree-sitter-ruby"]
lang-rust = ["dep:tree-sitter-rust"]
lang-scala = ["dep:tree-sitter-scala"]
lang-sql = ["dep:tree-sitter-sequel"]
lang-swift = ["dep:tree-sitter-swift"]
lang-toml = ["dep:tree-sitter-toml"]
lang-toml = ["dep:tree-sitter-toml-ng"]
lang-typescript = ["dep:tree-sitter-typescript"]
lang-yaml = ["dep:tree-sitter-yaml"]

[dependencies]
clap = {version = "4.6.1", features = ["derive"]}
Expand All @@ -77,6 +95,7 @@ tree-sitter = "0.25.10"
tree-sitter-bash = {version = "0.25", optional = true}
tree-sitter-c = {version = "0.24", optional = true}
tree-sitter-clojure = {version = "0.1.0", optional = true}
tree-sitter-containerfile = {version = "0.8", optional = true}
tree-sitter-cpp = {version = "0.23.4", optional = true}
tree-sitter-css = {version = "0.25", optional = true}
tree-sitter-elixir = {version = "0.3.5", optional = true}
Expand All @@ -88,13 +107,22 @@ tree-sitter-html = {version = "0.23", optional = true}
tree-sitter-java = {version = "0.23", optional = true}
tree-sitter-javascript = {version = "0.25", optional = true}
tree-sitter-json = {version = "0.24", optional = true}
tree-sitter-kotlin-ng = {version = "1.1", optional = true}
tree-sitter-lua = {version = "0.5", optional = true}
tree-sitter-make = {version = "1.1", optional = true}
tree-sitter-mq = {version = "0.1.10", optional = true}
tree-sitter-ocaml = {version = "0.25.0", optional = true}
tree-sitter-php = {version = "0.24", optional = true}
tree-sitter-python = {version = "0.25.0", optional = true}
tree-sitter-ruby = {version = "0.23", optional = true}
tree-sitter-rust = {version = "0.24", optional = true}
tree-sitter-scala = {version = "0.26", optional = true}
tree-sitter-sequel = {version = "0.3", optional = true}
tree-sitter-swift = {version = "0.7.3", optional = true}
tree-sitter-toml = {version = "0.20.0", optional = true}
tree-sitter-toml-ng = {version = "0.7", optional = true}
tree-sitter-typescript = {version = "0.23.2", optional = true}
tree-sitter-yaml = {version = "0.7", optional = true}
unicode-width = "0.2.2"
viuer = {version = "0.11"}

[dev-dependencies]
Expand Down
45 changes: 37 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ Built with [mq](https://github.com/harehare/mq) - jq-like command-line tool for

## Features

- 🎨 **Syntax Highlighting**: Tree-sitter powered syntax highlighting for 13+ programming languages
- 📝 **Rich Markdown Rendering**: Support for headers, lists, code blocks, links, images, and more
- 🔔 **GitHub-style Callouts**: NOTE, TIP, IMPORTANT, WARNING, CAUTION
- 🎨 **Syntax Highlighting**: Tree-sitter powered syntax highlighting for 29+ programming and config languages
- 📝 **Rich Markdown Rendering**: Support for headers, lists, code blocks, links, images, tables, and more
- 🧜 **Mermaid Diagrams**: Best-effort ASCII-art rendering of simple `graph`/`flowchart` blocks
- 🔔 **GitHub-style Callouts**: NOTE, TIP, IMPORTANT, WARNING, CAUTION, rendered as wrapped, bordered boxes
- 🔗 **Clickable Links**: Terminal hyperlinks using OSC 8

## Installation
Expand Down Expand Up @@ -43,11 +44,22 @@ cargo install --git https://github.com/harehare/mq-view.git

## Supported Languages

- Rust, JavaScript, TypeScript (+ TSX)
- Python, Go, Java
- C, C++
- HTML, CSS, JSON
- Bash/Shell
Enabled by default:

- Rust, JavaScript, TypeScript (+ TSX), Python
- HTML, CSS, JSON, YAML, TOML
- Bash/Shell, Ruby, SQL
- Elixir, mq

Available with the `all-languages` feature:

- Go, Java, Kotlin, Scala
- C, C++, Swift
- PHP, Lua, Clojure, Haskell, OCaml, Elm
- Dockerfile, Makefile

See `Cargo.toml` for the full list of `lang-*` feature flags if you only need
one or two extra languages instead of all of them.

## Usage

Expand All @@ -65,6 +77,23 @@ Pipe markdown content:
echo "# Hello\n\n\`\`\`rust\nfn main() {}\n\`\`\`" | mq-view
```

### Mermaid Diagrams

Fenced code blocks tagged ` ```mermaid ` are rendered as ASCII art instead of
plain text when the diagram is a simple `graph`/`flowchart`:

```mermaid
graph TD
A[Start] --> B{Is it working?}
B -->|Yes| C[Great success]
B -->|No| D[Debug it]
```

This only understands a small subset of mermaid flowchart syntax (nodes,
shapes, and edges with optional labels). Other diagram types (sequence,
class, gantt, ...) and advanced flowchart syntax fall back to a regular,
syntax-highlighted code block.

## License

MIT
Binary file modified assets/demo.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading