DEV Community

Cover image for A better pkg.go.dev
JackTT
JackTT

Posted on

2 1 1

A better pkg.go.dev

#go

About pkgo.dev

I have never been able to read a package's documentation on pkg.go.dev since all the code there is in black & white...
Image description

This is the reason I created this repository to make it possible to read.

Image description

Usage

Every time you want to read a package's documentation, you just need to replace pkg.go.dev with pkgo.dev. (remove the .g).

E.g.

How it works

We use Nginx as proxy server.

Every time a request come in, we forward it to the pkg.go.dev server, then append the highlight.js script to the response before sending it back to the client.

Since some README files do not specify the code language, we also update <code> tags to <code class="language-go"> to enable syntax highlighting.

If you don't trust me, no worry, you can deploy it yourself:

  • Append 127.0.0.1 pkg.go.dev.local to /etc/hosts
  • Run docker-compose up -d --build
  • Access http://pkg.go.dev.local

Source code

https://github.com/huantt/better-pkg-go-dev

GitHub logo huantt / better-pkg-go-dev

Make pkg.go.dev more readable

About

I have never been able to read a package's documentation on pkg.go.dev since all the code there is in black & white... original.png

This is the reason I created this repository to make it possible to read.

original.png

Usage

Every time you want to read a package's documentation, you just need to replace pkg.go.dev with pkgo.dev. (remove the .g).

How it works

We use Nginx as proxy server.

Every time a request come in, we forward it to the pkg.go.dev server, then append the highlight.js script to the response before sending it back to the client.

Since some README files do not specify the code language, we also update <code> tags to <code class="language-go"> to enable syntax highlighting.

If you don't trust me, no worry, you can deploy it yourself:

  • Append 127.0.0.1 pkg.go.dev.local to /etc/hosts
  • Run docker-compose up -d --build
  • Access http://pkg.go.dev.local



AWS Security LIVE!

Join us for AWS Security LIVE!

Discover the future of cloud security. Tune in live for trends, tips, and solutions from AWS and AWS Partners.

Learn More

Top comments (1)

Collapse
 
lechuhuuha profile image
lechuhuuha • Edited

Nice repo! However, I noticed some issues when using dark mode—looks like it could use some CSS refinements to improve the styling.
I see the repo use highlightjs.
It can change theme based on user preferences
stackoverflow.com/a/59945508/14820892

Image description

👋 Kindness is contagious

If this article connected with you, consider tapping ❤️ or leaving a brief comment to share your thoughts!

Okay