### Bash - 查看和读取分类文档目录 Source: https://context7.com/context7/developers_vivo_doc/llms.txt 演示了如何使用Bash命令查看vivo开发者文档库中按哈希值组织的分类文档目录。包括列出所有文档文件、理解文件命名规则({hash}.md)以及读取特定文档内容。 ```bash # 查看所有文档文件 ls -la /app/repos/websites/developers_vivo_doc/d/ # 文件命名规则 # 格式: {hash}.md # 示例: 0f4b8768392741159a7d7d7551708835.md # 读取特定文档 cat /app/repos/websites/developers_vivo_doc/d/0f4b8768392741159a7d7d7551708835.md ``` -------------------------------- ### Bash - 本地阅读和搜索文档 Source: https://context7.com/context7/developers_vivo_doc/llms.txt 展示了如何在本地使用Bash命令浏览vivo开发者文档库。包括访问文档库目录、查看完整导航结构、使用grep命令搜索特定技术主题以及查找包含特定关键词的文档模块。 ```bash # 克隆或访问文档库 cd /app/repos/websites/developers_vivo_doc # 查看完整导航结构 cat index.md # 搜索特定技术主题 grep -r "AI能力" . --include="*.md" grep -r "SDK Manager" . --include="*.md" grep -r "音频能力" . --include="*.md" # 查看特定模块文档 find . -name "*.md" -type f | xargs grep -l "视频编辑" # 输出示例 # ./index.md # ./d/0f4b8768392741159a7d7d7551708835.md ``` -------------------------------- ### Python - 构建vivo文档搜索引擎 Source: https://context7.com/context7/developers_vivo_doc/llms.txt 实现了一个Python类 `VivoDocSearcher`,用于构建vivo开发者文档的本地搜索引擎。该类能够遍历指定目录下的所有Markdown文件,建立文件内容索引,并提供关键词搜索功能,返回包含匹配项的文件路径、文件名、匹配行以及匹配总数。 ```python import os import json from typing import List, Dict class VivoDocSearcher: """vivo文档搜索引擎""" def __init__(self, doc_root: str): self.doc_root = doc_root self.index = self._build_index() def _build_index(self) -> List[Dict]: """构建文档索引""" index = [] for root, dirs, files in os.walk(self.doc_root): for file in files: if file.endswith('.md'): file_path = os.path.join(root, file) with open(file_path, 'r', encoding='utf-8') as f: content = f.read() index.append({ 'path': file_path, 'filename': file, 'content': content.lower(), 'size': len(content) }) return index def search(self, keyword: str) -> List[Dict]: """搜索包含关键词的文档""" results = [] keyword_lower = keyword.lower() for doc in self.index: if keyword_lower in doc['content']: # 提取上下文 lines = doc['content'].split('\n') matched_lines = [ line for line in lines if keyword_lower in line.lower() ] results.append({ 'path': doc['path'], 'filename': doc['filename'], 'matches': matched_lines[:3], # 前3个匹配 'match_count': len(matched_lines) }) return results # 使用示例 searcher = VivoDocSearcher('/app/repos/websites/developers_vivo_doc') # 搜索AI相关文档 ai_docs = searcher.search('AI') for doc in ai_docs: print(f"文件: {doc['filename']}") print(f"匹配数: {doc['match_count']}") print(f"示例: {doc['matches'][0][:100]}...") print() # 搜索SDK相关内容 sdk_docs = searcher.search('SDK Manager') print(f"找到 {len(sdk_docs)} 个包含'SDK Manager'的文档") # 输出示例 # 文件: index.md # 匹配数: 15 # 示例: ai专区介绍... # # 找到 2 个包含'SDK Manager'的文档 ``` -------------------------------- ### Python - 解析vivo文档内容 Source: https://context7.com/context7/developers_vivo_doc/llms.txt 提供了一个Python函数 `parse_vivo_docs`,用于解析vivo开发者文档的Markdown文件。该函数能够提取文档的更新时间、标题层级、服务类型以及内容长度,便于进行文档内容的结构化分析和二次开发。 ```python import os import re from pathlib import Path def parse_vivo_docs(doc_path: str) -> dict: """解析vivo开发者文档并提取关键信息""" with open(doc_path, 'r', encoding='utf-8') as f: content = f.read() # 提取文档元数据 update_time = re.search(r'更新时间[::]\s*(\d{4}-\d{2}-\d{2}\s+\d{2}:\d{2}:\d{2})', content) # 提取标题层级 headers = re.findall(r'^#+\s+(.+)$', content, re.MULTILINE) # 提取服务类型 services = re.findall(r'##\s*(能力\w+服务)', content) return { 'update_time': update_time.group(1) if update_time else None, 'headers': headers, 'services': services, 'content_length': len(content) } # 使用示例 doc_info = parse_vivo_docs('/app/repos/websites/developers_vivo_doc/index.md') print(f"文档更新时间: {doc_info['update_time']}") print(f"标题数量: {len(doc_info['headers'])}") print(f"服务类型: {', '.join(doc_info['services'])}") # 输出示例 # 文档更新时间: 2025-07-10 15:49:16 # 标题数量: 8 # 服务类型: 能力开放服务, 能力获取服务, 能力互动服务 ``` -------------------------------- ### Markdown - 访问主索引文档结构 Source: https://context7.com/context7/developers_vivo_doc/llms.txt 展示了vivo开发者平台文档库的主索引文件结构,以Markdown格式呈现,用于展示平台指南、各个技术领域(如OriginOS, App Services, IoT, Media, System, Security, Game, AI等)以及开发者工具的导航和模块索引。 ```markdown # 访问主索引 文件路径: /app/repos/websites/developers_vivo_doc/index.md # 文档内容示例 平台指南 ├── 介绍 ├── 联系我们 OriginOS App Services IoT Media ├── 音频能力 ├── 视频编辑 └── 视频编辑介绍 System Security Game 开发工具 AI ├── AI专区介绍 ├── 大模型 ├── AI云能力 ├── AI端能力 └── 智慧服务 开发者助手 ├── 开发者助手介绍 └── 开发者助手FAQ ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.