diff --git a/SUMMARY.md.temp b/SUMMARY.md.temp new file mode 100644 index 0000000..3d2575d --- /dev/null +++ b/SUMMARY.md.temp @@ -0,0 +1,30 @@ +# Summary + +* [60 天通过 CCNA 考试](README.md) +* [第1天, 网络、线缆、OSI及TCP模型](d01-Networks-Cables-OSI-and-TCP-Models.md) +* [第2天, CSMA/CD, 交换和虚拟局域网](d02-CSMA-CD-Switching-and-VLANs.md) +* [第3天, 中继、DTP 及 VLAN 间路由](d03-Trunking-DTP-and-Inter-VLAN-Routing.md) +* [第4天, 路由器和交换机安全](d04-Router-and-Switch-Security.md) +* [第5天, IP 地址分配](d05-IP-Addressing.md) +* [第6天, 网络地址转换](d06-NAT.md) +* [第7天, 互联网协议版本6](d07-IPv6.md) +* [第8天, IPv4与IPv6共存的网络环境](d08-Integrating-IPv4-and-IPv6-Network-Environments.md) +* [第9天, 访问控制清单](d09-ACL.md) +* [第10天, 路由的一些概念](d10-Routing-Concepts.md) +* [第11天, 静态路由](d11-Static-Routing.md) +* [第12天, OSPF基础知识](d12-OSPF-Basics.md) +* [第13天, OSPF版本3](d13-OSPFv3.md) +* [第14天, DHCP及DNS](d14-DHCP-and-DNS.md) +* [第15天, 一二层排错](d15-Layer_1-and-Layer_2-Troubleshooting.md) +* [第31天, 生成树协议](d31-Spanning-Tree-Protocol.md) +* [第32天, 快速生成树协议](d32-Rapid-Spanning-Tree-Protocol.md) +* [第33天, 以太网通道及链路聚合协议](d33-EtherChannels-and-Link-Aggregation-Protocols.md) +* [第34天, 第一跳冗余协议](d34-First-Hop-Redundancy-Protocols.md) +* [第35天, 启动与IOS](d35-booting-and-IOS.md) +* [第36天, EIGRP](d36-EIGRP.md) +* [第37天,EIGRP故障排除](d37-Troubleshooting-EIGRP.md) +* [第38天,IPv6下的EIGRP](d38-EIGRP-For-IPv6.md) +* [第39天,开放最短路径优先协议](d39-OSPF.md) +* [第40天,系统日志、简单网络管理协议与NetFlow软件](d40-Syslog-SNMP-and-Netflow.md) +* [第41天,广域组网](d41-Wide-Area-Networking.md) +* [第42天,帧中继与点对点协议](d42-Frame-Relay-and-PPP.md) diff --git a/d03-Trunking-DTP-and-Inter-VLAN-Routing.md b/d03-Trunking-DTP-and-Inter-VLAN-Routing.md index a50a03d..4e14a29 100644 --- a/d03-Trunking-DTP-and-Inter-VLAN-Routing.md +++ b/d03-Trunking-DTP-and-Inter-VLAN-Routing.md @@ -602,6 +602,7 @@ Access Mode VLAN: 0 ((Inactive)) + VLAN 信息未有传输 - 该 VLAN 在中继链路上阻塞了吗 + `Switch#show interface trunk` + VTP 信息无法到达 VTP 客户端 diff --git a/genSummary.ts b/genSummary.ts index c31efbb..2476844 100644 --- a/genSummary.ts +++ b/genSummary.ts @@ -1,5 +1,37 @@ import remark from 'remark'; import visit from 'unist-util-visit'; +import vfile from 'to-vfile'; import { promises as fs } from 'fs'; import path from 'path'; + +const DIR = './'; +const SUMMARY_TEMP = './SUMMARY.md.temp'; +const SUMMARY = './SUMMARY.md.output'; + +function handleMdFiles(dir: string, template: string){ + + let md_toc = '# Summary\n'; + fs.stat(dir).then( s => { + if( s.isDirectory() ){ + + fs.readdir(dir).then(d => { + d.forEach( f => { + if ( path.parse(`${f}`).ext === ".md" && path.parse(`${f}`).name !== "SUMMARY" ) { + const index = `* [60 天通过 CCNA 考试](README.md)` + } + }); + + fs.writeFile(SUMMARY, `${data}${md_toc}`) + }) + } + }) +} + +let data: string; +fs.readFile(SUMMARY_TEMP).then((d) => { + data = d.toString(); +}).finally(() => { + handleMdFiles(DIR, data) +}) + diff --git a/package-lock.json b/package-lock.json index a0fff44..d7fe234 100644 --- a/package-lock.json +++ b/package-lock.json @@ -271,6 +271,15 @@ "resolved": "https://mirrors.huaweicloud.com/repository/npm/replace-ext/-/replace-ext-1.0.0.tgz", "integrity": "sha1-3mMSg3P8v3w8z6TeWkgMRaZ5WOs=" }, + "to-vfile": { + "version": "6.1.0", + "resolved": "https://mirrors.huaweicloud.com/repository/npm/to-vfile/-/to-vfile-6.1.0.tgz", + "integrity": "sha512-BxX8EkCxOAZe+D/ToHdDsJcVI4HqQfmw0tCkp31zf3dNP/XWIAjU4CmeuSwsSoOzOTqHPOL0KUzyZqJplkD0Qw==", + "requires": { + "is-buffer": "^2.0.0", + "vfile": "^4.0.0" + } + }, "trough": { "version": "1.0.5", "resolved": "https://mirrors.huaweicloud.com/repository/npm/trough/-/trough-1.0.5.tgz", diff --git a/package.json b/package.json index 9dc31c5..6f0e7e9 100644 --- a/package.json +++ b/package.json @@ -13,6 +13,7 @@ "gitbook-plugin-theme-comscore": "^0.0.3", "path": "^0.12.7", "remark": "^13.0.0", + "to-vfile": "^6.1.0", "typescript": "^4.0.5", "unist-util-visit": "^2.0.3" }, diff --git a/tsconfig.json b/tsconfig.json index c9f603c..f40e5c0 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,69 +1,11 @@ { "compilerOptions": { - /* Visit https://aka.ms/tsconfig.json to read more about this file */ - - /* Basic Options */ - // "incremental": true, /* Enable incremental compilation */ "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */ "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */ - // "lib": [], /* Specify library files to be included in the compilation. */ - // "allowJs": true, /* Allow javascript files to be compiled. */ - // "checkJs": true, /* Report errors in .js files. */ - // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */ - // "declaration": true, /* Generates corresponding '.d.ts' file. */ - // "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */ - // "sourceMap": true, /* Generates corresponding '.map' file. */ - // "outFile": "./", /* Concatenate and emit output to single file. */ - // "outDir": "./", /* Redirect output structure to the directory. */ - // "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ - // "composite": true, /* Enable project compilation */ - // "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */ - // "removeComments": true, /* Do not emit comments to output. */ - // "noEmit": true, /* Do not emit outputs. */ - // "importHelpers": true, /* Import emit helpers from 'tslib'. */ - // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */ - // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ - - /* Strict Type-Checking Options */ "strict": true, /* Enable all strict type-checking options. */ - // "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */ - // "strictNullChecks": true, /* Enable strict null checks. */ - // "strictFunctionTypes": true, /* Enable strict checking of function types. */ - // "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */ - // "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */ - // "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */ - // "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */ - - /* Additional Checks */ - // "noUnusedLocals": true, /* Report errors on unused locals. */ - // "noUnusedParameters": true, /* Report errors on unused parameters. */ - // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ - // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ - - /* Module Resolution Options */ - // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ - // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */ - // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */ - // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */ - // "typeRoots": [], /* List of folders to include type definitions from. */ - // "types": [], /* Type declaration files to be included in compilation. */ - // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */ "esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ - // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */ - // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ - - /* Source Map Options */ - // "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */ - // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ - // "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */ - // "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */ - - /* Experimental Options */ - // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ - // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ - - /* Advanced Options */ "skipLibCheck": true, /* Skip type checking of declaration files. */ - "forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */ + "forceConsistentCasingInFileNames": true, /* Disallow inconsistently-cased references to the same file. */ + "types": ["@types/node"] } }