appledoc-快速生成开发文档

简介

appledoc 是一个命令行工具,它可以帮助 Objective-C 开发者从特殊格式的源代码注释中生成类似 Apple 的源代码文档。它的设计目的是在输入时尽可能采 HTML 格式文档,以及完全索引和可浏览的 Xcode 文档集。

安装appledoc

  • 下载代码

git clone git://github.com/tomaz/appledoc.git

  • 进入目录

cd ./appledoc

  • 执行安装脚本

sudo sh install-appledoc.sh

  • 检验是否安装成功

appledoc --version

遇到问题

  • xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance

    解决:

    sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer/

  • The following build commands failed: Ld /tmp/Build/Intermediates.noindex/ArchiveIntermediates/appledoc/IntermediateBuildFilesPath/appledoc.build/Release/appledoc.build/Objects-normal/x86_64/Binary/appledoc normal x86_64 (in target 'appledoc' from project 'appledoc')
    (1 failure)

    解决:

    • 打开编译脚本 /appledoc/install-appledoc.sh
    • 只编译arm64 ARCHS="arm64"

      xcodebuild -workspace appledoc.xcworkspace -scheme appledoc ARCHS="arm64" -derivedDataPath /tmp -configuration Release install

指令用法

  • 参考指令写法1(不生成docset文件)

$ appledoc --no-create-docset --output ./doc --project-name "工程名" --company-id "bundle id" --project-company "公司名" ./

  • 参考指令写法2(不生成docset文件,参数使用“=”等号写法)

$ appledoc --no-create-docset --output="./doc" --project-name="工程名" --company-id="bundle id" --project-company="公司名" ./

  • 参考指令写法3(生成docset文件并指定生成路径)

$ appledoc --output ./doc --project-name "工程名" --company-id "bundle id" --project-company "公司名" ./ --docset-install-path ./doc

支持的注释

/// 这是单行注释。
/** 这也是单行注释 */
/*! 同样是单行注释 */
/** 这也是单行注释,
* 第二行会接上第一行。
*/
/** 第一行是类的简介
在简介的下面,就是类的详细介绍了。
没有间隔换行会被消除,就像Html那样。
下面是常用的markdown语法
- - -
无序列表: (每行以 '*'、'-'、'+' 开头):
* this is the first line
* this is the second line
* this is the third line
有序列表: (每行以 1.2.3、a.b.c 开头):
a. this is the first line
b. this is the secode line
多级列表:
* this is the first line
a. this is line a
b. this is line b
* this is the second line
1. this in line 1
2. this is line 2
标题:
# This is an H1
## This is an H2
### This is an H3
#### This is an h4
##### This is an h5
###### This is an H6
链接:
普通URL直接写上,appledoc会自动翻译成链接: [http:// blog.ibireme.com](http:// blog.ibireme.com)
[这个]([http://example.net/](http://example.net/)) 链接会隐藏实际URL.
表格:
| header1 | header2 | header3 |
|---------|:-------:|--------:|
| normal | center | right |
| cell | cell | cell |
引用:
这里会引用到方法someMethod:,这里会引用到类YYColor``
这里会引用到一个代码块
void CMYK2RGB(float c, float m, float y, float k,
float *r, float *g, float *b) {
*r = (1 - c) * (1 - k);
*g = (1 - m) * (1 - k);
*b = (1 - y) * (1 - k);
}
@since iOS5.0
*/
@interface AppledocExample : NSObject
///这里是属性的说明
@property (nonatomic, strong) NSString *name;
/**
@brief 这里是方法的简介。该Tag不能放到类注释里。
@exception UIColorException 这里是方法抛出异常的说明
@see YYColor
@see someMethod:
@warning 这里是警告,会显示成蓝色的框框
@bug 这里是bug,会显示成黄色的框框
@param red 这里是参数说明1
@param green 这里是参数说明2
@param blue 这里是参数说明3
@return 这里是返回值说明
*/

©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容