如何使用`godoc`生成HTML文档? [英] How can I generate HTML documents using `godoc`?

查看:58
本文介绍了如何使用`godoc`生成HTML文档?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经编写了一个小型go程序,我想从源代码生成独立的HTML文档,而无需godoc服务器即可查看该文档.但是我找不到任何方法来实现它.如果有人可以帮助我,我将不胜感激.

I have written a small go program, and I want to generate standalone HTML documents from source code that can be viewed without godoc server. But I can't find any way to achieve it. if anyone could help me, I'll appreciate it.

推荐答案

例如,可以制作一个简单的HTML文档:

A simple HTML documentation can be produced by, for example:

$ godoc -html container/heap Interface > page.html

以下人员可以制作出更好的表格:

A bit better form can by produced by:

$ godoc -url "http://localhost:6060/pkg/container/heap/" > page.html 

(我的Godoc服务器运行在:6060,我不确定这是否是先决条件).

(I have godoc server running at :6060 and I'm not sure if that's a prerequisite).

如果通过调整生成的HTML文件以正确地引用它,将其与Go存储库中找到的原始CSS样式结合使用,HTML可能看起来会更好.

The HTML would probably look better if combined with original CSS styles found in the Go repository by adjusting the produced HTML files to properly refer to it.

这篇关于如何使用`godoc`生成HTML文档?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆