# 使用 Homebrew, apk, apt, dnf, MacPorts, pacman, zypper 安装 source-highlight

查看 source-highlight 的安装路径、可执行文件、元数据以及面向 AI 代理工作流的安全说明。

## 安装

```sh
sudo av install brew:source-highlight
```

其他安装命令:

### macOS

- Homebrew (100%):

```sh
brew install source-highlight
```

  证据: local Homebrew formula metadata

- MacPorts (94%):

```sh
sudo port install source-highlight
```

  证据: MacPorts ports tree: textproc/source-highlight/Portfile from https://api.github.com/repos/macports/macports-ports/git/trees/master?recursive=1

### Linux

- apk (92%):

```sh
sudo apk add source-highlight
```

  证据: Alpine Linux edge package indexes: source-highlight from https://dl-cdn.alpinelinux.org/alpine/edge/main/x86_64/APKINDEX.tar.gz

- Debian apt (92%):

```sh
sudo apt install source-highlight
```

  证据: Debian stable package indexes: source-highlight from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz

- dnf (92%):

```sh
sudo dnf install source-highlight
```

  证据: Fedora Rawhide package metadata: source-highlight from https://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/Everything/x86_64/os/repodata/07190dc5ae9f35ae73866675fed6d95fe6e8d9fe22c9d7cdf85862cb2ed24a4c-primary.xml.zst

- pacman (92%):

```sh
sudo pacman -S source-highlight
```

  证据: Arch Linux sync databases: source-highlight from https://geo.mirror.pkgbuild.com/extra/os/x86_64/extra.db.tar.gz

- zypper (92%):

```sh
sudo zypper install source-highlight
```

  证据: openSUSE Tumbleweed package metadata: source-highlight from https://download.opensuse.org/tumbleweed/repo/oss/repodata/50b07339cb64c8ed4091bdbabddadc1ff5737b090e478818a195b40d8a3292861a879139b4a3987c31109699fde9fbf4a716367ddf4eef77da75f96e3193d6ed-primary.xml.zst

## 软件包事实

- **软件包键:** brew:source-highlight
- **软件包管理器:** Homebrew
- **版本:** 3.1.9
- **来源摘要:** Source-code syntax highlighter
- **主页:** <https://www.gnu.org/software/src-highlite/>
- **最后更新:** 2026-07-12T23:29:51+09:00
- **已生成:** 2026-08-03T19:37:03+00:00

## 可执行文件

- check-regexp (别名)
- cpp2html (别名)
- java2html (别名)
- source-highlight (别名)
- source-highlight-esc.sh (别名)
- source-highlight-settings (别名)
- src-hilite-lesspipe.sh (别名)

## 安装行为

- Bottle: 不可用

## 版本和新鲜度

- 页面生成时间: 2026-08-03
- 管理器版本: 3.1.9
## 项目历史与用法

GNU Source-highlight is a GNU command-line tool and C++ library that turns source files into syntax-highlighted documents in formats such as HTML, ANSI escape sequences, LaTeX, Texinfo, DocBook, ODF, Groff, and others.

### 项目历史

The manual explains that GNU Source-highlight grew out of the older GNU `cpp2html` and `java2html` programs, which were kept as compatibility scripts after the unified `source-highlight` command arrived. The official NEWS file marks version 1.0 as the first Source-highlight release while noting that it already incorporated those earlier tools.

The project moved from a focused source-to-HTML converter into a configurable highlighter: version 2.0 added user-defined input language definitions, version 2.1 added user-defined output language definitions, version 2.2 added ctags-backed cross references, and version 3.0 added a reusable C++ highlighting library.

### 采用历史

The official manual lists many supported languages and output formats, and the NEWS file records additions such as ANSI escape output for `less`, ODF, MediaWiki, HTML5, S-expressions, Groff, Go, Rust, and other language definitions. That breadth made it attractive to distributions and documentation pipelines.

### 使用方式

Users invoke `source-highlight` to convert source code or plain text into highlighted documents. The package also ships helpers such as `check-regexp`, compatibility scripts such as `cpp2html` and `java2html`, and `src-hilite-lesspipe.sh` for viewing highlighted files through `less`.

### 为什么软件包爱好者会关心

Package nerds care because it is a very GNU-flavored packaging specimen: configurable data files, many generated output targets, shell-compatible helper programs, a library split, `less` integration, Savannah hosting, and a user config at `~/.source-highlight/source-highlight.conf`.

### 时间线

- 1999: Copyright period begins in the official NEWS file.
- 1.0: First Source-highlight release, incorporating existing `cpp2html` and `java2html` programs.
- 2.0: User-defined input language definitions added.
- 2.1: User-defined output format definitions added.
- 2.2: ctags-backed cross references added.
- 3.0: C++ library and `source-highlight-settings` added.
- 2015: Manual edition 3.1.8 documented the broad language and output-format set.
- 2023: Savannah ChangeLog shows modernization work requiring C++11 and replacing Boost shared pointers with standard ones.

### Related projects

- `cpp2html` and `java2html` are predecessor/compatibility tools documented by the GNU manual.
- The manual lists related front-ends and integrations such as Source-highlight-qt, QSource-Highlight, SourceHighlightIDE, Ksrc2highlight, Ikiwiki integration, and Perl/PHP/Python bindings.

### 来源

- <https://git.savannah.gnu.org/cgit/src-highlite.git/plain/ChangeLog>
- <https://git.savannah.gnu.org/cgit/src-highlite.git/plain/NEWS>
- <https://www.gnu.org/software/src-highlite/source-highlight.html>


## 安全说明

narrow executable package without higher-risk signals.

- **Geiger 风险:** 绿色 / 低
- narrow executable package without higher-risk signals


## Configuration and credential file locations

These source-backed paths show where this package keeps local settings or durable credentials. Automic Vault can use them as review targets for secret scanning, migration, and command approval.


## Configuration files

- Unix: ~/.source-highlight/source-highlight.conf
## 其他软件包管理器记录

- Debian apt - libsource-highlight-common - 3.1.9-4.3: normalized package name match | Debian stable package indexes: libsource-highlight-common from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz | architecture-independent files for source highlighting library | http://www.gnu.org/software/src-highlite/
- Debian apt - libsource-highlight-dev - 3.1.9-4.3+b1: normalized package name match | Debian stable package indexes: libsource-highlight-dev from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz | development files for source highlighting library | http://www.gnu.org/software/src-highlite/
- Debian apt - libsource-highlight4t64 - 3.1.9-4.3+b1: normalized package name match | Debian stable package indexes: libsource-highlight4t64 from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz | source highlighting library | http://www.gnu.org/software/src-highlite/
- Debian apt - source-highlight - 3.1.9-4.3+b1: normalized package name match | Debian stable package indexes: source-highlight from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz | convert source code to syntax highlighted document | http://www.gnu.org/software/src-highlite/
- Ubuntu apt - libsource-highlight-common - 3.1.9-4.3build1: normalized package name match | Ubuntu 24.04 LTS package indexes: libsource-highlight-common from https://archive.ubuntu.com/ubuntu/dists/noble/main/binary-amd64/Packages.gz | architecture-independent files for source highlighting library | http://www.gnu.org/software/src-highlite/
- Ubuntu apt - libsource-highlight-dev - 3.1.9-4.3build1: normalized package name match | Ubuntu 24.04 LTS package indexes: libsource-highlight-dev from https://archive.ubuntu.com/ubuntu/dists/noble/main/binary-amd64/Packages.gz | development files for source highlighting library | http://www.gnu.org/software/src-highlite/
- Ubuntu apt - libsource-highlight4t64 - 3.1.9-4.3build1: normalized package name match | Ubuntu 24.04 LTS package indexes: libsource-highlight4t64 from https://archive.ubuntu.com/ubuntu/dists/noble/main/binary-amd64/Packages.gz | source highlighting library | http://www.gnu.org/software/src-highlite/
- Ubuntu apt - source-highlight - 3.1.9-4.3build1: normalized package name match | Ubuntu 24.04 LTS package indexes: source-highlight from https://archive.ubuntu.com/ubuntu/dists/noble/universe/binary-amd64/Packages.gz | convert source code to syntax highlighted document | http://www.gnu.org/software/src-highlite/
- apk - source-highlight - 3.1.9-r14: normalized package name match | Alpine Linux edge package indexes: source-highlight from https://dl-cdn.alpinelinux.org/alpine/edge/main/x86_64/APKINDEX.tar.gz | Produces a document with syntax highlighting | https://www.gnu.org/software/src-highlite/
- apk - source-highlight-bash-completion - 3.1.9-r14: normalized package name match | Alpine Linux edge package indexes: source-highlight-bash-completion from https://dl-cdn.alpinelinux.org/alpine/edge/main/x86_64/APKINDEX.tar.gz | Bash completions for source-highlight | https://www.gnu.org/software/src-highlite/
- apk - source-highlight-dev - 3.1.9-r14: normalized package name match | Alpine Linux edge package indexes: source-highlight-dev from https://dl-cdn.alpinelinux.org/alpine/edge/main/x86_64/APKINDEX.tar.gz | Produces a document with syntax highlighting (development files) | https://www.gnu.org/software/src-highlite/
- apk - source-highlight-doc - 3.1.9-r14: normalized package name match | Alpine Linux edge package indexes: source-highlight-doc from https://dl-cdn.alpinelinux.org/alpine/edge/main/x86_64/APKINDEX.tar.gz | Produces a document with syntax highlighting (documentation) | https://www.gnu.org/software/src-highlite/
- dnf - source-highlight - 3.1.9-28.fc45: normalized package name match | Fedora Rawhide package metadata: source-highlight from https://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/Everything/x86_64/os/repodata/07190dc5ae9f35ae73866675fed6d95fe6e8d9fe22c9d7cdf85862cb2ed24a4c-primary.xml.zst | Produces a document with syntax highlighting | http://www.gnu.org/software/src-highlite/
- dnf - source-highlight-devel - 3.1.9-28.fc45: normalized package name match | Fedora Rawhide package metadata: source-highlight-devel from https://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/Everything/x86_64/os/repodata/07190dc5ae9f35ae73866675fed6d95fe6e8d9fe22c9d7cdf85862cb2ed24a4c-primary.xml.zst | Development files for source-highlight | http://www.gnu.org/software/src-highlite/
- pacman - source-highlight - 3.1.9-18: normalized package name match | Arch Linux sync databases: source-highlight from https://geo.mirror.pkgbuild.com/extra/os/x86_64/extra.db.tar.gz | Convert source code to syntax highlighted document | https://www.gnu.org/software/src-highlite/
- zypper - libsource-highlight-devel - 3.1.9-5.19: normalized package name match | openSUSE Tumbleweed package metadata: libsource-highlight-devel from https://download.opensuse.org/tumbleweed/repo/oss/repodata/50b07339cb64c8ed4091bdbabddadc1ff5737b090e478818a195b40d8a3292861a879139b4a3987c31109699fde9fbf4a716367ddf4eef77da75f96e3193d6ed-primary.xml.zst | Source Code Highlighting C++ Library | https://www.gnu.org/software/src-highlite


## Combined YAML source

View the package source record on GitHub. [combined/source-highlight.yml](https://github.com/mxcl/pkgdb/blob/main/combined/source-highlight.yml)


## 来源

- pkg.so package database
- Geiger risk classifier
- curated configuration and credential file locations
- curated package history
- pkgdb category and tag curation
- external package-manager database matches
- cross-ecosystem install command graph
