diff --git a/docs/doc/convention/app.md b/docs/doc/convention/app.md index 67013c3e..60f1a22d 100644 --- a/docs/doc/convention/app.md +++ b/docs/doc/convention/app.md @@ -89,7 +89,7 @@ exclude: # not support regular expression, .git and __pycache__ is always * All shared data is stored in `/maixapp/share`. * All pictures are stored in `/maixapp/share/picture`. * All video files are stored in `/maixapp/share/video`. -* Temporary data can be stored in `/maixapp/tmp`. +* Temporary data can be stored in `/maixapp/tmp`. Note that this directory is located on the file system (SD card), which differs from the system's `/tmp` directory. The `/tmp` directory on the system is a virtual file system in memory, offering faster read/write speeds but with limited memory size. Large files and log files that need to be stored long-term (which may grow over time) are recommended to be placed in the `/maixapp/tmp` directory. * Font files are stored in `/maixapp/share/font`. * Icon files are stored in `/maixapp/share/icon`. * APP's data files created at runtime can be stored in `/maixapp/apps/app_id/data`. diff --git a/docs/doc_zh/convention/app.md b/docs/doc_zh/convention/app.md index 46bff8c8..4c2ac108 100644 --- a/docs/doc_zh/convention/app.md +++ b/docs/doc_zh/convention/app.md @@ -86,7 +86,7 @@ exclude: # 不支持正则表达式,.git 和 __pycache__ 总是会被排 * 共享数据存储在 `/maixapp/share`。 * 图片文件存储在 `/maixapp/share/picture`。 * 视频文件存储在 `/maixapp/share/video`。 -* 临时数据可以存储在 `/maixapp/tmp`。 +* 临时数据可以存储在 `/maixapp/tmp`,注意,和 Linux 本身的`/tmp` 目录不同的是这个目录是在文件系统(SD卡)上的,系统`/tmp`是在内存上虚拟的文件系统,`/tmp`读写速度更快但是内存大小受限,大文件以及需要长期记录的日志文件(随着时间推移可能变得比较大)建议放在`/maixapp/tmp`目录下。 * 字体文件存储在 `/maixapp/share/font`。 * 图标文件存储在 `/maixapp/share/icon`。 * 应用运行时创建的数据文件可以存储在 `/maixapp/apps/app_id/data`。 diff --git a/tools/doc_tool/gen_markdown.py b/tools/doc_tool/gen_markdown.py index 5590cdf5..96d11f94 100644 --- a/tools/doc_tool/gen_markdown.py +++ b/tools/doc_tool/gen_markdown.py @@ -289,8 +289,25 @@ def gen_md_doc_from_comment(doc_comment): content += _content return content + ids = { + # "module": { + # "id": "Module", + # "count": 1 + # }, + } + def update_id(h_str, id) -> str: + l_id = id.lower() + if l_id not in ids: + ids[l_id] = { + "id": id, + "count": 1 + } + return f'{h_str} {id} {{#{id}}}' + ids[l_id]["count"] += 1 + return f'{h_str} {id} {{#{id}-{ids[l_id]["count"]}}}' + # Module - content += "## Module\n\n" + content += update_id("##", "Module") + "\n\n" _content = "" for key, item in module["members"].items(): if item["type"] != "module": @@ -305,11 +322,11 @@ def gen_md_doc_from_comment(doc_comment): content += "\n\n" # Enum - content += "## Enum\n\n" + content += update_id("##", "Enum") + "\n\n" for key, item in module["members"].items(): if item["type"] != "enum": continue - content += '### {}\n\n'.format(key.replace("_", "\_")) + content += update_id("###", key.replace("_", "\_")) + "\n\n" content += item["doc"].get("brief", "") + "\n\n" content += '| item | describe |\n' content += '| --- | --- |\n' @@ -321,11 +338,11 @@ def gen_md_doc_from_comment(doc_comment): content += "\n\n" # Variable - content += "## Variable\n\n" + content += update_id("##", "Variable") + "\n\n" for key, item in module["members"].items(): if item["type"] != "var": continue - content += '### {}\n\n'.format(key.replace("_", "\_")) + content += update_id("###", key.replace("_", "\_")) + "\n\n" content += item["doc"].get("brief", "") + "\n\n" content += '| item | description |\n' content += '| --- | --- |\n' @@ -336,11 +353,11 @@ def gen_md_doc_from_comment(doc_comment): content += "\n\n" # Function - content += "## Function\n\n" + content += update_id("##", "Function") + "\n\n" def gen_func_info(key, item, overload_count = -1): if overload_count >= 0: key = "{} (overload {})".format(key, overload_count + 1) - content = '### {}\n\n'.format(key.replace("_", "\_")) + content = update_id('###', key.replace("_", "\_")) + "\n\n" if "py_def" in item: content += f'```python\n{item["py_def"]}\n```\n' content += item["doc"].get("brief", "") + "\n\n" @@ -361,11 +378,11 @@ def gen_func_info(key, item, overload_count = -1): content += "\n\n" # Class - content += "## Class\n\n" + content += update_id("##", "Class") + "\n\n" for key, item in module["members"].items(): if item["type"] != "class": continue - content += '### {}\n\n'.format(key.replace("_", "\_")) + content += update_id('###', key.replace("_", "\_")) + "\n\n" content += item["doc"].get("brief", "") + "\n\n" if have_doc_kv(item["doc"]): content += '| item | description |\n' @@ -379,7 +396,7 @@ def gen_class_func_info(key, item, overload_count = -1): raise Exception("class member only support {} now, but got {}".format(supported_types, item["type"])) if overload_count >= 0: key = "{} (overload {})".format(key, overload_count + 1) - content = '#### {}\n\n'.format(key.replace("_", "\_")) + content = update_id('####', key.replace("_", "\_")) + "\n\n" if "py_def" in item: content += f'```python\n{item["py_def"]}\n```\n' content += item["doc"].get("brief", "") + "\n\n"