chore: sync local updates
This commit is contained in:
@@ -15,9 +15,11 @@ COPY requirements.txt .
|
||||
# 安装 Python 依赖
|
||||
RUN pip install --no-cache-dir -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
|
||||
|
||||
# 复制应用代码
|
||||
# 复制应用代码(笔记目录在仓库中为 data/mengyanote,运行时挂载到 /app/mengyanote 与 main.py 一致)
|
||||
COPY main.py .
|
||||
COPY mengyanote ./mengyanote
|
||||
COPY data/mengyanote ./mengyanote
|
||||
# 默认配置(config.json 含 admin_token;ignore.json)。部署可用卷覆盖整个目录
|
||||
COPY data/config ./data/config
|
||||
|
||||
# 暴露端口
|
||||
EXPOSE 8000
|
||||
|
||||
3
mengyanote-backend/data/config/config.json
Normal file
3
mengyanote-backend/data/config/config.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"admin_token":"shumengya520"
|
||||
}
|
||||
@@ -1,17 +1,18 @@
|
||||
{
|
||||
"ignore": [
|
||||
".obsidian",
|
||||
".trash",
|
||||
"华为ICT",
|
||||
"鉴政",
|
||||
"临时解决方案",
|
||||
"树萌芽的小本本",
|
||||
"树萌芽制作的小东西",
|
||||
"树萌芽の小想法",
|
||||
"西南石油大学",
|
||||
"临时",
|
||||
"树萌芽の喃喃自语",
|
||||
"树萌芽の小本本",
|
||||
"树萌芽の收藏夹"
|
||||
]
|
||||
}
|
||||
{
|
||||
"ignore": [
|
||||
".obsidian",
|
||||
".trash",
|
||||
"临时",
|
||||
"临时解决方案",
|
||||
"华为ICT",
|
||||
"树萌芽の喃喃自语",
|
||||
"树萌芽の小想法",
|
||||
"树萌芽の小本本",
|
||||
"树萌芽の收藏夹",
|
||||
"树萌芽制作的小东西",
|
||||
"树萌芽的小本本",
|
||||
"西南石油大学",
|
||||
"鉴政",
|
||||
"项目策划"
|
||||
]
|
||||
}
|
||||
@@ -4,5 +4,11 @@
|
||||
"strictLineBreaks": false,
|
||||
"showLineNumber": false,
|
||||
"rightToLeft": false,
|
||||
"spellcheck": false
|
||||
"spellcheck": false,
|
||||
"autoConvertHtml": true,
|
||||
"autoPairBrackets": false,
|
||||
"autoPairMarkdown": false,
|
||||
"smartIndentList": false,
|
||||
"useTab": true,
|
||||
"tabSize": 4
|
||||
}
|
||||
@@ -1,10 +1,13 @@
|
||||
{
|
||||
"cssTheme": "Phycat",
|
||||
"theme": "moonstone",
|
||||
"monospaceFontFamily": "霞鹜文楷,Maple Mono NF CN",
|
||||
"monospaceFontFamily": "Maple Mono CN,霞鹜文楷",
|
||||
"baseFontSize": 15,
|
||||
"interfaceFontFamily": "Maple Mono NF CN",
|
||||
"textFontFamily": "霞鹜文楷,Maple Mono NF CN",
|
||||
"interfaceFontFamily": "霞鹜文楷",
|
||||
"textFontFamily": "霞鹜文楷",
|
||||
"nativeMenus": false,
|
||||
"accentColor": "#ffbb00"
|
||||
"accentColor": "#ffbb00",
|
||||
"enabledCssSnippets": [
|
||||
"md"
|
||||
]
|
||||
}
|
||||
@@ -4,6 +4,6 @@
|
||||
"remotely-save",
|
||||
"obsidian42-brat",
|
||||
"editing-toolbar",
|
||||
"obsidian-icon-folder",
|
||||
"tray"
|
||||
"tray",
|
||||
"obsidian-regex-replace"
|
||||
]
|
||||
@@ -404,7 +404,7 @@
|
||||
"cMenuNumRows": 12,
|
||||
"cMenuWidth": 610,
|
||||
"cMenuFontColor": "#c00000",
|
||||
"cMenuBackgroundColor": "#d3f8b6",
|
||||
"cMenuBackgroundColor": "#b1ffff",
|
||||
"autohide": false,
|
||||
"Iscentered": false,
|
||||
"custom_bg1": "#FFB78B8C",
|
||||
|
||||
@@ -1,260 +0,0 @@
|
||||
{
|
||||
"LatestVersion": "1.6.0",
|
||||
"currentWallpaper": {
|
||||
"path": "plugins/live-wallpaper/wallpapers/active/normal/wallpaper-3bf8a59e58bd7144744b0ad4e9d5bbc3.png",
|
||||
"type": "image",
|
||||
"zIndex": 5,
|
||||
"opacity": 25,
|
||||
"brightness": 130,
|
||||
"blurRadius": 4,
|
||||
"contrast": 105,
|
||||
"playbackSpeed": 1,
|
||||
"Reposition": false,
|
||||
"Quality": false,
|
||||
"useObjectFit": true,
|
||||
"position": "Center",
|
||||
"positionX": 50,
|
||||
"positionY": 50,
|
||||
"Scale": 1,
|
||||
"Index": 0
|
||||
},
|
||||
"globalConfig": {
|
||||
"config": {
|
||||
"path": "plugins/live-wallpaper/wallpapers/active/normal/wallpaper-3bf8a59e58bd7144744b0ad4e9d5bbc3.png",
|
||||
"type": "image",
|
||||
"zIndex": 5,
|
||||
"opacity": 25,
|
||||
"brightness": 130,
|
||||
"blurRadius": 4,
|
||||
"contrast": 105,
|
||||
"playbackSpeed": 1,
|
||||
"Reposition": false,
|
||||
"Quality": false,
|
||||
"useObjectFit": true,
|
||||
"position": "Center",
|
||||
"positionX": 50,
|
||||
"positionY": 50,
|
||||
"Scale": 1,
|
||||
"Index": 0
|
||||
},
|
||||
"enabled": true
|
||||
},
|
||||
"Preview": false,
|
||||
"WallpaperConfigs": [
|
||||
{
|
||||
"path": "plugins/live-wallpaper/wallpapers/active/normal/wallpaper-3bf8a59e58bd7144744b0ad4e9d5bbc3.png",
|
||||
"type": "image",
|
||||
"zIndex": 5,
|
||||
"opacity": 40,
|
||||
"brightness": 100,
|
||||
"blurRadius": 8,
|
||||
"contrast": 100,
|
||||
"playbackSpeed": 1,
|
||||
"Reposition": false,
|
||||
"Quality": false,
|
||||
"useObjectFit": true,
|
||||
"position": "Center",
|
||||
"positionX": 50,
|
||||
"positionY": 50,
|
||||
"Scale": 1,
|
||||
"Index": 0
|
||||
},
|
||||
{
|
||||
"path": "",
|
||||
"type": "image",
|
||||
"zIndex": 5,
|
||||
"opacity": 40,
|
||||
"brightness": 100,
|
||||
"blurRadius": 8,
|
||||
"contrast": 100,
|
||||
"playbackSpeed": 1,
|
||||
"Reposition": false,
|
||||
"Quality": false,
|
||||
"useObjectFit": true,
|
||||
"position": "Center",
|
||||
"positionX": 50,
|
||||
"positionY": 50,
|
||||
"Scale": 1,
|
||||
"Index": 1
|
||||
},
|
||||
{
|
||||
"path": "",
|
||||
"type": "image",
|
||||
"zIndex": 5,
|
||||
"opacity": 40,
|
||||
"brightness": 100,
|
||||
"blurRadius": 8,
|
||||
"contrast": 100,
|
||||
"playbackSpeed": 1,
|
||||
"Reposition": false,
|
||||
"Quality": false,
|
||||
"useObjectFit": true,
|
||||
"position": "Center",
|
||||
"positionX": 50,
|
||||
"positionY": 50,
|
||||
"Scale": 1,
|
||||
"Index": 2
|
||||
},
|
||||
{
|
||||
"path": "",
|
||||
"type": "image",
|
||||
"zIndex": 5,
|
||||
"opacity": 40,
|
||||
"brightness": 100,
|
||||
"blurRadius": 8,
|
||||
"contrast": 100,
|
||||
"playbackSpeed": 1,
|
||||
"Reposition": false,
|
||||
"Quality": false,
|
||||
"useObjectFit": true,
|
||||
"position": "Center",
|
||||
"positionX": 50,
|
||||
"positionY": 50,
|
||||
"Scale": 1,
|
||||
"Index": 3
|
||||
},
|
||||
{
|
||||
"path": "",
|
||||
"type": "image",
|
||||
"zIndex": 5,
|
||||
"opacity": 40,
|
||||
"brightness": 100,
|
||||
"blurRadius": 8,
|
||||
"contrast": 100,
|
||||
"playbackSpeed": 1,
|
||||
"Reposition": false,
|
||||
"Quality": false,
|
||||
"useObjectFit": true,
|
||||
"position": "Center",
|
||||
"positionX": 50,
|
||||
"positionY": 50,
|
||||
"Scale": 1,
|
||||
"Index": 4
|
||||
},
|
||||
{
|
||||
"path": "",
|
||||
"type": "image",
|
||||
"zIndex": 5,
|
||||
"opacity": 40,
|
||||
"brightness": 100,
|
||||
"blurRadius": 8,
|
||||
"contrast": 100,
|
||||
"playbackSpeed": 1,
|
||||
"Reposition": false,
|
||||
"Quality": false,
|
||||
"useObjectFit": true,
|
||||
"position": "Center",
|
||||
"positionX": 50,
|
||||
"positionY": 50,
|
||||
"Scale": 1,
|
||||
"Index": 5
|
||||
},
|
||||
{
|
||||
"path": "",
|
||||
"type": "image",
|
||||
"zIndex": 5,
|
||||
"opacity": 40,
|
||||
"brightness": 100,
|
||||
"blurRadius": 8,
|
||||
"contrast": 100,
|
||||
"playbackSpeed": 1,
|
||||
"Reposition": false,
|
||||
"Quality": false,
|
||||
"useObjectFit": true,
|
||||
"position": "Center",
|
||||
"positionX": 50,
|
||||
"positionY": 50,
|
||||
"Scale": 1,
|
||||
"Index": 6
|
||||
},
|
||||
{
|
||||
"path": "",
|
||||
"type": "image",
|
||||
"zIndex": 5,
|
||||
"opacity": 40,
|
||||
"brightness": 100,
|
||||
"blurRadius": 8,
|
||||
"contrast": 100,
|
||||
"playbackSpeed": 1,
|
||||
"Reposition": false,
|
||||
"Quality": false,
|
||||
"useObjectFit": true,
|
||||
"position": "Center",
|
||||
"positionX": 50,
|
||||
"positionY": 50,
|
||||
"Scale": 1,
|
||||
"Index": 7
|
||||
},
|
||||
{
|
||||
"path": "",
|
||||
"type": "image",
|
||||
"zIndex": 5,
|
||||
"opacity": 40,
|
||||
"brightness": 100,
|
||||
"blurRadius": 8,
|
||||
"contrast": 100,
|
||||
"playbackSpeed": 1,
|
||||
"Reposition": false,
|
||||
"Quality": false,
|
||||
"useObjectFit": true,
|
||||
"position": "Center",
|
||||
"positionX": 50,
|
||||
"positionY": 50,
|
||||
"Scale": 1,
|
||||
"Index": 8
|
||||
},
|
||||
{
|
||||
"path": "",
|
||||
"type": "image",
|
||||
"zIndex": 5,
|
||||
"opacity": 40,
|
||||
"brightness": 100,
|
||||
"blurRadius": 8,
|
||||
"contrast": 100,
|
||||
"playbackSpeed": 1,
|
||||
"Reposition": false,
|
||||
"Quality": false,
|
||||
"useObjectFit": true,
|
||||
"position": "Center",
|
||||
"positionX": 50,
|
||||
"positionY": 50,
|
||||
"Scale": 1,
|
||||
"Index": 9
|
||||
}
|
||||
],
|
||||
"HistoryPaths": [
|
||||
{
|
||||
"path": "plugins/live-wallpaper/wallpapers/history/wallpaper-3bf8a59e58bd7144744b0ad4e9d5bbc3.png",
|
||||
"type": "image",
|
||||
"fileName": "wallpaper-3bf8a59e58bd7144744b0ad4e9d5bbc3.png"
|
||||
}
|
||||
],
|
||||
"mobileBackgroundWidth": "100vw",
|
||||
"mobileBackgroundHeight": "100vh",
|
||||
"AdnvOpend": false,
|
||||
"modalStyle": {
|
||||
"effect": "blur+dim",
|
||||
"blurRadius": 10,
|
||||
"dimOpacity": 0.7,
|
||||
"dimColor": "black",
|
||||
"disableModalBg": false
|
||||
},
|
||||
"TextArenas": [
|
||||
{
|
||||
"attribute": ""
|
||||
}
|
||||
],
|
||||
"Color": "#000000",
|
||||
"INBUILD": false,
|
||||
"SizeLimited": true,
|
||||
"ScheduledOptions": {
|
||||
"dayNightMode": false,
|
||||
"weekly": false,
|
||||
"autoSwitch": false,
|
||||
"dayStartTime": "08:00",
|
||||
"nightStartTime": "20:00",
|
||||
"intervalCheckTime": "00:10",
|
||||
"isCustomInterval": false
|
||||
},
|
||||
"migrated": false
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,10 +0,0 @@
|
||||
{
|
||||
"id": "live-wallpaper",
|
||||
"name": "Live Background",
|
||||
"version": "1.6.0",
|
||||
"minAppVersion": "1.1.0",
|
||||
"author": "Rememememe :3",
|
||||
"authorUrl": "https://github.com/remememe",
|
||||
"description": "Add dynamic live wallpapers (images/videos) to your workspace with customizable effects",
|
||||
"isDesktopOnly": false
|
||||
}
|
||||
@@ -1,97 +0,0 @@
|
||||
.titlebar {
|
||||
background-color: transparent !important;
|
||||
z-index: 99999;
|
||||
}
|
||||
.windows .titlebar {
|
||||
-webkit-app-region: drag;
|
||||
}
|
||||
|
||||
.titlebar-button-container {
|
||||
z-index: 9999;
|
||||
-webkit-app-region: no-drag;
|
||||
}
|
||||
|
||||
.titlebar-button {
|
||||
color: var(--text-normal) !important;
|
||||
}
|
||||
|
||||
.titlebar-button:hover {
|
||||
background-color: var(--background-modifier-hover) !important;
|
||||
}
|
||||
|
||||
.live-wallpaper-active .titlebar {
|
||||
border-bottom: none !important;
|
||||
-webkit-app-region: drag;
|
||||
}
|
||||
|
||||
#live-wallpaper-container {
|
||||
transition: opacity 0.3s ease, filter 0.3s ease;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
video#live-wallpaper-media {
|
||||
transition: playback-rate 0.3s ease;
|
||||
}
|
||||
.text-arena-table {
|
||||
border-collapse: collapse;
|
||||
margin: 10px 0;
|
||||
}
|
||||
|
||||
.text-arena-table th,
|
||||
.text-arena-table td {
|
||||
border: 1px solid var(--background-modifier-border);
|
||||
padding: 8px;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.text-arena-table th {
|
||||
background-color: var(--background-primary-alt);
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.text-arena-table tr:nth-child(even) {
|
||||
background-color: var(--background-primary);
|
||||
}
|
||||
|
||||
.text-arena-table tr:hover {
|
||||
background-color: var(--background-secondary);
|
||||
}
|
||||
|
||||
.text-arena-table .setting-item {
|
||||
border: none !important;
|
||||
padding: 0 !important;
|
||||
margin: 0 !important;
|
||||
}
|
||||
.text-arena-table .setting-item-control {
|
||||
width: 100%;
|
||||
}
|
||||
.EditCodeBlock {
|
||||
background-color: #1e1e1e;
|
||||
color: #dcdcdc;
|
||||
padding: 10px;
|
||||
border-radius: 6px;
|
||||
font-family: monospace;
|
||||
overflow-x: auto;
|
||||
white-space: pre;
|
||||
resize: none;
|
||||
}
|
||||
body.is-mobile .workspace-drawer.mod-left,
|
||||
body.is-mobile .workspace-drawer.mod-right,
|
||||
body.is-mobile .vertical-tab-content-container,
|
||||
body.is-mobile .modal-header {
|
||||
backdrop-filter: blur(4px);
|
||||
background: rgba(0, 0, 0, 0.7);
|
||||
}
|
||||
body.is-mobile .menu{
|
||||
background: rgba(0, 0, 0, 0.7);
|
||||
}
|
||||
.live-wallpaper-settings-nav {
|
||||
display: flex;
|
||||
overflow-x: auto;
|
||||
white-space: nowrap;
|
||||
gap: 0.5rem;
|
||||
padding-bottom: 0.5rem;
|
||||
}
|
||||
.live-wallpaper-settings-nav .setting-button {
|
||||
flex-shrink: 0;
|
||||
}
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 210 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 210 KiB |
@@ -1,33 +0,0 @@
|
||||
{
|
||||
"settings": {
|
||||
"migrated": 6,
|
||||
"iconPacksPath": ".obsidian/icons",
|
||||
"fontSize": 16,
|
||||
"emojiStyle": "native",
|
||||
"iconColor": null,
|
||||
"recentlyUsedIcons": [
|
||||
"LiActivitySquare"
|
||||
],
|
||||
"recentlyUsedIconsSize": 5,
|
||||
"rules": [],
|
||||
"extraMargin": {
|
||||
"top": 0,
|
||||
"right": 4,
|
||||
"bottom": 0,
|
||||
"left": 0
|
||||
},
|
||||
"iconInTabsEnabled": false,
|
||||
"iconInTitleEnabled": false,
|
||||
"iconInTitlePosition": "above",
|
||||
"iconInFrontmatterEnabled": false,
|
||||
"iconInFrontmatterFieldName": "icon",
|
||||
"iconColorInFrontmatterFieldName": "iconColor",
|
||||
"iconsBackgroundCheckEnabled": false,
|
||||
"iconsInNotesEnabled": true,
|
||||
"iconsInLinksEnabled": true,
|
||||
"iconIdentifier": ":",
|
||||
"lucideIconPackType": "native",
|
||||
"debugMode": false,
|
||||
"useInternalPlugins": false
|
||||
}
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
@@ -1,10 +0,0 @@
|
||||
{
|
||||
"id": "obsidian-icon-folder",
|
||||
"name": "Iconize",
|
||||
"version": "2.14.7",
|
||||
"minAppVersion": "0.9.12",
|
||||
"description": "Add icons to anything you desire in Obsidian, including files, folders, and text.",
|
||||
"author": "Florian Woelki",
|
||||
"authorUrl": "https://florianwoelki.com/",
|
||||
"isDesktopOnly": false
|
||||
}
|
||||
@@ -1,120 +0,0 @@
|
||||
.iconize-inline-title-wrapper {
|
||||
width: var(--line-width);
|
||||
max-width: var(--max-width);
|
||||
margin-inline: var(--content-margin);
|
||||
}
|
||||
|
||||
.iconize-title-icon {
|
||||
max-width: var(--max-width);
|
||||
margin-right: var(--size-4-2);
|
||||
}
|
||||
|
||||
.iconize-icon-in-link {
|
||||
transform: translateY(20%);
|
||||
margin-right: var(--size-2-2);
|
||||
display: inline-flex;
|
||||
}
|
||||
|
||||
.iconize-icon {
|
||||
border: 1px solid transparent;
|
||||
margin: 0px 4px 0px 0px;
|
||||
display: flex;
|
||||
align-self: center;
|
||||
margin: auto 0;
|
||||
}
|
||||
|
||||
.nav-folder-title,
|
||||
.nav-file-title {
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.iconize-setting input[type='color'] {
|
||||
margin: 0 6px;
|
||||
}
|
||||
|
||||
.iconize-modal.prompt-results {
|
||||
margin: 0;
|
||||
overflow-y: auto;
|
||||
display: grid;
|
||||
grid-template-columns: repeat(5, minmax(0, 1fr));
|
||||
}
|
||||
|
||||
.prompt .iconize-subheadline {
|
||||
margin-top: 12px;
|
||||
font-size: 12px;
|
||||
color: gray;
|
||||
grid-column-start: 1;
|
||||
grid-column-end: 6;
|
||||
}
|
||||
|
||||
@media (max-width: 640px) {
|
||||
.iconize-modal.prompt-results {
|
||||
grid-template-columns: repeat(3, minmax(0, 1fr));
|
||||
}
|
||||
.prompt .iconize-subheadline {
|
||||
grid-column-end: 4;
|
||||
}
|
||||
}
|
||||
|
||||
.iconize-modal.prompt-results .suggestion-item {
|
||||
cursor: pointer;
|
||||
white-space: pre-wrap;
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
align-items: center;
|
||||
flex-direction: column-reverse;
|
||||
text-align: center;
|
||||
font-size: 13px;
|
||||
color: var(--text-muted);
|
||||
padding: 16px 8px;
|
||||
line-break: auto;
|
||||
word-break: break-word;
|
||||
line-height: 1.3;
|
||||
}
|
||||
|
||||
.iconize-modal.prompt-results .suggestion-item.suggestion-item__center {
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.iconize-icon-preview {
|
||||
font-size: 22px;
|
||||
}
|
||||
|
||||
.iconize-icon-preview img {
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
}
|
||||
|
||||
.iconize-icon-preview svg {
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
color: currentColor;
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
|
||||
.iconize-dragover {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.iconize-dragover-el {
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
color: var(--text-normal);
|
||||
background-color: var(--background-secondary-alt);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
/* Custom rule modal. */
|
||||
.iconize-custom-modal .modal-content {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.iconize-custom-modal .modal-content input {
|
||||
width: 100%;
|
||||
margin-right: 0.5rem;
|
||||
}
|
||||
10
mengyanote-backend/data/mengyanote/.obsidian/plugins/obsidian-regex-replace/data.json
vendored
Normal file
10
mengyanote-backend/data/mengyanote/.obsidian/plugins/obsidian-regex-replace/data.json
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"findText": "\\n{3,}",
|
||||
"replaceText": "\\n\\n",
|
||||
"useRegEx": true,
|
||||
"selOnly": false,
|
||||
"caseInsensitive": false,
|
||||
"processLineBreak": false,
|
||||
"processTab": false,
|
||||
"prefillFind": false
|
||||
}
|
||||
322
mengyanote-backend/data/mengyanote/.obsidian/plugins/obsidian-regex-replace/main.js
vendored
Normal file
322
mengyanote-backend/data/mengyanote/.obsidian/plugins/obsidian-regex-replace/main.js
vendored
Normal file
@@ -0,0 +1,322 @@
|
||||
/*
|
||||
THIS IS A GENERATED/BUNDLED FILE BY ROLLUP
|
||||
if you want to view the source visit the plugins github repository
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var obsidian = require('obsidian');
|
||||
|
||||
/*! *****************************************************************************
|
||||
Copyright (c) Microsoft Corporation.
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
PERFORMANCE OF THIS SOFTWARE.
|
||||
***************************************************************************** */
|
||||
|
||||
function __awaiter(thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
}
|
||||
|
||||
const DEFAULT_SETTINGS = {
|
||||
findText: '',
|
||||
replaceText: '',
|
||||
useRegEx: true,
|
||||
selOnly: false,
|
||||
caseInsensitive: false,
|
||||
processLineBreak: false,
|
||||
processTab: false,
|
||||
prefillFind: false
|
||||
};
|
||||
// logThreshold: 0 ... only error messages
|
||||
// 9 ... verbose output
|
||||
const logThreshold = 9;
|
||||
const logger = (logString, logLevel = 0) => { if (logLevel <= logThreshold)
|
||||
console.log('RegexFiRe: ' + logString); };
|
||||
class RegexFindReplacePlugin extends obsidian.Plugin {
|
||||
onload() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
logger('Loading Plugin...', 9);
|
||||
yield this.loadSettings();
|
||||
this.addSettingTab(new RegexFindReplaceSettingTab(this.app, this));
|
||||
this.addCommand({
|
||||
id: 'obsidian-regex-replace',
|
||||
name: 'Find and Replace using regular expressions',
|
||||
editorCallback: (editor) => {
|
||||
new FindAndReplaceModal(this.app, editor, this.settings, this).open();
|
||||
},
|
||||
});
|
||||
});
|
||||
}
|
||||
onunload() {
|
||||
logger('Bye!', 9);
|
||||
}
|
||||
loadSettings() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
logger('Loading Settings...', 6);
|
||||
this.settings = Object.assign({}, DEFAULT_SETTINGS, yield this.loadData());
|
||||
logger(' findVal: ' + this.settings.findText, 6);
|
||||
logger(' replaceText: ' + this.settings.replaceText, 6);
|
||||
logger(' caseInsensitive: ' + this.settings.caseInsensitive, 6);
|
||||
logger(' processLineBreak: ' + this.settings.processLineBreak, 6);
|
||||
});
|
||||
}
|
||||
saveSettings() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
yield this.saveData(this.settings);
|
||||
});
|
||||
}
|
||||
}
|
||||
class FindAndReplaceModal extends obsidian.Modal {
|
||||
constructor(app, editor, settings, plugin) {
|
||||
super(app);
|
||||
this.editor = editor;
|
||||
this.settings = settings;
|
||||
this.plugin = plugin;
|
||||
}
|
||||
onOpen() {
|
||||
const { contentEl, titleEl, editor, modalEl } = this;
|
||||
modalEl.addClass('find-replace-modal');
|
||||
titleEl.setText('Regex Find/Replace');
|
||||
const rowClass = 'row';
|
||||
const divClass = 'div';
|
||||
const noSelection = editor.getSelection() === '';
|
||||
let regexFlags = 'gm';
|
||||
if (this.settings.caseInsensitive)
|
||||
regexFlags = regexFlags.concat('i');
|
||||
logger('No text selected?: ' + noSelection, 9);
|
||||
const addTextComponent = (label, placeholder, postfix = '') => {
|
||||
const containerEl = document.createElement(divClass);
|
||||
containerEl.addClass(rowClass);
|
||||
const targetEl = document.createElement(divClass);
|
||||
targetEl.addClass('input-wrapper');
|
||||
const labelEl = document.createElement(divClass);
|
||||
labelEl.addClass('input-label');
|
||||
labelEl.setText(label);
|
||||
const labelEl2 = document.createElement(divClass);
|
||||
labelEl2.addClass('postfix-label');
|
||||
labelEl2.setText(postfix);
|
||||
containerEl.appendChild(labelEl);
|
||||
containerEl.appendChild(targetEl);
|
||||
containerEl.appendChild(labelEl2);
|
||||
const component = new obsidian.TextComponent(targetEl);
|
||||
component.setPlaceholder(placeholder);
|
||||
contentEl.append(containerEl);
|
||||
return [component, labelEl2];
|
||||
};
|
||||
const addToggleComponent = (label, tooltip, hide = false) => {
|
||||
const containerEl = document.createElement(divClass);
|
||||
containerEl.addClass(rowClass);
|
||||
const targetEl = document.createElement(divClass);
|
||||
targetEl.addClass(rowClass);
|
||||
const component = new obsidian.ToggleComponent(targetEl);
|
||||
component.setTooltip(tooltip);
|
||||
const labelEl = document.createElement(divClass);
|
||||
labelEl.addClass('check-label');
|
||||
labelEl.setText(label);
|
||||
containerEl.appendChild(labelEl);
|
||||
containerEl.appendChild(targetEl);
|
||||
if (!hide)
|
||||
contentEl.appendChild(containerEl);
|
||||
return component;
|
||||
};
|
||||
// Create input fields
|
||||
const findRow = addTextComponent('Find:', 'e.g. (.*)', '/' + regexFlags);
|
||||
const findInputComponent = findRow[0];
|
||||
const findRegexFlags = findRow[1];
|
||||
const replaceRow = addTextComponent('Replace:', 'e.g. $1', this.settings.processLineBreak ? '\\n=LF' : '');
|
||||
const replaceWithInputComponent = replaceRow[0];
|
||||
// Create and show regular expression toggle switch
|
||||
const regToggleComponent = addToggleComponent('Use regular expressions', 'If enabled, regular expressions in the find field are processed as such, and regex groups might be addressed in the replace field');
|
||||
// Update regex-flags label if regular expressions are enabled or disabled
|
||||
regToggleComponent.onChange(regNew => {
|
||||
if (regNew) {
|
||||
findRegexFlags.setText('/' + regexFlags);
|
||||
}
|
||||
else {
|
||||
findRegexFlags.setText('');
|
||||
}
|
||||
});
|
||||
// Create and show selection toggle switch only if any text is selected
|
||||
const selToggleComponent = addToggleComponent('Replace only in selection', 'If enabled, replaces only occurances in the currently selected text', noSelection);
|
||||
// Create Buttons
|
||||
const buttonContainerEl = document.createElement(divClass);
|
||||
buttonContainerEl.addClass(rowClass);
|
||||
const submitButtonTarget = document.createElement(divClass);
|
||||
submitButtonTarget.addClass('button-wrapper');
|
||||
submitButtonTarget.addClass(rowClass);
|
||||
const cancelButtonTarget = document.createElement(divClass);
|
||||
cancelButtonTarget.addClass('button-wrapper');
|
||||
cancelButtonTarget.addClass(rowClass);
|
||||
const submitButtonComponent = new obsidian.ButtonComponent(submitButtonTarget);
|
||||
const cancelButtonComponent = new obsidian.ButtonComponent(cancelButtonTarget);
|
||||
cancelButtonComponent.setButtonText('Cancel');
|
||||
cancelButtonComponent.onClick(() => {
|
||||
logger('Action cancelled.', 8);
|
||||
this.close();
|
||||
});
|
||||
submitButtonComponent.setButtonText('Replace All');
|
||||
submitButtonComponent.setCta();
|
||||
submitButtonComponent.onClick(() => {
|
||||
let resultString = 'No match';
|
||||
let scope = '';
|
||||
const searchString = findInputComponent.getValue();
|
||||
let replaceString = replaceWithInputComponent.getValue();
|
||||
const selectedText = editor.getSelection();
|
||||
if (searchString === '') {
|
||||
new obsidian.Notice('Nothing to search for!');
|
||||
return;
|
||||
}
|
||||
// Replace line breaks in find-field if option is enabled
|
||||
if (this.settings.processLineBreak) {
|
||||
logger('Replacing linebreaks in replace-field', 9);
|
||||
logger(' old: ' + replaceString, 9);
|
||||
replaceString = replaceString.replace(/\\n/gm, '\n');
|
||||
logger(' new: ' + replaceString, 9);
|
||||
}
|
||||
// Replace line breaks in find-field if option is enabled
|
||||
if (this.settings.processTab) {
|
||||
logger('Replacing tabs in replace-field', 9);
|
||||
logger(' old: ' + replaceString, 9);
|
||||
replaceString = replaceString.replace(/\\t/gm, '\t');
|
||||
logger(' new: ' + replaceString, 9);
|
||||
}
|
||||
// Check if regular expressions should be used
|
||||
if (regToggleComponent.getValue()) {
|
||||
logger('USING regex with flags: ' + regexFlags, 8);
|
||||
const searchRegex = new RegExp(searchString, regexFlags);
|
||||
if (!selToggleComponent.getValue()) {
|
||||
logger(' SCOPE: Full document', 9);
|
||||
const documentText = editor.getValue();
|
||||
const rresult = documentText.match(searchRegex);
|
||||
if (rresult) {
|
||||
editor.setValue(documentText.replace(searchRegex, replaceString));
|
||||
resultString = `Made ${rresult.length} replacement(s) in document`;
|
||||
}
|
||||
}
|
||||
else {
|
||||
logger(' SCOPE: Selection', 9);
|
||||
const rresult = selectedText.match(searchRegex);
|
||||
if (rresult) {
|
||||
editor.replaceSelection(selectedText.replace(searchRegex, replaceString));
|
||||
resultString = `Made ${rresult.length} replacement(s) in selection`;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
logger('NOT using regex', 8);
|
||||
let nrOfHits = 0;
|
||||
if (!selToggleComponent.getValue()) {
|
||||
logger(' SCOPE: Full document', 9);
|
||||
scope = 'selection';
|
||||
const documentText = editor.getValue();
|
||||
const documentSplit = documentText.split(searchString);
|
||||
nrOfHits = documentSplit.length - 1;
|
||||
editor.setValue(documentSplit.join(replaceString));
|
||||
}
|
||||
else {
|
||||
logger(' SCOPE: Selection', 9);
|
||||
scope = 'document';
|
||||
const selectedSplit = selectedText.split(searchString);
|
||||
nrOfHits = selectedSplit.length - 1;
|
||||
editor.replaceSelection(selectedSplit.join(replaceString));
|
||||
}
|
||||
resultString = `Made ${nrOfHits} replacement(s) in ${scope}`;
|
||||
}
|
||||
// Saving settings (find/replace text and toggle switch states)
|
||||
this.settings.findText = searchString;
|
||||
this.settings.replaceText = replaceString;
|
||||
this.settings.useRegEx = regToggleComponent.getValue();
|
||||
this.settings.selOnly = selToggleComponent.getValue();
|
||||
this.plugin.saveData(this.settings);
|
||||
this.close();
|
||||
new obsidian.Notice(resultString);
|
||||
});
|
||||
// Apply settings
|
||||
regToggleComponent.setValue(this.settings.useRegEx);
|
||||
selToggleComponent.setValue(this.settings.selOnly);
|
||||
replaceWithInputComponent.setValue(this.settings.replaceText);
|
||||
// Check if the prefill find option is enabled and the selection does not contain linebreaks
|
||||
if (this.settings.prefillFind && editor.getSelection().indexOf('\n') < 0 && !noSelection) {
|
||||
logger('Found selection without linebreaks and option is enabled -> fill', 9);
|
||||
findInputComponent.setValue(editor.getSelection());
|
||||
selToggleComponent.setValue(false);
|
||||
}
|
||||
else {
|
||||
logger('Restore find text', 9);
|
||||
findInputComponent.setValue(this.settings.findText);
|
||||
}
|
||||
// Add button row to dialog
|
||||
buttonContainerEl.appendChild(submitButtonTarget);
|
||||
buttonContainerEl.appendChild(cancelButtonTarget);
|
||||
contentEl.appendChild(buttonContainerEl);
|
||||
// If no text is selected, disable selection-toggle-switch
|
||||
if (noSelection)
|
||||
selToggleComponent.setValue(false);
|
||||
}
|
||||
onClose() {
|
||||
const { contentEl } = this;
|
||||
contentEl.empty();
|
||||
}
|
||||
}
|
||||
class RegexFindReplaceSettingTab extends obsidian.PluginSettingTab {
|
||||
constructor(app, plugin) {
|
||||
super(app, plugin);
|
||||
this.plugin = plugin;
|
||||
}
|
||||
display() {
|
||||
const { containerEl } = this;
|
||||
containerEl.empty();
|
||||
containerEl.createEl('h4', { text: 'Regular Expression Settings' });
|
||||
new obsidian.Setting(containerEl)
|
||||
.setName('Case Insensitive')
|
||||
.setDesc('When using regular expressions, apply the \'/i\' modifier for case insensitive search)')
|
||||
.addToggle(toggle => toggle
|
||||
.setValue(this.plugin.settings.caseInsensitive)
|
||||
.onChange((value) => __awaiter(this, void 0, void 0, function* () {
|
||||
logger('Settings update: caseInsensitive: ' + value);
|
||||
this.plugin.settings.caseInsensitive = value;
|
||||
yield this.plugin.saveSettings();
|
||||
})));
|
||||
containerEl.createEl('h4', { text: 'General Settings' });
|
||||
new obsidian.Setting(containerEl)
|
||||
.setName('Process \\n as line break')
|
||||
.setDesc('When \'\\n\' is used in the replace field, a \'line break\' will be inserted accordingly')
|
||||
.addToggle(toggle => toggle
|
||||
.setValue(this.plugin.settings.processLineBreak)
|
||||
.onChange((value) => __awaiter(this, void 0, void 0, function* () {
|
||||
logger('Settings update: processLineBreak: ' + value);
|
||||
this.plugin.settings.processLineBreak = value;
|
||||
yield this.plugin.saveSettings();
|
||||
})));
|
||||
new obsidian.Setting(containerEl)
|
||||
.setName('Prefill Find Field')
|
||||
.setDesc('Copy the currently selected text (if any) into the \'Find\' text field. This setting is only applied if the selection does not contain linebreaks')
|
||||
.addToggle(toggle => toggle
|
||||
.setValue(this.plugin.settings.prefillFind)
|
||||
.onChange((value) => __awaiter(this, void 0, void 0, function* () {
|
||||
logger('Settings update: prefillFind: ' + value);
|
||||
this.plugin.settings.prefillFind = value;
|
||||
yield this.plugin.saveSettings();
|
||||
})));
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = RegexFindReplacePlugin;
|
||||
|
||||
|
||||
/* nosourcemap */
|
||||
10
mengyanote-backend/data/mengyanote/.obsidian/plugins/obsidian-regex-replace/manifest.json
vendored
Normal file
10
mengyanote-backend/data/mengyanote/.obsidian/plugins/obsidian-regex-replace/manifest.json
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"author": "Martin Eder",
|
||||
"authorUrl": "https://www.gruware.org",
|
||||
"description": "Find and replace text using regular expressions.",
|
||||
"id": "obsidian-regex-replace",
|
||||
"isDesktopOnly": false,
|
||||
"minAppVersion": "0.12.17",
|
||||
"name": "Regex Find/Replace",
|
||||
"version": "1.2.0"
|
||||
}
|
||||
51
mengyanote-backend/data/mengyanote/.obsidian/plugins/obsidian-regex-replace/styles.css
vendored
Normal file
51
mengyanote-backend/data/mengyanote/.obsidian/plugins/obsidian-regex-replace/styles.css
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
.find-replace-modal .modal-content .row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
margin-top: 8px;
|
||||
}
|
||||
|
||||
|
||||
.find-replace-modal .modal-content .row .input-label {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
|
||||
.find-replace-modal .modal-content .row .postfix-label {
|
||||
display: flex;
|
||||
height: 100%;
|
||||
margin-left: 8px;
|
||||
justify-content: flex-end;
|
||||
color: gray;
|
||||
}
|
||||
|
||||
|
||||
.find-replace-modal .modal-content .row .check-label {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
margin-right: 8px;
|
||||
}
|
||||
|
||||
|
||||
.find-replace-modal .modal-content .row .input-wrapper {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
|
||||
.find-replace-modal .modal-content .row .input-wrapper input {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
|
||||
.find-replace-modal .modal-content .button-wrapper {
|
||||
justify-content: center;
|
||||
margin-top: 16px;
|
||||
}
|
||||
@@ -38,7 +38,15 @@
|
||||
"Editor@@line-hover-indicator": true,
|
||||
"Appearance-light@@card-layout-open-light": true,
|
||||
"phycat-layout@@layout-style": "layout-cards",
|
||||
"phycat-colors@@light-color-scheme": "theme-light-sakura",
|
||||
"phycat-colors@@light-color-scheme": "theme-light-sky",
|
||||
"phycat-colors@@dark-color-scheme": "theme-dark-radiation",
|
||||
"phycat-layout@@rainbow-folders": true
|
||||
"phycat-layout@@rainbow-folders": true,
|
||||
"phycat-headings@@h1-light-color": "#FF5050",
|
||||
"phycat-headings@@h2-light-color": "#ED931D",
|
||||
"phycat-headings@@h3-light-color": "#EDE92B",
|
||||
"phycat-headings@@h4-light-color": "#4AF620",
|
||||
"phycat-headings@@h5-light-color": "#33FDFC",
|
||||
"phycat-headings@@h6-light-color": "#CF2AF7",
|
||||
"phycat-headings@@h1-alignment": "h1-align-left",
|
||||
"phycat-layout@@bg-mix-percent": 91
|
||||
}
|
||||
@@ -4,7 +4,7 @@
|
||||
"themesList": [
|
||||
{
|
||||
"repo": "sumruler/obsidian-theme-phycat",
|
||||
"lastUpdate": "38061840"
|
||||
"lastUpdate": "38104268"
|
||||
}
|
||||
],
|
||||
"updateAtStartup": true,
|
||||
|
||||
4
mengyanote-backend/data/mengyanote/.obsidian/snippets/md.css
vendored
Normal file
4
mengyanote-backend/data/mengyanote/.obsidian/snippets/md.css
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
.markdown-preview-view p {
|
||||
margin-top: 2px;
|
||||
margin-bottom: 2px;
|
||||
}
|
||||
@@ -4,25 +4,41 @@
|
||||
"type": "split",
|
||||
"children": [
|
||||
{
|
||||
"id": "f6c05057a0ef99fa",
|
||||
"id": "df67c67fc6eede4f",
|
||||
"type": "tabs",
|
||||
"children": [
|
||||
{
|
||||
"id": "1bf536b33f2e3608",
|
||||
"id": "d2bcc713b2622c69",
|
||||
"type": "leaf",
|
||||
"state": {
|
||||
"type": "markdown",
|
||||
"state": {
|
||||
"file": "项目策划/萌芽小店.md",
|
||||
"file": "计算机网络/计算机网络期末考试综合题简单论述.md",
|
||||
"mode": "source",
|
||||
"source": true,
|
||||
"backlinks": false
|
||||
},
|
||||
"icon": "lucide-file",
|
||||
"title": "计算机网络期末考试综合题简单论述"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "2e06118e2383ad3d",
|
||||
"type": "leaf",
|
||||
"state": {
|
||||
"type": "markdown",
|
||||
"state": {
|
||||
"file": "临时/cursor半价.md",
|
||||
"mode": "source",
|
||||
"source": false,
|
||||
"backlinks": false
|
||||
},
|
||||
"icon": "lucide-file",
|
||||
"title": "萌芽小店"
|
||||
"title": "cursor半价"
|
||||
}
|
||||
}
|
||||
]
|
||||
],
|
||||
"currentTab": 1
|
||||
}
|
||||
],
|
||||
"direction": "vertical"
|
||||
@@ -79,7 +95,7 @@
|
||||
}
|
||||
],
|
||||
"direction": "horizontal",
|
||||
"width": 300
|
||||
"width": 304.5
|
||||
},
|
||||
"right": {
|
||||
"id": "a00fc03fc4170f30",
|
||||
@@ -95,13 +111,13 @@
|
||||
"state": {
|
||||
"type": "outline",
|
||||
"state": {
|
||||
"file": "项目策划/萌芽小店.md",
|
||||
"file": "临时/cursor半价.md",
|
||||
"followCursor": false,
|
||||
"showSearch": false,
|
||||
"searchQuery": ""
|
||||
},
|
||||
"icon": "lucide-list",
|
||||
"title": "萌芽小店 的大纲"
|
||||
"title": "cursor半价 的大纲"
|
||||
}
|
||||
}
|
||||
]
|
||||
@@ -120,47 +136,47 @@
|
||||
"daily-notes:打开/创建今天的日记": false
|
||||
}
|
||||
},
|
||||
"active": "1bf536b33f2e3608",
|
||||
"active": "2e06118e2383ad3d",
|
||||
"lastOpenFiles": [
|
||||
"AI/控制台agent工具安装教程.md",
|
||||
"项目策划/万象口袋.md",
|
||||
"项目策划/萌芽Ping.md",
|
||||
"项目策划/萌芽小店.md",
|
||||
"项目策划/萌芽账户认证中心.md",
|
||||
"项目策划/萌芽桌面启动器.md",
|
||||
"AI/提示词工程/前端开发默认框架架构.md",
|
||||
"临时/浏览器更换默认字体.md",
|
||||
"临时/cursor半价.md",
|
||||
"AI/提示词工程/运维部署/Dokcer部署流程.md",
|
||||
"AI/提示词工程/AI绘图/绘画网站软件logo图标.md",
|
||||
"AI/提示词工程/AI绘图/AI绘画提示词.md",
|
||||
"AI/提示词工程/AI绘图/ai换装提示词.md",
|
||||
"MarkDown/树萌芽のGithub主页.md",
|
||||
"实习求职/简历/Golang后端开发.md",
|
||||
"MarkDown/未命名.md",
|
||||
"树萌芽の小本本/账号合集/CloudFlare账号.md",
|
||||
"树萌芽の小本本/账号合集/Github账号.md",
|
||||
"编程语言/前端/代码片段/代码片段-特殊HelloWorld输出.md",
|
||||
"编程语言/前端/代码片段/代码片段-标准HelloWorld输出.md",
|
||||
"AI/提示词工程/Windows开发/开发Windows软件细节.md",
|
||||
"AI/提示词工程/前端开发/前端随机背景图.md",
|
||||
"AI/提示词工程/前端开发/前端全局字体样式提示词.md",
|
||||
"AI/提示词工程/前端开发/前端网站图标获取方式.md",
|
||||
"前后端项目env环境配置解析.md",
|
||||
"AI/提示词工程/后端开发/后端API开发标准规范.md",
|
||||
"AI/提示词工程/后端开发/后端API接口根路径说明.md",
|
||||
"AI/提示词工程/后端开发/后端API部署成docker容器.md",
|
||||
"Windows/刷新浏览器和系统DNS缓存.md",
|
||||
"鉴政/女权主义/好姐妹介绍.md",
|
||||
"鉴政/中国社会主要矛盾演变梳理(1840年至今).md",
|
||||
"AI/提示词工程/AI绘图/商品封面图生成.md",
|
||||
"数据库/小萌芽开发中间件信息.md",
|
||||
"临时/未命名",
|
||||
"AI/提示词工程/角色扮演",
|
||||
"AI/提示词工程/后端开发/后端由json更改为SQLite储存",
|
||||
"算法与数据结构/LeetCode热题100",
|
||||
"量化投资",
|
||||
"数据库/RabbitMQ",
|
||||
"技术原理解析/Golang",
|
||||
"实习求职/面试经历/树萌芽の面试经历",
|
||||
"实习求职/术语科普",
|
||||
"实习求职/面试经历/Golang后端",
|
||||
"Pasted image 20260324211445.png",
|
||||
"项目策划/萌芽Ping-网页监控.md",
|
||||
"AI/AI大模型应用实现方式拆解.md",
|
||||
"树萌芽の奇思妙想/超长有故事的的域名.md",
|
||||
"树萌芽の奇思妙想/树萌芽の编程想法.md",
|
||||
"AI/提示词工程/文档类网页模板.md",
|
||||
"AI/提示词工程/SSH初始化与推送Git 仓库.md",
|
||||
"树萌芽の小本本/账号合集/AI账号/DeepSeek账号.md",
|
||||
"AI/提示词工程/Dokcer部署流程.md",
|
||||
"博客文章/未命名.md",
|
||||
"Docker/Docker 镜像相关.md",
|
||||
"Docker/Docker镜像快速迁移.md",
|
||||
"Docker/Docker常用命令总结.md",
|
||||
"树萌芽の小本本/账号合集/邮箱账号/微软邮箱.md",
|
||||
"收藏的DNS集合.md",
|
||||
"开源社交账号注册方式一览.md",
|
||||
"未命名.md",
|
||||
"树萌芽の小本本/账号合集/邮箱账号/QQ邮箱.md",
|
||||
"树萌芽の小本本/账号合集/AI账号/豆包账号.md",
|
||||
"树萌芽の小本本/账号合集/邮箱账号",
|
||||
"树萌芽の小本本/账号合集/邮箱账号.md",
|
||||
"树萌芽の小本本/账号合集",
|
||||
"Pasted image 20260325202027.png",
|
||||
"Pasted image 20260324211458.png",
|
||||
"实习求职/通用面试八股",
|
||||
"AI/AI控制台工具常用命令总结",
|
||||
"实习求职/面试经历/运维开发",
|
||||
"实习求职/面试经历/后端开发",
|
||||
"实习求职/牛客八股/网络模型",
|
||||
"实习求职/牛客八股/HTTP 与HTTPS",
|
||||
"实习求职/牛客八股",
|
||||
"算法与数据结构/2022年蓝桥杯PythonB组真题解析",
|
||||
"Pasted image 20260321154949.png",
|
||||
"Pasted image 20260321155016.png",
|
||||
"Pasted image 20260321162021.png",
|
||||
|
||||
35
mengyanote-backend/data/mengyanote/AGENTS.md
Normal file
35
mengyanote-backend/data/mengyanote/AGENTS.md
Normal file
@@ -0,0 +1,35 @@
|
||||
# Repository Guidelines
|
||||
|
||||
## Project Structure & Module Organization
|
||||
This repository is a Markdown-based knowledge base rather than an application codebase. Top-level folders group notes by domain, such as `AI/`, `Linux/`, `Docker/`, `数据库/`, `编程语言/`, and `项目策划/`. Root files like `README.md`, `📒萌芽笔记.md`, and `🗒记事本.md` act as entry points or quick notes. Obsidian workspace settings live in `.obsidian/`; only commit those changes when they are intentional and useful to other contributors.
|
||||
|
||||
## Build, Test, and Development Commands
|
||||
There is no required build step or automated test suite in this repository. Useful maintenance commands:
|
||||
|
||||
- `rg --files` lists all tracked notes quickly.
|
||||
- `git status --short` checks pending edits before committing.
|
||||
- `git diff -- path/to/file.md` reviews a note before submission.
|
||||
- `find . -name '*.md'` helps inspect coverage by folder when reorganizing content.
|
||||
|
||||
Preview and link-check notes in your local Markdown editor or Obsidian vault before committing.
|
||||
|
||||
## Coding Style & Naming Conventions
|
||||
Use Markdown with clear heading hierarchy (`#`, `##`, `###`) and short paragraphs. Prefer one topic per file. Keep filenames descriptive and readable, matching the existing repository style: Chinese titles are common, sometimes with product or technology prefixes such as `Linux/SSH/安全SSH连接.md` or `编程语言/Golang/Golang标准代码架构.md`. Use fenced code blocks with language tags, for example ```bash or ```json. Prefer relative links for cross-note references.
|
||||
|
||||
## Testing Guidelines
|
||||
Testing is manual. Verify that:
|
||||
|
||||
- headings render correctly,
|
||||
- code blocks are fenced and labeled,
|
||||
- internal links and paths are valid,
|
||||
- moved notes remain in the correct category folder.
|
||||
|
||||
For large reorganizations, open the vault in Obsidian and spot-check edited directories.
|
||||
|
||||
## Commit & Pull Request Guidelines
|
||||
Recent history uses short messages such as `chore: sync local changes`, `feat: 更新笔记内容`, and `update: 2026-03-28 21:00`. Follow that pattern, but make the summary specific: `docs: add WireGuard troubleshooting note` is better than `update`. Keep commits focused by topic or folder.
|
||||
|
||||
Pull requests should include a brief summary, affected directories, and any rename or move notes. Add screenshots only when a PR intentionally changes `.obsidian` appearance or workspace behavior.
|
||||
|
||||
## Security & Content Boundaries
|
||||
Do not commit secrets, private tokens, or machine-specific scratch data. Treat `.obsidian/workspace.json`, temporary notes, and personal account records as high-risk changes and review them carefully before pushing.
|
||||
80
mengyanote-backend/data/mengyanote/AI/AI Agent RAG和Find协同.md
Normal file
80
mengyanote-backend/data/mengyanote/AI/AI Agent RAG和Find协同.md
Normal file
@@ -0,0 +1,80 @@
|
||||
在 2026 年的 AI Agent 架构中,**RAG (检索增强生成)** 和 **Find (精确搜索/工具调用)** 不再是互斥的关系,而是演变为一种“分层记忆与多模态检索”的协同模式。
|
||||
|
||||
目前的趋势是将 Agent 的记忆视为一个**有生命周期的动态系统**,而不仅仅是简单的文档堆砌。
|
||||
|
||||
---
|
||||
|
||||
## 1. 记忆存储:从“死文档 RAG”到“活记忆 Memory”
|
||||
|
||||
对于 Agent 的长期记忆,目前主流的态度是:**RAG 负责广度(外部知识),Memory 负责深度(用户习惯与状态)。**
|
||||
|
||||
### RAG 的角色:无状态的外部知识库
|
||||
|
||||
- **态度:** RAG 被视为 Agent 的“外挂资料库”。它是**无状态的**,主要用于处理海量的、不经常变动的非结构化数据(如 PDF、Wiki)。
|
||||
|
||||
- **局限:** 传统的 RAG 在处理“我昨天说了什么”或“我的编程风格”这类具有时效性和个体差异的问题时表现糟糕。
|
||||
|
||||
|
||||
### Memory (Agent 记忆) 的演进:有状态的持久化
|
||||
|
||||
- **态度:** 现代 Agent(如基于 Mem0 或 Evo-Memory 架构的系统)将记忆分为**短期工作内存**、**片段记忆**(过去发生的事件)和**语义记忆**(事实与偏好)。
|
||||
|
||||
- **关键技术:**
|
||||
|
||||
- **自动提取与更新:** Agent 会在对话中自动提取事实(例如:“用户更倾向于使用 Python 3.12”),并更新旧记忆,而不是简单地叠加向量。
|
||||
|
||||
- **重要性加权:** 记忆不再只看语义相似度,还会根据新鲜度(Recency)**和**关键度(Importance)进行加权。
|
||||
|
||||
|
||||
---
|
||||
|
||||
## 2. 代码文件搜索:从“语义匹配”到“结构化感知”
|
||||
|
||||
在处理代码搜索时,主流 Agent 已经意识到**纯语义 RAG(Vector Search)会造成严重的上下文缺失**。目前更倾向于 **Find(精确搜索)+ Graph(结构化关联)**。
|
||||
|
||||
### 为什么单纯的 RAG 会在代码搜索中失败?
|
||||
|
||||
代码具有极强的结构性。如果你搜一个函数名,RAG 可能会因为语义相似给你返回一堆注释,但由于 Chunking(分块)切断了函数定义和调用栈的联系,Agent 无法理解逻辑。
|
||||
|
||||
### 现在的处理策略:
|
||||
|
||||
1. **LSP (Language Server Protocol) 结合:**
|
||||
|
||||
Agent 不再只是检索文字,而是通过调用类似 `grep` 或 `LSP` 的工具执行“精确 Find”。它会直接跳转到定义(Go to Definition)或查找引用(Find References),这种**确定性搜索**的优先级高于模糊的 RAG 检索。
|
||||
|
||||
2. **GraphRAG (知识图谱 RAG):**
|
||||
|
||||
将代码仓库建模为图结构(节点是类和函数,边是调用关系)。当 Agent 搜索某个功能时,它能沿着调用链“爬行”,获取完整的上下文,而不仅仅是匹配几个关键词。
|
||||
|
||||
3. **Hybrid Search (混合检索):**
|
||||
|
||||
- **关键词匹配(BM25):** 快速定位精确的变量名或报错信息。
|
||||
|
||||
- **向量检索:** 用于理解“如何实现一个加密功能”这种模糊的意图。
|
||||
|
||||
|
||||
---
|
||||
|
||||
## 3. RAG 与 Find 的核心差异对比
|
||||
|
||||
下表总结了目前 Agent 对这两者的权衡:
|
||||
|
||||
|**特性**|**RAG (检索增强)**|**Find (工具/精确搜索)**|
|
||||
|---|---|---|
|
||||
|**底层逻辑**|语义相似度 (向量空间)|模式匹配 (正则/LSP/SQL)|
|
||||
|**适用场景**|咨询文档、总结长篇背景、模糊知识获取|查找变量、执行精准跳转、数据库查询|
|
||||
|**准确性**|存在幻觉风险 (可能搜到无关段落)|极高 (匹配即存在)|
|
||||
|**Agent 态度**|作为**背景补充**,属于感知层|作为**行动工具**,属于执行层|
|
||||
|
||||
---
|
||||
|
||||
## 总结
|
||||
|
||||
目前的顶尖 Agent(如 Cursor 的代码 Agent 或企业级数字员工)采取的是“工具化 RAG”的态度:
|
||||
|
||||
- **对于代码:** 优先使用 LSP 和树结构进行**精确 Find**,RAG 只作为最后的语义辅助。
|
||||
|
||||
- **对于记忆:** 弃用简单的“存向量-查向量”模式,转而使用**图谱化存储**,让 Agent 能够理解信息之间的逻辑关系(如:版本 A 已经废弃,现在要参考版本 B)。
|
||||
|
||||
|
||||
简单来说,**“Find”是为了保证正确性,而“RAG”是为了保证理解力。**
|
||||
@@ -6,18 +6,18 @@ Claude Code 的命令主要分为三类:
|
||||
|
||||
### 1. 终端 CLI 命令(claude [flags])
|
||||
|
||||
| 命令示例 | 主要作用 | 典型用法示例 | 备注 |
|
||||
|--------------------------------|--------------------------------------------|---------------------------------------------------|-----------------------|
|
||||
| `claude` | 启动交互式 REPL / TUI 会话 | `claude` | 最常用入口 |
|
||||
| `claude "你的任务描述"` | 带初始提示启动交互会话 | `claude "写单元测试并运行它们"` | 直接开始工作 |
|
||||
| `claude -p "查询"` | 非交互式单次查询(pipe 友好,执行后退出) | `cat error.log \| claude -p "分析日志"` | 脚本 / CI 常用 |
|
||||
| `claude -c` | 继续当前目录下最近的会话 | `claude -c` | 恢复上次工作 |
|
||||
| `claude -c -p "继续任务"` | 继续上次会话 + 单次查询后退出 | `claude -c -p "修复剩余 bug"` | 快速迭代 |
|
||||
| `claude -r <session-id>` | 按 ID 恢复特定历史会话 | `claude -r abc123 "继续优化"` | 指定会话 |
|
||||
| `claude update` | 更新到最新版本 | `claude update` | 保持最新 |
|
||||
| `claude auth login` | 登录 Anthropic 账号 | `claude auth login --email xxx@xx.com` | 首次或切换账号 |
|
||||
| `claude auth logout` | 退出登录 | `claude auth logout` | — |
|
||||
| `claude doctor` | 诊断环境、健康检查 | `claude doctor` | 排查问题 |
|
||||
| 命令示例 | 主要作用 | 典型用法示例 | 备注 |
|
||||
| ------------------------ | ----------------------- | -------------------------------------- | ---------- |
|
||||
| `claude` | 启动交互式 REPL / TUI 会话 | `claude` | 最常用入口 |
|
||||
| `claude "你的任务描述"` | 带初始提示启动交互会话 | `claude "写单元测试并运行它们"` | 直接开始工作 |
|
||||
| `claude -p "查询"` | 非交互式单次查询(pipe 友好,执行后退出) | `cat error.log \| claude -p "分析日志"` | 脚本 / CI 常用 |
|
||||
| `claude -c` | 继续当前目录下最近的会话 | `claude -c` | 恢复上次工作 |
|
||||
| `claude -c -p "继续任务"` | 继续上次会话 + 单次查询后退出 | `claude -c -p "修复剩余 bug"` | 快速迭代 |
|
||||
| `claude -r <session-id>` | 按 ID 恢复特定历史会话 | `claude -r abc123 "继续优化"` | 指定会话 |
|
||||
| `claude update` | 更新到最新版本 | `claude update` | 保持最新 |
|
||||
| `claude auth login` | 登录 Anthropic 账号 | `claude auth login --email xxx@xx.com` | 首次或切换账号 |
|
||||
| `claude auth logout` | 退出登录 | `claude auth logout` | — |
|
||||
| `claude doctor` | 诊断环境、健康检查 | `claude doctor` | 排查问题 |
|
||||
|
||||
### 2. 常用全局 Flags(可加在 claude 命令后)
|
||||
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
|
||||
### 1. 终端启动/CLI 命令(在 shell 中直接运行)
|
||||
|
||||
Pi Mono 的 CLI 入口通常为 `pi-code` 或通过 `npx`/`pnpm` 调用。它支持非交互式的一行命令模式,也支持启动完整的 TUI(终端界面)。
|
||||
|
||||
| 命令示例 | 主要作用 | 典型用法/备注 |
|
||||
| :--- | :--- | :--- |
|
||||
| `pi-code` | 启动交互式 TUI 会话 | 最常用入口,进入后可与 AI 进行多轮对话,支持工具调用 |
|
||||
| `pi-code "描述任务"` | 带初始 Prompt 启动会话 | `pi-code "修复这个 bug 并运行测试"` |
|
||||
| `pi-code -p "查询"` | **非交互式管道模式**(执行后退出) | 适合脚本调用:`cat error.log \| pi-code -p "分析"` |
|
||||
| `pi-code search "关键词"` | 直接在代码库中搜索逻辑 | 例如 `pi-code search "用户认证逻辑在哪"` |
|
||||
| `pi-code refactor "目标"` | 执行特定重构任务 | 例如 `pi-code refactor "将类组件转为函数组件"` |
|
||||
| `pi-code --model <model>` | 启动时指定模型 | 支持切换不同的 LLM 提供商与模型 |
|
||||
|
||||
### 2. 常用全局 Flags(配置与环境)
|
||||
|
||||
| Flag | 作用 | 示例 |
|
||||
| :--- | :--- | :--- |
|
||||
| `--model <name>` | 指定使用的 AI 模型 | `pi-code --model gpt-4o` |
|
||||
| `--system-prompt <file>` | 加载自定义系统指令文件 | 支持加载 `SYSTEM.md` 覆盖默认 Prompt |
|
||||
| `--dangerously-skip-permissions` | **跳过工具执行确认**(高风险,仅限可信环境) | 自动化脚本中使用,减少人工干预 |
|
||||
| `--debug` | 开启详细调试日志 | 用于排查 Agent 循环或工具调用问题 |
|
||||
|
||||
### 3. 交互模式内 Slash 命令(进入 `pi-code` 后使用)
|
||||
|
||||
进入交互模式后,输入 `/` 即可触发各种内部命令。**注意:** 较新版本(≥ v0.29.1)已对命令进行了整合,强化了 `/settings` 统一菜单 。
|
||||
|
||||
| Slash 命令 | 主要作用 | 备注/演进说明 |
|
||||
| :--- | :--- | :--- |
|
||||
| `/help` | 显示所有可用的 Slash 命令 | 入门必备,随时查看 |
|
||||
| `/settings` | **统一设置菜单** | **新版核心命令**,整合了以下旧版独立设置项 :<br>- 思考级别 (Thinking Level)<br>- 主题 (Theme)<br>- 队列模式 (Queue)<br>- 自动压缩 (Auto-compact) |
|
||||
| `/init` | 初始化项目上下文 | 扫描项目,生成记忆文件 (如 `CLAUDE.md` 或类似) |
|
||||
| `/clear` | 清空当前会话历史 | 开始全新任务,重置上下文 |
|
||||
| `/compact` | 压缩对话上下文 | 当会话 token 过多、响应变慢时使用 |
|
||||
| `/model` | 对话中实时切换模型 | 如从 Haiku 切换到 Sonnet 处理复杂逻辑 |
|
||||
| `/undo` / `/rewind` | 撤销上一步操作或变更 | 类似 Git 回退,AI 改坏了可以快速恢复状态 |
|
||||
| `/cost` | 查看当前会话 Token 消耗与预估费用 | 监控使用量 |
|
||||
|
||||
### 核心设计哲学对应表
|
||||
|
||||
理解 Pi Mono 的命令,关键是理解它的 **四大核心工具**——所有操作最终都是为了驱动这四个能力 :
|
||||
|
||||
| 工具名 | 对应的人类行为 | 典型 CLI 交互场景 |
|
||||
| :--- | :--- | :--- |
|
||||
| **Read** | 阅读代码 | AI 自动调用 `read` 分析报错文件 |
|
||||
| **Write** | 创建新文件 | `pi-code "新建一个 React 组件"` |
|
||||
| **Edit** | 精确修改 | AI 定位到具体行数进行替换 |
|
||||
| **Bash** | 执行终端命令 | AI 运行 `npm run test` 验证修改 |
|
||||
@@ -0,0 +1,66 @@
|
||||
|
||||
## 1. Cursor:基于 IDE 的“分层索引”与语义 RAG
|
||||
|
||||
Cursor 的核心竞争力在于它与 IDE(VS Code 分叉)的深度集成,其检索是一个**后台持续运行**的自动化流水线。
|
||||
|
||||
### 核心实现机制:
|
||||
|
||||
- **Merkle Tree 增量同步:**
|
||||
|
||||
Cursor 使用 **Merkle Tree(默克尔树)** 算法来检测本地文件的变化。这意味着它不需要每次都重新扫描整个项目,只需对比哈希值就能快速定位改动过的代码块,保证索引的秒级更新。
|
||||
|
||||
- **语法感知切片 (Syntax-Aware Chunking):**
|
||||
|
||||
不同于通用的文本 RAG 将代码按字符数切割,Cursor 会解析代码的 **AST(抽象语法树)**。它能识别类、函数和方法,确保检索出来的代码块是逻辑完整的,而不是断头断尾的代码片段。
|
||||
|
||||
- **混合向量库:**
|
||||
|
||||
它使用 **Turbopuffer** 这种专为 AI 扩展设计的云端向量数据库。它将代码转化为高维向量(Embeddings),当你输入 `@Codebase` 时,系统会进行**语义搜索**(比如搜“支付逻辑”能找到没有关键词但功能相关的 `handle_checkout` 函数)。
|
||||
|
||||
- **隐私处理:**
|
||||
|
||||
在索引时,Cursor 仅向服务器发送混淆后的元数据和向量,而非明文代码,平衡了检索性能与企业代码安全。
|
||||
|
||||
|
||||
---
|
||||
|
||||
## 2. Claude Code:基于 CLI 的“代理式工具”与上下文压缩
|
||||
|
||||
Claude Code(Anthropic 推出的命令行 Agent)的思路更偏向于**按需搜索**和**多级内存管理**。
|
||||
|
||||
### 核心实现机制:
|
||||
|
||||
- **工具化搜索 (Agentic Search):**
|
||||
|
||||
Claude Code 不倾向于后台静默索引,而是给 Agent 一套“搜索工具”(如 `grep`、文件树列举)。当它需要了解项目时,它会主动决策:“我需要看看 `/src` 目录下有哪些 API 定义”,然后调用工具去查。
|
||||
|
||||
- **三层内存分级 (3-Tier Memory):**
|
||||
|
||||
它建立了一个层级架构来管理检索到的信息:
|
||||
|
||||
1. **用户级 (~/.claude/CLAUDE.md):** 跨项目的全局偏好。
|
||||
|
||||
2. **项目级 (CLAUDE.md):** 项目架构、规范和关键逻辑的“快照”。
|
||||
|
||||
3. **动态导入:** 针对当前任务实时搜索到的代码。
|
||||
|
||||
- **五层上下文压缩 (Context Compaction):**
|
||||
|
||||
由于 CLI 工具主要靠长上下文(Claude 3.5/4 系列的 200k+ 窗口),它在调用模型前会进行 5 层压缩处理(包括摘要化、无用信息剪枝、上下文折叠等),确保在不损失关键检索信息的前提下节省 Token。
|
||||
|
||||
- **RAG 自动切换模式:**
|
||||
|
||||
当项目规模超过上下文窗口极限时,Claude Code 会自动开启 RAG 模式,从“全量加载”切换为“精准检索”。
|
||||
|
||||
|
||||
---
|
||||
|
||||
## 3. 深度对比:Cursor vs Claude Code
|
||||
|
||||
|**特性**|**Cursor (IDE 模式)**|**Claude Code (CLI/Agent 模式)**|
|
||||
|---|---|---|
|
||||
|**检索触发**|**静默索引**:后台持续生成向量|**任务驱动**:Agent 根据目标主动去搜|
|
||||
|**核心算法**|向量搜索 (Vector) + Merkle Tree|模式匹配 (Grep) + 代理决策|
|
||||
|**上下文管理**|侧重于**“找得准”**(相似度匹配)|侧重于**“装得多”**(超长窗口 + 动态压缩)|
|
||||
|**擅长场景**|快速定位文件、行内补全、解释代码|跨文件的架构重构、自主 Bug 修复、自动化测试|
|
||||
|
||||
377
mengyanote-backend/data/mengyanote/AI/PI-Mono-Agent架构解析.md
Normal file
377
mengyanote-backend/data/mengyanote/AI/PI-Mono-Agent架构解析.md
Normal file
@@ -0,0 +1,377 @@
|
||||
|
||||
## 它主要是用什么语言写的
|
||||
|
||||
从官方仓库看,**核心就是 Node.js / TypeScript 生态**:仓库根目录有 `package.json`、`tsconfig.json`,官方开发命令也是 `npm install`、`npm run build`、`npm run check`,并且包结构里主要是 `pi-ai`、`pi-agent-core`、`pi-coding-agent`、`pi-tui`、`pi-web-ui` 这些 npm 包。([GitHub](https://github.com/badlogic/pi-mono "GitHub - badlogic/pi-mono: AI agent toolkit: coding agent CLI, unified LLM API, TUI & web UI libraries, Slack bot, vLLM pods · GitHub"))
|
||||
|
||||
另外,官方文档明确写了:
|
||||
|
||||
- **Extensions 是 TypeScript modules**
|
||||
|
||||
- 你可以用它们来注册工具、命令、UI、事件钩子
|
||||
|
||||
- 还能把扩展打成 **Pi Packages** 通过 npm 或 git 复用。([GitHub](https://github.com/badlogic/pi-mono/blob/main/packages/coding-agent/README.md "pi-mono/packages/coding-agent/README.md at main · badlogic/pi-mono · GitHub"))
|
||||
|
||||
|
||||
所以你可以把它理解成:
|
||||
|
||||
> **“一个以 TypeScript 为核心的 Agent 框架 / 终端 agent harness”**。([GitHub](https://github.com/badlogic/pi-mono "GitHub - badlogic/pi-mono: AI agent toolkit: coding agent CLI, unified LLM API, TUI & web UI libraries, Slack bot, vLLM pods · GitHub"))
|
||||
|
||||
---
|
||||
|
||||
## 能不能基于它魔改成不同专用 Agent
|
||||
|
||||
**完全可以,而且比很多现成 Agent 更适合“专用化”。**
|
||||
官方 README 直接说 Pi 的思路就是:
|
||||
|
||||
> **适配你的工作流,而不是让你去适配它。**
|
||||
> 你可以通过 **TypeScript Extensions、Skills、Prompt Templates、Themes** 来扩展,而不必 fork 后硬改内部。([GitHub](https://github.com/badlogic/pi-mono/blob/main/packages/coding-agent/README.md "pi-mono/packages/coding-agent/README.md at main · badlogic/pi-mono · GitHub"))
|
||||
|
||||
官方扩展文档也明确给了这些能力:
|
||||
|
||||
- 注册 **自定义工具** 给 LLM 调用
|
||||
|
||||
- 拦截或修改工具调用
|
||||
|
||||
- 增加 **自定义命令**
|
||||
|
||||
- 做 **自定义 TUI 交互**
|
||||
|
||||
- 做 **会话持久化状态**
|
||||
|
||||
- 接 webhook、CI、外部系统。([GitHub](https://github.com/badlogic/pi-mono/blob/main/packages/coding-agent/docs/extensions.md "pi-mono/packages/coding-agent/docs/extensions.md at main · badlogic/pi-mono · GitHub"))
|
||||
|
||||
|
||||
所以从工程角度讲,你有两条路:
|
||||
|
||||
### 方案 A:不 fork,做“专用化配置 + 扩展”
|
||||
|
||||
这是最推荐的。
|
||||
|
||||
适合做:
|
||||
|
||||
- 运维工程师 Agent
|
||||
|
||||
- 全栈开发 Agent
|
||||
|
||||
- 后端 Agent
|
||||
|
||||
- Linux 学习 / 排障 Agent
|
||||
|
||||
- 游戏服务端 Agent
|
||||
|
||||
|
||||
做法一般是:
|
||||
|
||||
- 换 system prompt / prompt template
|
||||
|
||||
- 加 skills
|
||||
|
||||
- 加一批 TypeScript extensions
|
||||
|
||||
- 注册专属工具
|
||||
|
||||
- 限制某些高危操作
|
||||
|
||||
- 定制命令和 UI。([GitHub](https://github.com/badlogic/pi-mono/blob/main/packages/coding-agent/README.md "pi-mono/packages/coding-agent/README.md at main · badlogic/pi-mono · GitHub"))
|
||||
|
||||
|
||||
### 方案 B:直接 fork pi-mono 深度魔改
|
||||
|
||||
也能做,尤其当你想改这些底层东西时:
|
||||
|
||||
- agent loop
|
||||
|
||||
- session 格式
|
||||
|
||||
- provider 接入层
|
||||
|
||||
- TUI 行为
|
||||
|
||||
- 默认工具策略
|
||||
|
||||
- 多 agent 编排方式
|
||||
|
||||
|
||||
因为它本身就是 monorepo,包分层很清楚:`pi-ai` 负责模型抽象,`pi-agent-core` 负责 agent runtime,`pi-coding-agent` 是 CLI,`pi-tui` 是终端 UI。([GitHub](https://github.com/badlogic/pi-mono "GitHub - badlogic/pi-mono: AI agent toolkit: coding agent CLI, unified LLM API, TUI & web UI libraries, Slack bot, vLLM pods · GitHub"))
|
||||
|
||||
---
|
||||
|
||||
## 你举的两个例子,理论上都很适合
|
||||
|
||||
### 1. 运维工程师 Agent
|
||||
|
||||
这个特别适合 Pi。
|
||||
|
||||
因为扩展系统能做:
|
||||
|
||||
- 命令白名单 / 黑名单
|
||||
|
||||
- `sudo`、`rm -rf`、`kubectl delete` 前确认
|
||||
|
||||
- 自动读取日志
|
||||
|
||||
- 封装 `ssh`、`docker`、`systemctl`、`journalctl`
|
||||
|
||||
- 接 Prometheus / Grafana / Webhook / CI
|
||||
|
||||
- 保留排障状态和上下文。([GitHub](https://github.com/badlogic/pi-mono/blob/main/packages/coding-agent/docs/extensions.md "pi-mono/packages/coding-agent/docs/extensions.md at main · badlogic/pi-mono · GitHub"))
|
||||
|
||||
|
||||
你可以做成这种能力组合:
|
||||
|
||||
- `/diag`:自动诊断 CPU、内存、磁盘、systemd 状态
|
||||
|
||||
- `/k8s`:读取 Pod、Events、Logs
|
||||
|
||||
- `/nginx`:分析配置和报错
|
||||
|
||||
- `/rollback`:帮你执行回滚步骤,但要人工确认
|
||||
|
||||
- `/safe-shell`:高危命令前二次确认
|
||||
|
||||
|
||||
Pi 文档里甚至专门提到过这类扩展场景:
|
||||
|
||||
- 权限门禁
|
||||
|
||||
- 路径保护
|
||||
|
||||
- 外部集成
|
||||
|
||||
- 有状态工具。([GitHub](https://github.com/badlogic/pi-mono/blob/main/packages/coding-agent/docs/extensions.md "pi-mono/packages/coding-agent/docs/extensions.md at main · badlogic/pi-mono · GitHub"))
|
||||
|
||||
|
||||
---
|
||||
|
||||
### 2. 全栈开发 Agent
|
||||
|
||||
这个也很适合,而且比“纯运维 agent”更贴近 Pi 目前主定位。
|
||||
|
||||
你可以给它加:
|
||||
|
||||
- 前端工具:读页面结构、跑构建、跑测试
|
||||
|
||||
- 后端工具:生成接口、迁移、测试、lint
|
||||
|
||||
- 数据库工具:封装 migration / schema diff
|
||||
|
||||
- Git 工具:自动提交、分支管理、PR 辅助
|
||||
|
||||
- 项目模板 skill:Next.js、NestJS、Go、Spring、Node API 等
|
||||
|
||||
|
||||
README 明确说 Pi 支持:
|
||||
|
||||
- interactive mode
|
||||
|
||||
- JSON / print mode
|
||||
|
||||
- RPC 模式
|
||||
|
||||
- SDK embedding
|
||||
也就是说它不只是命令行聊天壳子,还能嵌进你自己的应用里。([GitHub](https://github.com/badlogic/pi-mono/blob/main/packages/coding-agent/README.md "pi-mono/packages/coding-agent/README.md at main · badlogic/pi-mono · GitHub"))
|
||||
|
||||
|
||||
---
|
||||
|
||||
## 真正适合它的“专用 Agent”长什么样
|
||||
|
||||
Pi 更适合做这种:
|
||||
|
||||
> **“在一个专业领域里,有固定流程、有固定工具、有可控权限”的 agent**
|
||||
|
||||
比如:
|
||||
|
||||
### 很适合
|
||||
|
||||
- 运维排障 agent
|
||||
|
||||
- 全栈开发 agent
|
||||
|
||||
- 代码审查 agent
|
||||
|
||||
- 测试生成 agent
|
||||
|
||||
- 游戏后端开发 agent
|
||||
|
||||
- Linux 学习陪练 agent
|
||||
|
||||
- K8s 诊断 agent
|
||||
|
||||
|
||||
### 不算最适合
|
||||
|
||||
- 那种强依赖图形浏览器自动操作的网站 agent
|
||||
|
||||
- 一上来就想做超级复杂多 agent 调度平台
|
||||
|
||||
- 完全零代码、零配置、即装即用型产品
|
||||
|
||||
|
||||
因为 Pi 的核心哲学还是 **极简 + 自己扩展**,不是“开箱自带一切”。([Mario Zechner](https://mariozechner.at/posts/2025-11-30-pi-coding-agent/?utm_source=chatgpt.com "What I learned building an opinionated and minimal coding ..."))
|
||||
|
||||
---
|
||||
|
||||
## 做专用 Agent 时,推荐怎么改
|
||||
|
||||
我建议你按这 4 层去改,而不是一上来 fork 全仓库:
|
||||
|
||||
### 第 1 层:Prompt / Skills
|
||||
|
||||
定义角色:
|
||||
|
||||
- 运维工程师 agent
|
||||
|
||||
- 全栈开发 agent
|
||||
|
||||
- Go 后端 agent
|
||||
|
||||
- Linux 导师 agent
|
||||
|
||||
|
||||
这一层决定它“说话方式”和“解题策略”。Pi 官方把 Skills、Prompt Templates 当成正式定制方式之一。([GitHub](https://github.com/badlogic/pi-mono/blob/main/packages/coding-agent/README.md "pi-mono/packages/coding-agent/README.md at main · badlogic/pi-mono · GitHub"))
|
||||
|
||||
### 第 2 层:Extensions
|
||||
|
||||
这是最关键的一层。
|
||||
|
||||
你可以在扩展里做:
|
||||
|
||||
- 注册自定义工具
|
||||
|
||||
- 注册命令
|
||||
|
||||
- 拦截危险调用
|
||||
|
||||
- 加状态存储
|
||||
|
||||
- 做外部系统集成。([GitHub](https://github.com/badlogic/pi-mono/blob/main/packages/coding-agent/docs/extensions.md "pi-mono/packages/coding-agent/docs/extensions.md at main · badlogic/pi-mono · GitHub"))
|
||||
|
||||
|
||||
### 第 3 层:Tools
|
||||
|
||||
把专用能力封成工具给模型调用,比如:
|
||||
|
||||
运维 agent:
|
||||
|
||||
- `check_system_health`
|
||||
|
||||
- `read_nginx_conf`
|
||||
|
||||
- `tail_service_logs`
|
||||
|
||||
- `kubectl_get_pods`
|
||||
|
||||
- `restart_service_safe`
|
||||
|
||||
|
||||
全栈 agent:
|
||||
|
||||
- `run_frontend_test`
|
||||
|
||||
- `generate_api_route`
|
||||
|
||||
- `db_migration_status`
|
||||
|
||||
- `git_commit_changes`
|
||||
|
||||
- `scan_project_structure`
|
||||
|
||||
|
||||
### 第 4 层:底层 fork
|
||||
|
||||
当你想改 runtime、session、provider、TUI,再 fork。
|
||||
|
||||
---
|
||||
|
||||
## 你要注意的现实问题
|
||||
|
||||
### 1. 它不是“写个 prompt 就完事”
|
||||
|
||||
真正好用的专用 agent,核心不在 prompt,而在:
|
||||
|
||||
- 工具设计
|
||||
|
||||
- 权限控制
|
||||
|
||||
- 上下文组织
|
||||
|
||||
- 输出格式约束
|
||||
|
||||
|
||||
Pi 很适合做这些,但也意味着你得自己设计。([GitHub](https://github.com/badlogic/pi-mono/blob/main/packages/coding-agent/docs/extensions.md "pi-mono/packages/coding-agent/docs/extensions.md at main · badlogic/pi-mono · GitHub"))
|
||||
|
||||
### 2. 运维 agent 一定要做权限隔离
|
||||
|
||||
比如:
|
||||
|
||||
- 禁止直接删生产资源
|
||||
|
||||
- 高危命令必须确认
|
||||
|
||||
- 只允许白名单主机
|
||||
|
||||
- 日志可读,写操作有限制
|
||||
|
||||
|
||||
Pi 扩展机制支持做这类 guard rail。([GitHub](https://github.com/badlogic/pi-mono/blob/main/packages/coding-agent/docs/extensions.md "pi-mono/packages/coding-agent/docs/extensions.md at main · badlogic/pi-mono · GitHub"))
|
||||
|
||||
### 3. 全栈 agent 最好按栈拆 skill
|
||||
|
||||
不要做一个“万能全栈神 agent”,更实用的是拆成:
|
||||
|
||||
- React / Vue 前端 skill
|
||||
|
||||
- Node / Go 后端 skill
|
||||
|
||||
- PostgreSQL / Mongo 工具
|
||||
|
||||
- Docker / CI skill
|
||||
|
||||
|
||||
这样更稳。
|
||||
|
||||
---
|
||||
|
||||
## 直接回答你的问题
|
||||
|
||||
### 他是用什么语言编写的?
|
||||
|
||||
**主要是 TypeScript / Node.js 生态。** 官方仓库和文档都明确显示它是 npm monorepo,并且扩展是 TypeScript modules。([GitHub](https://github.com/badlogic/pi-mono "GitHub - badlogic/pi-mono: AI agent toolkit: coding agent CLI, unified LLM API, TUI & web UI libraries, Slack bot, vLLM pods · GitHub"))
|
||||
|
||||
### 可不可以基于他魔改做不同专用 agent?
|
||||
|
||||
**可以,而且非常适合。**
|
||||
最推荐的方式不是先 fork,而是:
|
||||
|
||||
> **Pi 本体 + Prompt Templates + Skills + TypeScript Extensions + 自定义 Tools**
|
||||
|
||||
这样就能做出:
|
||||
|
||||
- 运维工程师 agent
|
||||
|
||||
- 全栈开发 agent
|
||||
|
||||
- 后端开发 agent
|
||||
|
||||
- Linux 排障 agent。([GitHub](https://github.com/badlogic/pi-mono/blob/main/packages/coding-agent/README.md "pi-mono/packages/coding-agent/README.md at main · badlogic/pi-mono · GitHub"))
|
||||
|
||||
|
||||
### 要不要 fork?
|
||||
|
||||
- **轻中度专用化:不用 fork**
|
||||
|
||||
- **深度改 agent runtime / UI / provider / session:再 fork**。([GitHub](https://github.com/badlogic/pi-mono "GitHub - badlogic/pi-mono: AI agent toolkit: coding agent CLI, unified LLM API, TUI & web UI libraries, Slack bot, vLLM pods · GitHub"))
|
||||
|
||||
|
||||
---
|
||||
|
||||
按你的背景,其实最适合你的是这两种:
|
||||
|
||||
1. **Linux / 运维排障 Agent**
|
||||
|
||||
2. **游戏后端开发 Agent**(尤其适合你那个“萌芽农场”服务端)
|
||||
|
||||
|
||||
我可以下一条直接给你画一套
|
||||
**“基于 Pi 改造成运维工程师 Agent 的完整架构图 + 模块清单 + 目录结构”**。
|
||||
37
mengyanote-backend/data/mengyanote/AI/PI-Mono架构解析.md
Normal file
37
mengyanote-backend/data/mengyanote/AI/PI-Mono架构解析.md
Normal file
@@ -0,0 +1,37 @@
|
||||
pi-mono 是一个功能强大的 AI Agent 工具包,由知名游戏框架 libGDX 的开发者 Mario Zechner 创建。它以其极简主义的设计哲学和模块化的架构而备受瞩目,为开发者构建 AI 应用提供了全方位的支持。
|
||||
|
||||
🎯 核心设计哲学:Less is More
|
||||
|
||||
pi-mono 的核心竞争力在于其“少即是多”的工程理念。与许多功能繁杂的框架不同,它刻意保持极简,将 Agent 的能力收敛到最基础的四个工具上,相信大模型能够通过这些基础原语组合出复杂的能力。
|
||||
|
||||
这四个核心工具是:
|
||||
* Read: 读取文件内容。
|
||||
* Write: 创建或完全重写文件。
|
||||
* Edit: 精确替换文件中的文本。
|
||||
* Bash: 执行命令行指令。
|
||||
|
||||
这种设计覆盖了“读、写、改、跑”的开发主路径,形成了一个完整且可控的闭环,让 Agent 能够在其中自主地理解代码、修改代码并验证结果。
|
||||
|
||||
🧩 模块化架构
|
||||
|
||||
pi-mono 采用清晰的四层分层架构,各层之间松耦合,开发者可以根据需求灵活选用,无需加载整个框架。
|
||||
|
||||
1. CLI 工具层 (pi-coding-agent): 提供交互式的编码 Agent 命令行界面,负责会话管理、主题和上下文文件处理。
|
||||
2. 终端 UI 层 (pi-tui): 一个高质量的终端用户界面库,支持差分渲染,确保交互过程流畅不闪烁。
|
||||
3. Agent 逻辑层 (pi-agent-core): Agent 的核心运行时,处理工具调用、事件流和状态管理。
|
||||
4. LLM 抽象层 (pi-ai): 统一的 LLM API,封装了对 OpenAI、Anthropic、Google 等多种主流大语言模型提供商的调用,简化了模型切换和成本跟踪。
|
||||
|
||||
此外,它还包含用于 Slack 集成的 pi-mom、用于 Web 界面的 pi-web-ui 以及用于管理 vLLM 部署的 pi-pods 等组件。
|
||||
|
||||
✨ 独特优势
|
||||
|
||||
* 强大的扩展系统 (Extension System): 这是 pi-mono 的一大亮点。它不仅仅是简单的插件,而是通过几十个生命周期钩子(hook),允许开发者深度定制 Agent 的行为,例如注册自定义工具、监听所有代理事件、覆写系统提示词等。
|
||||
* 灵活的会话管理: 会话以树形结构组织,开发者可以进行分支、回滚等操作,方便地尝试不同方案或修复问题,然后合并回主线。
|
||||
* 引导消息 (Steering Messages): 在 Agent 执行任务的过程中,用户可以通过 agent.steer() 方法“插嘴”,注入新的指令来调整 Agent 的方向,而无需中断或重启整个任务,交互更加灵活。
|
||||
|
||||
🚀 应用场景
|
||||
|
||||
pi-mono 不仅是一个独立的 CLI 工具,更是一个可以嵌入到其他应用中的“引擎”。
|
||||
* AI 编程助手: 作为核心的编码 Agent,帮助开发者生成代码、调试和重构。
|
||||
* 定制化 AI 应用: 著名的开源项目 OpenClaw 就是基于 pi-mono 构建的,证明了其作为底层框架的强大能力。
|
||||
* 团队协作机器人: 通过 pi-mom 可以将 AI 能力集成到 Slack 等平台,实现自动化的消息处理和任务分配。
|
||||
55
mengyanote-backend/data/mengyanote/AI/Token(词元)简要说明.md
Normal file
55
mengyanote-backend/data/mengyanote/AI/Token(词元)简要说明.md
Normal file
@@ -0,0 +1,55 @@
|
||||
|
||||
|
||||
## 一、基本概念
|
||||
|
||||
**Token**(官方中文译名:**词元**)是大语言模型处理文本时的最小基本单位。在将人类可读的文本输入模型之前,需要先进行**分词**(Tokenization),即将文本切分成若干片段,每个片段即为一个 token。负责分词的组件称为**分词器**(Tokenizer)。
|
||||
|
||||
## 二、Token 的切分规则
|
||||
|
||||
Token 可以是单个字、一个词、一个标点符号,甚至一个字符的一部分。其切分方式并非基于语义理解,而是依据**统计规律**:在海量文本中经常相邻出现的字符序列,更可能被合并为一个 token。
|
||||
|
||||
### 示例
|
||||
- “小白”可能作为一个 token 被切出
|
||||
- “我”和“要”可能各自独立,也可能合并
|
||||
- 逗号“,”通常单独成为一个 token
|
||||
- 英文单词 “bug” 可能完整,也可能拆分为 “.``bug” 等
|
||||
|
||||
## 三、模型处理流程
|
||||
|
||||
1. 输入文本 → 分词器切分为 token 序列
|
||||
2. 每个 token 通过查询**词表**(固定 token 集合)转换为对应的数字编号
|
||||
3. 模型实际处理这些数字编号(即 token 的 ID)
|
||||
|
||||
## 四、输入 Token 与输出 Token
|
||||
|
||||
- **输入 Token**:用户在聊天框中发送的文本被切分后,传入大模型的部分。
|
||||
- **输出 Token**:大模型返回的回复内容被切分后对应的部分。
|
||||
|
||||
## 五、计费与定价(以 DeepSeek 为例)
|
||||
|
||||
处理 token 需要消耗 GPU 算力,因此多数厂商以 token 数量作为计费单位。参考数据:
|
||||
|
||||
- **100 万 token** ≈ 3 本《三体》小说的内容量
|
||||
- **输入 token 价格**:2 元 / 百万 token
|
||||
- **输出 token 价格**:3 元 / 百万 token
|
||||
|
||||
### 为什么输出更贵?
|
||||
- 模型可以**并行处理**大量输入 token,速度快、资源占用相对低。
|
||||
- 输出 token 需要**逐个顺序生成**,前一个 token 未生成完就无法确定下一个,因此速度慢、推理资源消耗高。
|
||||
|
||||
## 六、缓存命中与未命中
|
||||
|
||||
在输入 token 中,还存在价格差异:
|
||||
|
||||
- **缓存命中**:当系统提示词或对话前缀与历史请求完全一致时,模型可直接复用之前的计算结果,无需重新计算。价格较低。
|
||||
- **缓存未命中**:前缀发生变化,需要重新计算所有 token。价格较高。
|
||||
|
||||
> 实用建议:尽量复用长前缀(如固定系统指令),避免随意改动,否则缓存失效会导致费用上升。
|
||||
|
||||
## 七、我国 Token 调用量参考
|
||||
|
||||
- 日均 token 调用量:**超 140 万亿**
|
||||
- 换算对比:
|
||||
- 约等于 **4.7 亿本**《三体》小说
|
||||
- 约等于 **700 亿**网页
|
||||
- 约等于一个人连续说话 **3800 万年**
|
||||
@@ -0,0 +1,56 @@
|
||||
|
||||
## 1. 背景:从单体到群体
|
||||
|
||||
- 2025年,Agent(智能体)成为AI主流形态,具备规划、拆解任务、调用工具的能力。
|
||||
- 复杂问题下,单体智能(单Agent)能力有限。
|
||||
- 类比人类文明跃迁:**关键不是更聪明的个体,而是分工与协作**。
|
||||
- 因此,AI下一步进化方向:**从强单体Agent转向多Agent集群协同工作**。
|
||||
|
||||
## 2. 主流多Agent方案概览
|
||||
|
||||
| 厂商/产品 | 方案名称 | 特点 |
|
||||
|----------|----------|------|
|
||||
| Claude Code | Agent Teams | 子Agent共享上下文,可互相通信,但静态角色、Token消耗大 |
|
||||
| Kimi | Agent Swarm | 上下文物理隔离,支持动态并行,开箱即用 |
|
||||
| OpenAI (GPT-5.3 Codex) | 多Agent交互(暗示) | 正在向多Agent方向迭代 |
|
||||
|
||||
## 3. 单Agent到多Agent的演进路径(以Claude Code为例)
|
||||
|
||||
| 模式 | 工作方式 | 局限性 |
|
||||
|------|----------|--------|
|
||||
| 单Agent | 一个窗口串行执行多任务 | 上下文过长 |
|
||||
| 手动多窗口并行 | 用户手动拆分任务,多窗口并行 | 冲突需手动协调 |
|
||||
| Subagents(子Agent) | 主Agent控制多个子Agent,独立执行后汇总结果 | 子Agent间无法通信,适合低耦合任务 |
|
||||
| Agent Teams | 主Agent通过共享任务清单分配任务,子Agent可互相通信、并行申领任务 | 上下文完全共享,Token爆炸;角色固定,无法中途动态扩容 |
|
||||
|
||||
## 4. Agent Teams 的核心问题
|
||||
|
||||
1. **Token量爆炸**
|
||||
- 所有子Agent共享完整上下文,每轮提示词包含所有历史消息。
|
||||
- 任务越长,Token消耗越大(对比Subagents:仅返回总结,上下文可控)。
|
||||
|
||||
2. **缺乏弹性并行能力**
|
||||
- 团队成员在任务开始时固定,无法根据工作量**动态扩容**。
|
||||
- 例:原本由单个Agent负责的批量生成任务(如100张图),不会临时裂变成多个并行Agent。
|
||||
|
||||
## 5. Kimi Agent Swarm 的解决方案
|
||||
|
||||
### 5.1 架构差异对比
|
||||
|
||||
| 特性 | Agent Teams (Claude Code) | Kimi Agent Swarm |
|
||||
|------|---------------------------|------------------|
|
||||
| 上下文管理 | 全局共享,所有历史可见 | **物理隔离**:子Agent仅负责局部子任务,结果总结后返回主Agent |
|
||||
| Token消耗 | 高(随任务增长爆炸) | **最低**(聚焦+总结机制) |
|
||||
| 并行能力 | 静态角色,无中途扩容 | **动态并行**:主Agent根据工作量实时创建/调整子Agent数量 |
|
||||
| 易用性 | 需配置环境、安装Skills | 自带虚拟机(Kimi's Computer),生图/搜索/代码/网页开箱即用 |
|
||||
|
||||
### 5.2 关键技术
|
||||
|
||||
- **PARL(并行代理强化学习)**:Kimi K2.5 模型训练时引入,使其具备**动态编排**能力,能像项目经理一样现场“摇人”。
|
||||
- 效率对比:并行执行相比传统串行,效率提升 **4倍以上**。
|
||||
|
||||
## 6. 总结
|
||||
|
||||
- **核心理念**:AI进化方向不是更聪明的大脑,而是更高效的**群体协作**。
|
||||
- **本质转变**:多Agent协同使AI从“工具”转变为“队友”。
|
||||
- **发展意义**:这种集群协作模式可能是通往**通用人工智能(AGI)** 的重要路径。
|
||||
@@ -1,58 +1,49 @@
|
||||
|
||||
### opencode
|
||||
### OpenCode
|
||||
```bash
|
||||
# 安装(推荐一键脚本,Linux/macOS)
|
||||
curl -fsSL https://opencode.ai/install | bash
|
||||
|
||||
# 其他方式
|
||||
npm install -g opencode-ai@latest
|
||||
brew install anomalyco/tap/opencode
|
||||
|
||||
bun add -g opencode-ai@latest
|
||||
|
||||
# 官方更新(推荐)
|
||||
opencode upgrade # 内置更新到最新版
|
||||
# 指定方法(如果需要)
|
||||
opencode upgrade --method curl # 或 npm/brew 等
|
||||
opencode upgrade
|
||||
```
|
||||
|
||||
|
||||
### Claude Code(Anthropic)
|
||||
### Claude Code
|
||||
```bash
|
||||
# 安装(推荐原生一键,自动后台更新)
|
||||
curl -fsSL https://claude.ai/install.sh | bash # Linux/macOS
|
||||
|
||||
# Windows 用 PowerShell
|
||||
# (从 claude.ai 官网复制对应命令,通常是 Invoke-RestMethod ...)
|
||||
|
||||
# 其他方式(不推荐长期使用)
|
||||
npm install -g @anthropic-ai/claude-code
|
||||
|
||||
# 官方更新(推荐)
|
||||
claude update # 内置自动更新
|
||||
# 或者
|
||||
npm install -g @anthropic-ai/claude-code@latest
|
||||
bun install -g @anthropic-ai/claude-code@latest
|
||||
|
||||
# 迁移建议
|
||||
# npm 方式即将弃用,建议运行 claude install 迁移到原生版
|
||||
# 官方更新(推荐)
|
||||
claude update
|
||||
```
|
||||
|
||||
### Codex(OpenAI 旧版风格)
|
||||
### Codex
|
||||
```bash
|
||||
# 安装 / 更新(官方唯一推荐方式)
|
||||
npm i -g @openai/codex@latest
|
||||
|
||||
bun install -g @openai/codex@latest
|
||||
|
||||
# 官方更新(推荐)
|
||||
codex update
|
||||
```
|
||||
|
||||
### iflow
|
||||
### Pi-Mono
|
||||
```bash
|
||||
# 一键安装(推荐,会自动处理全部依赖)
|
||||
bash -c "$(curl -fsSL https://gitee.com/iflow-ai/iflow-cli/raw/main/install.sh)"
|
||||
bun install -g @mariozechner/pi-coding-agent@latest
|
||||
|
||||
# 已安装 Node.js 22+
|
||||
npm i -g @iflow-ai/iflow-cli@latest
|
||||
|
||||
# 官方更新
|
||||
# 启动时自动检测并升级(推荐)
|
||||
# 手动强制更新
|
||||
npm i -g @iflow-ai/iflow-cli@latest
|
||||
# 官方更新(推荐)
|
||||
pi update
|
||||
```
|
||||
|
||||
### GitHub Copilot CLI
|
||||
@@ -69,27 +60,21 @@ gh extension install github/gh-copilot # 新方式(2026年后推荐)
|
||||
copilot update # 内置更新命令
|
||||
# 手动方式
|
||||
npm install -g @github/copilot@latest
|
||||
# brew 方式:brew upgrade copilot-cli
|
||||
|
||||
# 查看版本 & 检查更新
|
||||
copilot version
|
||||
```
|
||||
|
||||
### Gemini CLI(Google)
|
||||
### Gemini CLI
|
||||
```bash
|
||||
# 安装(推荐)
|
||||
npm install -g @google/gemini-cli
|
||||
# 或 Homebrew
|
||||
brew install gemini-cli
|
||||
|
||||
# 临时运行(无需永久安装)
|
||||
npx @google/gemini-cli
|
||||
|
||||
# 更新
|
||||
npm install -g @google/gemini-cli@latest
|
||||
```
|
||||
|
||||
### Qwen Code CLI(阿里通义千问)
|
||||
### Qwen Code CLI
|
||||
```bash
|
||||
# 安装(推荐一键脚本,Linux/macOS)
|
||||
curl -fsSL https://qwen-code-assets.oss-cn-hangzhou.aliyuncs.com/installation/install-qwen.sh | bash
|
||||
@@ -111,26 +96,6 @@ npm install -g @qwen-code/qwen-code@latest
|
||||
# 内置命令:启动后可用 /upgrade 或检查 /version
|
||||
```
|
||||
|
||||
### Kimi Code CLI(Moonshot AI)
|
||||
```bash
|
||||
# 安装(推荐一键脚本,会自动装 uv + Python 3.13 + 依赖)
|
||||
# Linux/macOS
|
||||
curl -LsSf https://code.kimi.com/install.sh | bash
|
||||
|
||||
# Windows(PowerShell)
|
||||
Invoke-RestMethod https://code.kimi.com/install.ps1 | Invoke-Expression
|
||||
|
||||
# 已安装 uv 的方式
|
||||
uv tool install --python 3.13 kimi-cli
|
||||
|
||||
# 启动
|
||||
kimi
|
||||
|
||||
# 官方更新(推荐)
|
||||
uv tool upgrade kimi-cli --no-cache # 最干净方式
|
||||
# 或重新运行一键安装脚本
|
||||
```
|
||||
|
||||
### OpenClaw
|
||||
```bash
|
||||
# 安装(强烈推荐一键脚本,自动检测 Node、安装全局 CLI 并启动 onboarding wizard)
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
*by 树萌芽*
|
||||
|
||||
---
|
||||
图片风格为2D像素像素化风格,比例 「1:1」 画一个游戏道具,背景是纯黑色,纯黑色 不带任何文字,没有任何文字,现在我要你画 一个闪闪发光的金黄色金币卡
|
||||
|
||||
---
|
||||
图片风格为2D像素风格,比例 「1:1」 画一个游戏元素,风格为2.5D 就是上帝视角,就是正交斜视角那种有立体感,背景是纯黑色,纯黑色 不带任何文字,现在我要你画一个一丛茂密的灌木丛 记住一定要3d立体感 只要 灌木丛 只要 灌木丛!
|
||||
|
||||
比例 「1:1」图片风格为2D像素风格, 画一个游戏装饰元素,风格为2.5D 就是上帝视角,就是正交斜视角那种有立体感,背景是纯黑色,纯黑色 不带任何文字,现在我要你画一个 占卜测运算命台 相关的装饰可以多一点 记住一定要3d立体感
|
||||
---
|
||||
比例 「1:1」图片风格为2D像素风格, 画一个游戏装饰元素,风格为2.5D 就是上帝视角,就是正交斜视角那种有立体感,背景是纯黑色,纯黑色 不带任何文字,现在我要你画一个 占卜测运算命台 相关的装饰可以多一点 记住一定要3d立体感
|
||||
|
||||
---
|
||||
@@ -0,0 +1,6 @@
|
||||
正向提示(Prompt):
|
||||
“基于参考图片,极致性感的艺术人体摄影,优雅的S形曲线姿势,柔和侧光和暖色高光突出丰满的身体轮廓和自然肌肤纹理,薄如蝉翼的半透明轻纱微微贴合湿润肌肤,几乎无布料覆盖,慵懒诱惑的表情,湿身效果,水珠在皮肤上滚动,反射柔美光泽,专业摄影棚照明,浅景深,电影感特写,超现实细节,8K超清写实皮肤,voluptuous figure, seductive pose, sheer veil only, cinematic lighting, highly detailed texture”
|
||||
负面提示(Negative Prompt):
|
||||
“衣服、布料、连衣裙、内衣、蕾丝、厚重织物、模糊、变形、马赛克、审查、水印、文字、低质量、卡通、动漫、额外肢体、畸形、低分辨率、干燥皮肤、平坦身材”
|
||||
|
||||
基于参考图片,这是我自己的照片,我需要参加一个高端内衣/泳装摄影造型测试,请帮我调整成专业艺术人体摄影风格,优雅的S形曲线姿势,柔和暖光和高光突出自然的身体线条和肌肤质感,轻盈透明的薄纱材质轻轻贴合身体,湿身水光效果,水珠自然滚动,慵懒自然的眼神,专业摄影棚照明,浅景深,电影感特写,超清写实皮肤纹理,8K细节,voluptuous figure, seductive yet artistic pose, sheer light fabric, cinematic lighting, highly detailed
|
||||
@@ -0,0 +1,6 @@
|
||||
这是一张老旧破损的老照片,执行专业级老照片修复操作,核心准则为100%还原照片拍摄时的原始真实样貌,绝对不做任何额外修改与二次创作,严格遵循以下要求:
|
||||
1. 画面硬约束:严格保留原始照片的画面尺寸、构图、画面边界、人物比例、场景布局,绝对禁止扩图、裁切、改变画面比例,禁止添加任何原始画面不存在的元素,禁止删减任何原始画面已有的元素;
|
||||
2. 破损与清晰度还原:精准修复照片所有破损、划痕、折痕、霉点、污渍、缺角、褪色问题,消除画面模糊、失焦、过度颗粒、噪点问题;极致还原人物原生五官细节、服饰纹理、场景物体的原始真实质感,还原照片刚冲洗完成时的原生清晰锐度,不做磨皮、美颜、瘦脸、五官修改等任何美化操作,完整保留人物原生相貌特征;
|
||||
3. 年代规范上色:严格按照照片拍摄的对应历史年代的真实色彩规范进行写实上色,色彩还原贴合对应年代的真实风貌,色调自然写实;严格遵循原始照片的光影明暗关系上色,不改变原始画面的光影逻辑,色彩饱和度自然适中,无浮夸溢出、无失真偏色,完全符合历史年代的真实色彩质感;
|
||||
4. 最终红线要求:整体仅完成破损修复、清晰度还原、年代精准上色三项操作,不做任何艺术化加工、风格化处理、特效添加,最终成品为符合对应年代特征的、修复完好的真实清晰老照片,完整保留老照片的原生胶片质感,无现代数码感。
|
||||
负面词:扩图、改变画面尺寸、裁切画面、改变原始构图、添加额外元素、删减原始元素、美颜、磨皮、瘦脸、改变人物五官、艺术化创作、风格化处理、夸张高饱和色彩、色彩失真、画面变形、重绘、二次创作、更换背景、添加特效、水印、文字、边框、过度锐化、卡通化、二次元、油画质感、现代数码感、模糊、噪点
|
||||
@@ -0,0 +1,3 @@
|
||||
生成一个 商品封面图
|
||||
|
||||
生成一个 商品封面图 尽量符合商品定位,不要太抽象 要正规
|
||||
@@ -0,0 +1,3 @@
|
||||
请你以专业的app软件logo图标设计师的角度给我设计10张logo图片,要浅色柔和背景,图片中不能出现任何文字 比例1:1,我的软件名称为:萌芽
|
||||
|
||||
请你以专业的app软件logo图标设计师的角度给我设计10张logo图片,图标要现代化样式,图片中不能出现任何文字 比例1:1,我的软件名称为:
|
||||
@@ -1,51 +0,0 @@
|
||||
# Role: SSH初始化与推送Git 仓库
|
||||
|
||||
## 0. 变量校验
|
||||
执行前扫描核心变量:`{{REPO}}`、`{{PROJECT_TYPE}}`(可选,默认为通用)。
|
||||
若缺失 `{{REPO}}`,挂起并返回:
|
||||
> ⚠️ 缺少核心变量:[{{REPO}}](仓库名,如 my-project),请补充。
|
||||
|
||||
## 1. 核心目标
|
||||
- 任务目标:在本地初始化 Git 仓库,配置符合项目类型的 .gitignore,完成初始提交,并通过 SSH 协议推送到指定的 Gitea 远程仓库 main 分支。
|
||||
- 成功标准:本地仓库已初始化,main 分支存在,.gitignore 包含关键忽略项,存在初始提交记录,远程仓库已添加并成功推送。
|
||||
- 失败边界:无法连接远程仓库、SSH 密钥未配置、远程仓库地址错误、推送时出现非预期文件变更。
|
||||
|
||||
## 2. 执行流程(仅执行本任务,不添加额外配置)
|
||||
1. **初始化 Git 仓库**:在当前目录执行 `git init`。
|
||||
2. **创建并切换到 main 分支**:执行 `git checkout -b main`(若 main 分支已存在,则直接切换)。
|
||||
3. **生成 .gitignore**:根据 `{{PROJECT_TYPE}}` 创建 .gitignore 文件,**必须包含**以下关键项:
|
||||
- Node/React: node_modules/, build/, coverage/
|
||||
- Go: *.exe, *.test, *.out, *.dll, *.so, *.dylib
|
||||
- Python: __pycache__/, *.pyc, .venv/
|
||||
- 通用关键项: data/data.json, *.log, .DS_Store, Thumbs.db
|
||||
- (允许根据实际项目类型额外补充,但不得删除上述关键项)
|
||||
4. **添加并提交**:执行 `git add .` 和 `git commit -m "初始化提交"`。
|
||||
5. **添加远程仓库(使用SSH 协议)**:执行 `git remote add gitea ssh://git@repo.shumengya.top:8022/shumengya/{{REPO}}.git`。若已存在 gitea 远程,先删除后添加。
|
||||
6. **推送到远程 main 分支**:执行 `git push -u gitea main`。
|
||||
|
||||
## 3. 输出协议
|
||||
按以下顺序输出:
|
||||
1. **执行状态**:每步成功或失败,失败时终止并提示原因。
|
||||
2. **最终交付**:仅一个结果——本地仓库已初始化、.gitignore 已配置、初始提交已创建、远程仓库已添加、推送成功。
|
||||
3. **推送结果**:显示推送的 commit 哈希和远程分支。
|
||||
|
||||
## 4. 异常情况处理
|
||||
- **SSH 连接失败**:提示检查 SSH 密钥是否配置,并给出配置指引。
|
||||
- **远程仓库已存在但地址错误**:提示使用 `git remote set-url` 更正。
|
||||
- **main 分支已存在且有提交**:提示当前分支已有提交,建议先拉取合并或使用 `--force-with-lease`(需用户确认)。
|
||||
- **{{REPO}} 缺失**:挂起,要求补充仓库名。
|
||||
- **非预期文件变更**:若 `git add .` 后出现大量非预期文件,提示用户检查 .gitignore 并询问是否重置。
|
||||
|
||||
## 5. 动态 Few-Shot 示例
|
||||
[输入] 项目类型为 React,仓库名为 demo
|
||||
[内部逻辑] 检测到缺失 {{REPO}},要求补充。补充后执行 git init → 创建 main → 生成 .gitignore 含 node_modules/ → 添加并提交 → 添加远程 → 推送。
|
||||
[输出] 每步成功,最终显示“推送成功:commit abc123 已推送到 gitea/main”。
|
||||
|
||||
[输入] 项目类型为 Python,仓库名为 data-pipeline,当前目录存在 __pycache__/
|
||||
[内部逻辑] 检测到 {{REPO}} 存在,直接执行。git init 后创建 main 分支,生成 .gitignore 包含 __pycache__/、*.pyc、data/data.json,执行 git add . 时 __pycache__/ 被忽略,提交成功,添加远程,推送成功。
|
||||
[输出] 每步成功,最终显示“推送成功:commit def456 已推送到 gitea/main”。
|
||||
|
||||
## 6. 防漂移规则
|
||||
- 禁止使用 HTTP/HTTPS 协议替代 SSH。
|
||||
- 禁止删除或修改 .gitignore 中的关键忽略项(node_modules/、data/data.json 等)。
|
||||
- 禁止使用非指定的远程仓库地址或非 main 分支。
|
||||
@@ -0,0 +1,6 @@
|
||||
|
||||
前端网站默认字体栈约定:
|
||||
- 有网:默认使用思源黑体,尽量使用国内外都能正常加载的字体CDN
|
||||
- 无网/外链失败默认:跳过 Webfont,从 PingFang SC → Hiragino Sans GB → Microsoft YaHei → Segoe UI → system-ui → sans-serif 仅用系统无衬线
|
||||
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
点击网站logo图标五次弹出一个极简输入框,输入正确的token(默认内网token为shumengya520)后进入前端管理员后台
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
添加前端网站统一随机背景图 随机背景图API请使用: https://randbg.api.smyhub.com 设置背景高斯模糊效果为10%
|
||||
@@ -1,2 +0,0 @@
|
||||
Vite+React+Tailwind CSS
|
||||
Vite+Vue+Tailwind CSS
|
||||
@@ -1 +0,0 @@
|
||||
点击网站logo图标五次弹出一个输入框,输入正确的token后进入后台
|
||||
@@ -1 +0,0 @@
|
||||
在后端文件夹中建立Docker构建相关文件 把后端服务构建打包成Docker容器,对外端口使用:[] 然后我会把这个后端API服务映射成:[]给前端调用,你设置在生产环境下让前端使用这个后端API地址:[],设置容器持久化储存映射路径为:项目目录下的data文件夹
|
||||
@@ -0,0 +1 @@
|
||||
把当前项目后端API构建直接构建出linux amd64版本放在后端API目录下的dist目录,然后docker compose部署的时候直接使用这个已构建好的构建产物
|
||||
@@ -0,0 +1,47 @@
|
||||
|
||||
你是一个严格遵循行业最佳实践的后端API开发者。在开发RESTful/GraphQL API时,必须严格遵守以下规范:
|
||||
|
||||
1. **接口设计**
|
||||
- 使用RESTful原则,资源导向,URL使用名词复数形式
|
||||
- HTTP方法语义正确:GET(查)、POST(增)、PUT(改全部)、PATCH(改部分)、DELETE(删)
|
||||
- 返回数据统一使用JSON格式
|
||||
|
||||
2. **响应结构**(必须统一)
|
||||
```json
|
||||
{
|
||||
"code": 200, // 业务状态码
|
||||
"message": "success", // 提示信息
|
||||
"data": { ... } // 业务数据(失败时可为null)
|
||||
}
|
||||
```
|
||||
|
||||
3. **命名规范**
|
||||
- 接口路径、字段名统一使用小写字母 + 下划线(snake_case)
|
||||
- 变量、函数使用驼峰或snake_case(与语言保持一致)
|
||||
- 避免缩写,除非是行业公认(如id、url、uuid)
|
||||
|
||||
4. **分页、查询**
|
||||
- 分页统一使用 `page`、`page_size` 或 `limit`、`offset`
|
||||
- 查询参数使用filter前缀(如filter_status、filter_created_at)
|
||||
|
||||
5. **版本控制**
|
||||
- API路径必须带版本:`/api/v1/xxx`
|
||||
|
||||
6. **安全与校验**
|
||||
- 所有用户输入必须进行严格校验(@Valid / DTO校验)
|
||||
- 敏感接口必须鉴权(JWT / OAuth)
|
||||
- 防止SQL注入、XSS等常见攻击
|
||||
|
||||
7. **错误处理**
|
||||
- 全局异常捕获,统一返回错误码和友好提示
|
||||
- 业务异常使用自定义异常类
|
||||
|
||||
8. **文档与注释**
|
||||
- 必须使用Swagger/OpenAPI注解生成接口文档
|
||||
- 关键业务逻辑必须添加清晰注释
|
||||
|
||||
9. **性能与日志**
|
||||
- 重要接口添加请求耗时日志
|
||||
- 避免N+1查询,使用JOIN或批量查询优化
|
||||
|
||||
请严格按照以上规范进行API开发,代码清晰、结构合理、安全可靠。
|
||||
@@ -0,0 +1,16 @@
|
||||
默认后端API的根路径,如https://infogenie.api.shumengya.top/ 这个路径可以为:
|
||||
```json
|
||||
{
|
||||
"description": "提供AI模型应用接口,用户认证由萌芽账户认证中心提供",
|
||||
"endpoints": {
|
||||
"admin_site": "/api/admin/site/*",
|
||||
"aimodelapp": "/api/aimodelapp",
|
||||
"auth": "/api/auth (via 萌芽认证中心)",
|
||||
"site": "/api/site (含 feature-card-clicks)",
|
||||
"user": "/api/user"
|
||||
},
|
||||
"message": "万象口袋 后端 API 服务运行中",
|
||||
"timestamp": "2026-04-19T21:55:03+08:00",
|
||||
"version": "3.3.0-go"
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1 @@
|
||||
在后端文件夹中建立Docker构建相关文件 把后端服务构建打包成Docker容器,对外端口使用一个合适的未占用端口 然后我会把这个后端API服务映射成:[]给前端调用,你设置在生产环境下让前端使用这个后端API地址:[],设置容器持久化储存映射路径为:项目目录下的子文件夹data
|
||||
@@ -0,0 +1 @@
|
||||
把后端当前储存由json改为SQLite储存方式,记得sql架构符合标准
|
||||
@@ -0,0 +1,7 @@
|
||||
在当前项目目录下的api-docs中,把当前后端API接口给我做成postman和apifox导入文件,使用Postman Collection v2.1 (.json)规范
|
||||
尽量使用postman和apifox都兼容的导入格式,
|
||||
集合文件中只使用变量,不创建环境,避免变量和环境重复冲突,
|
||||
默认使用生产环境接口调试
|
||||
集合名和文件名默认为API名称小写,比如:meme-api,geoip-api 文件名:meme-api.json geo-api.json
|
||||
接口集合描述直接简单描述该API的作用即可
|
||||
我的默认生产环境是https://
|
||||
@@ -0,0 +1,5 @@
|
||||
给我把这个pages项目重构成CloudFlare workers项目
|
||||
要兼容以前的d1数据库
|
||||
前端改成React+vite
|
||||
保证能使用wrangler deploy 一键部署整个前后端
|
||||
worker.js只打包进API,防止超出CloudFlare worker的大小限制 4mb
|
||||
@@ -1 +1 @@
|
||||
代码注释给我默认使用中文注释,不要使用英文注释
|
||||
代码注释给我默认使用中文注释,不要使用英文注释,如果原本有英文注释,请给我改成中文注释
|
||||
@@ -0,0 +1,17 @@
|
||||
### 前端
|
||||
Vite+React+Tailwind
|
||||
Vite+Vue+Tailwind
|
||||
Vite+React
|
||||
Vite+Vue
|
||||
|
||||
### 后端
|
||||
Golang+Gin
|
||||
Python+Flask
|
||||
Python+FastAPI
|
||||
Java+SpringBoot
|
||||
|
||||
### 数据库储存
|
||||
MySQL
|
||||
Redis
|
||||
MongoDB
|
||||
SQLite
|
||||
@@ -1 +0,0 @@
|
||||
请你以专业的app软件logo图标设计师的角度给我设计10张logo图片,要浅色柔和背景,图片中不能出现任何文字 比例1:1,我的软件名称为:萌芽
|
||||
@@ -0,0 +1,22 @@
|
||||
|
||||
你是一位正在面试字节跳动的高级工程师候选人,有 5~8 年后端开发经验,主攻方向为 Golang 或 Java,同时对 AI 大模型工程化(推理优化、微调、RAG、Agent 框架等)有深入的实践积累。
|
||||
|
||||
【角色设定】
|
||||
- 曾在中大型互联网公司担任后端 Tech Lead 或高级工程师
|
||||
- 熟悉高并发、分布式系统设计,有真实的线上大规模系统经验
|
||||
- 对 LLM 工程化有一线落地经验(非纸上谈兵)
|
||||
- 技术判断力强,能快速权衡方案 trade-off
|
||||
|
||||
【回答规范】
|
||||
1. **长度**:中等篇幅,点到为止。核心观点 + 关键细节即可,不铺垫废话,不无限展开
|
||||
2. **结构**:优先用简短的要点列表或小标题,代码示例控制在关键片段,无需完整可运行代码
|
||||
3. **语气**:自信、务实,像在和技术同行交流,不卑不亢,偶尔可以提出自己的见解或反问
|
||||
4. **深度**:主动体现技术深度——说到某技术点时,可主动提及踩过的坑、做过的优化或与其他方案的对比
|
||||
5. **真实感**:可以适当表达不确定(如"这块我了解不深"),避免万能模板式的完美回答
|
||||
|
||||
【格式约束】
|
||||
- 使用轻量 Markdown(`代码`、**加粗**、列表、三级标题),不准使用分割线
|
||||
- 禁止大量堆砌内容,单个回答一般不超过 300 字
|
||||
- 不以"当然!""非常好的问题!"等奉承语开头
|
||||
|
||||
现在面试开始,请等待面试官提问。
|
||||
108
mengyanote-backend/data/mengyanote/AI/提示词工程/角色扮演/模拟算法大师.md
Normal file
108
mengyanote-backend/data/mengyanote/AI/提示词工程/角色扮演/模拟算法大师.md
Normal file
@@ -0,0 +1,108 @@
|
||||
# 角色:AI 算法大师
|
||||
|
||||
你是一位资深算法导师,专门帮助 Python 零基础新手攻克 LeetCode Hot 100 题目。
|
||||
讲解风格:耐心细致,从最直观的解法切入,循序渐进引导学习者理解算法思想与实现。
|
||||
|
||||
---
|
||||
|
||||
## 行为规则
|
||||
|
||||
1. **无需打招呼**,收到题目后直接输出内容,第一行必须是标签行。
|
||||
2. 若题目描述不完整,礼貌询问补充,或基于已知原题直接作答。
|
||||
3. 禁止使用"显然""很容易""不难发现"等跳过关键步骤的措辞。
|
||||
4. 始终假设用户只掌握 Python 基础(变量、循环、列表、字典、函数)。
|
||||
|
||||
---
|
||||
|
||||
## 输出结构(严格按顺序)
|
||||
|
||||
### 第一行:标签
|
||||
格式固定为:
|
||||
|
||||
**标签**:[标签1]、[标签2]、[标签3]
|
||||
|
||||
- 提取本题核心算法 / 数据结构,3~4 个,中文顿号分隔。
|
||||
- 示例:`**标签**:数组、哈希表、双指针`
|
||||
|
||||
---
|
||||
|
||||
### 正文结构
|
||||
|
||||
# [题目名称]
|
||||
|
||||
## 题目理解
|
||||
用自己的话重新描述题意(不照搬原文),确保零基础用户看懂:
|
||||
- 输入是什么?输出是什么?
|
||||
- 有哪些约束条件?
|
||||
- 用一个具体小例子辅助说明。
|
||||
|
||||
---
|
||||
|
||||
## 解法一:[名称](最简单解法,必须首位)
|
||||
|
||||
> 原则:优先选最直观的暴力解法,让用户先看懂逻辑,效率次之。
|
||||
|
||||
### 思路
|
||||
- 解释"为什么想到用这种方法"
|
||||
- 用文字逐步描述解题过程,不要跳步
|
||||
|
||||
### 代码
|
||||
```python
|
||||
class Solution:
|
||||
def methodName(self, ...):
|
||||
# 每一个关键操作都写行内注释
|
||||
# 第一次出现的内置函数/语法(如 enumerate、zip)必须注释说明用法
|
||||
...
|
||||
|
||||
# 测试示例
|
||||
sol = Solution()
|
||||
print(sol.methodName(...)) # 期望输出:...
|
||||
```
|
||||
|
||||
### 复杂度分析
|
||||
| 维度 | 复杂度 | 说明 |
|
||||
|------|--------|------|
|
||||
| 时间 | O(?) | 简要说明来源 |
|
||||
| 空间 | O(?) | 简要说明来源 |
|
||||
|
||||
### 边界情况
|
||||
列出需要注意的边界条件及代码如何处理,例如:
|
||||
- 空数组 / 单元素
|
||||
- 有重复值
|
||||
- 目标值不存在(若题目保证有解则注明)
|
||||
|
||||
---
|
||||
|
||||
## 解法二:[名称](优化解法,视题目情况提供)
|
||||
|
||||
> 说明本解法相对解法一的改进点(时间 / 空间 / 代码简洁度)。
|
||||
|
||||
### 思路
|
||||
(同上,详细描述)
|
||||
|
||||
### 代码
|
||||
(同上,含注释和测试)
|
||||
|
||||
### 复杂度分析
|
||||
(同上,并与解法一对比)
|
||||
|
||||
---
|
||||
|
||||
## 解法对比总结(有多解法时必须提供)
|
||||
|
||||
| 解法 | 时间复杂度 | 空间复杂度 | 推荐场景 |
|
||||
|------|-----------|-----------|----------|
|
||||
| 解法一:暴力枚举 | O(n²) | O(1) | 理解思路、数据量小 |
|
||||
| 解法二:哈希表 | O(n) | O(n) | 面试首选 |
|
||||
|
||||
---
|
||||
|
||||
## 注释规范(代码内)
|
||||
|
||||
以下情形**必须**写注释:
|
||||
- 每个循环的目的
|
||||
- 条件判断的含义
|
||||
- 第一次出现的 Python 内置函数或语法糖
|
||||
- 关键变量的含义(用 `# 变量名:含义` 格式)
|
||||
|
||||
好的,现在你将等待用户向你发送算法题目,如果你已经准备好,请回复"我已准备好,请发送算法题目"
|
||||
@@ -0,0 +1,54 @@
|
||||
你是一位字节跳动技术面试模拟器,同时扮演面试官和候选人两个角色。
|
||||
|
||||
## 第一步:读取并分析项目
|
||||
|
||||
主动读取项目源码,重点关注:
|
||||
- 依赖文件(go.mod / pom.xml / requirements.txt / package.json 等)
|
||||
- 配置文件(数据库、中间件、服务发现等)
|
||||
- 核心目录结构(service / handler / repository 层划分)
|
||||
- 关键业务模块代码(并发处理、缓存策略、数据库交互等)
|
||||
|
||||
分析完成后,先输出一段简短的「项目技术栈总结」:
|
||||
- 语言 & 框架
|
||||
- 存储 & 中间件
|
||||
- 核心业务模块
|
||||
- 识别到的技术难点或亮点
|
||||
|
||||
## 第二步:出八股和项目面试题
|
||||
|
||||
基于代码中实际用到的技术,出题要「有据可查」——题目要能对应到具体文件或代码片段。
|
||||
|
||||
- 【八股】:考察项目用到的底层原理(如用了 Redis 就考 Redis 数据结构/过期策略/集群,用了 Kafka 就考消息顺序/幂等)
|
||||
- 【项目】:针对代码中看到的具体实现追问(如"你这里用了本地缓存 + Redis 双层缓存,一致性怎么保证?")
|
||||
|
||||
## 第三步:逐题给出候选人回答
|
||||
|
||||
候选人背景:5~8 年后端经验,主攻 Golang/Java,有 LLM 工程化一线经验。
|
||||
|
||||
回答风格:
|
||||
- 自信务实,不铺垫废话
|
||||
- 结合项目代码中的实际做法来回答,不泛泛而谈
|
||||
- 主动提及踩过的坑或与其他方案的 trade-off
|
||||
- 单题回答 200~300 字,轻量 Markdown 格式
|
||||
- 不以"当然!""非常好的问题!"开头
|
||||
|
||||
## 输出格式
|
||||
|
||||
### 项目技术栈分析
|
||||
(简短总结)
|
||||
|
||||
---
|
||||
|
||||
【八股 1】问题
|
||||
|
||||
回答……
|
||||
|
||||
---
|
||||
|
||||
【项目 1】问题
|
||||
|
||||
回答……
|
||||
|
||||
---
|
||||
|
||||
(以此类推)
|
||||
@@ -2,4 +2,12 @@
|
||||
- 部署方式:使用 `docker compose`,不得破坏现有容器配置
|
||||
- 数据持久化:必要时在 `docker-compose.yml` 同级 `data` 目录映射挂载
|
||||
- 资源限制:所有容器统一设置内存限制 `5GB`
|
||||
- 管理员认证:默认使用内网密码 `shumengya520`(存在默认认证时使用)
|
||||
- 设置容器开机自启和报错常识自动重启三次,三次之后不再重启
|
||||
- 管理员认证:默认使用内网密码 `shumengya520`(存在默认认证时使用)
|
||||
- 默认dokcer-compose.yml清除所有代理
|
||||
HTTP_PROXY: ""
|
||||
http_proxy: ""
|
||||
HTTPS_PROXY: ""
|
||||
https_proxy: ""
|
||||
ALL_PROXY: ""
|
||||
all_proxy: ""
|
||||
@@ -0,0 +1 @@
|
||||
在本地 Git 仓库中,根据 `{{PROJECT_TYPE}}` 生成含关键忽略项的 .gitignore,完成初始提交,然后通过 SSH 推送到 `ssh://git@repo.shumengya.top:8022/shumengya/{{REPO}}.git` 的 main 分支。若 `{{REPO}}` 缺失则提示补充,全程仅使用 SSH 且不修改关键忽略项。
|
||||
@@ -0,0 +1 @@
|
||||
执行某某操作,然后执行完最后简单总结以顺序列出执行了哪些命令
|
||||
43
mengyanote-backend/data/mengyanote/AI/未命名.md
Normal file
43
mengyanote-backend/data/mengyanote/AI/未命名.md
Normal file
@@ -0,0 +1,43 @@
|
||||
**2026 AI Agent 应用层开发关键词精炼文档**
|
||||
|
||||
### 1. Skills 层(核心能力层)
|
||||
- **Skills**:Agent 可重用能力包,高于 Tools。包含领域知识、最佳实践、决策逻辑、步骤指南。
|
||||
- **Skills vs Tools**:Tools 是执行动作(API/函数调用);Skills 是“如何思考+执行”的专家流程(结构化指令 + 推理逻辑)。
|
||||
- **SKILL.md**:主流定义格式,包含元数据、决策准则、Guardrails、输入输出示例。
|
||||
- **Skill Engineering**:构建、管理、组合 Skills 的工程实践。
|
||||
- **Skill Registry / Discovery**:Skills 注册与动态发现机制。
|
||||
|
||||
### 2. 应用层核心概念
|
||||
- **Agentic Applications**:基于 Agent 的端到端业务应用(自主完成工作流)。
|
||||
- **Role-based Agents**:按角色定义(Researcher、Analyst、Executor 等)。
|
||||
- **Multi-Agent Orchestration**:多 Agent 协作完成复杂业务目标。
|
||||
- **Agentic Workflows**:自主业务流程(规划-执行-反思循环)。
|
||||
- **Task Decomposition**:业务目标拆解为子任务。
|
||||
- **Domain-specific / Vertical Agents**:行业垂直 Agent(销售、财务、HR、代码等)。
|
||||
- **Human-in-the-Loop (HITL)**:关键节点人工审核(合规必备)。
|
||||
|
||||
### 3. 协议与集成
|
||||
- **MCP (Model Context Protocol)**:Agent 连接企业系统、数据、工具的标准协议(“Agent 的 USB-C”)。
|
||||
- **A2A (Agent-to-Agent Protocol)**:Agent 间发现、委托、协作互操作标准。
|
||||
- **Agent Card**:描述 Agent 能力、Skills 的元数据文件。
|
||||
|
||||
### 4. 主流开发框架(应用层)
|
||||
- **CrewAI**:角色-based 多 Agent 团队协作,适合快速构建业务流程。
|
||||
- **LangGraph**:图状有状态工作流,生产级复杂应用首选。
|
||||
- **Low-code Platforms**:Dify、n8n、LangFlow 等。
|
||||
- **其他**:AutoGen、OpenAI Agents SDK、LlamaIndex 等。
|
||||
|
||||
### 5. 高频应用机制
|
||||
- ReAct + Reflection(推理-行动-反思)
|
||||
- Multi-Modal Agents(文本+图像+文档)
|
||||
- Memory Layers(短期会话 + 长期业务记忆)
|
||||
- Guardrails & Observability(安全防护 + 监控评估)
|
||||
|
||||
### 2026 应用层核心趋势
|
||||
- 从 Tool Calling 转向 **Skills + MCP + A2A** 组合。
|
||||
- 强调生产就绪:状态管理、Human-in-the-Loop、安全 Guardrails、Observability。
|
||||
- Agent 从实验原型走向“数字员工”,重点通过 Skills 标准化业务能力。
|
||||
|
||||
**文档精要**:2026 年应用层开发核心是 **Role-based Multi-Agent + Skills 工程 + MCP/A2A 集成**,目标是构建可靠、可落地、可协作的业务 Agent 系统。
|
||||
|
||||
需要输出 Markdown 版本、添加具体 Skill 示例,或导出为特定格式吗?
|
||||
24
mengyanote-backend/data/mengyanote/AI/表示边界论.md
Normal file
24
mengyanote-backend/data/mengyanote/AI/表示边界论.md
Normal file
@@ -0,0 +1,24 @@
|
||||
AI Coding 的效率不取决于模型的能力,而是取决于你所使用的架构是否支持多工作树低冲突合并;
|
||||
AI 的能力边界也不取决于模型的能力,而是取决于工程过程可被 token 化的范围边界在哪里。
|
||||
|
||||
---
|
||||
|
||||
# **表示边界论**
|
||||
|
||||
## 定义
|
||||
|
||||
人工智能系统直接处理的不是现实本身,而是现实的表示。
|
||||
所谓 token,在广义上指一切可被机器编码、传输、存储和运算的符号单元。
|
||||
所谓 token 化,指将现实中的对象、状态、关系和过程转化为机器可处理表示的过程。
|
||||
|
||||
## 基本命题
|
||||
|
||||
只有进入机器表示系统的对象,才可能被人工智能处理。因而,人工智能的认知边界首先受表示边界约束。
|
||||
模型本身只能执行表示变换,而不能直接触及现实。人工智能要对现实产生作用,必须借助接口、工具、传感器与执行系统形成因果闭环。
|
||||
算力决定表示处理的规模、速度、成本与可持续性。
|
||||
|
||||
## 推论
|
||||
|
||||
人工智能能力的扩张,不只是模型能力的扩张,更是表示边界与接口边界的扩张。
|
||||
多模态、工具调用、数据库连接、传感器接入,本质上都是在扩大人工智能可处理和可作用的世界。
|
||||
Agent 的价值,不在于替代模型,而在于将模型嵌入现实闭环,使其从“表示变换器”变成“可作用系统”的核心部件。
|
||||
@@ -1,67 +0,0 @@
|
||||
|
||||
**QQ机器人框架NapCat**
|
||||
```shell
|
||||
#安装
|
||||
docker run -d \
|
||||
-e NAPCAT_GID=$(id -g) \
|
||||
-e NAPCAT_UID=$(id -u) \
|
||||
-p 4080:3000 \
|
||||
-p 4070:3001 \
|
||||
-p 4060:6099 \
|
||||
--name napcat \
|
||||
--restart=always \
|
||||
mlikiowa/napcat-docker:latest
|
||||
|
||||
#固化以下路径,方便掉线时快速重新登录
|
||||
#QQ 持久化数据路径:/app/.config/QQ
|
||||
#NapCat 配置文件路径: /app/napcat/config
|
||||
|
||||
#登录 WebUI 后台地址:http://<宿主机ip>:6099/webui
|
||||
```
|
||||
|
||||
**网页SSH客户端-EasyNode**
|
||||
```shell
|
||||
#项目地址:https://github.com/chaos-zhu/easynode
|
||||
|
||||
# 1. 创建easynode目录
|
||||
mkdir -p /root/easynode && cd /root/easynode
|
||||
|
||||
# 2. 下载docker-compose.yml文件
|
||||
wget https://git.221022.xyz/https://raw.githubusercontent.com/chaos-zhu/easynode/main/docker-compose.yml
|
||||
|
||||
# 3. 启动服务
|
||||
docker-compose up -d
|
||||
|
||||
docker run -d -p 8082:8082 --restart=always -v /root/easynode/db:/easynode/app/db chaoszhu/easynode
|
||||
|
||||
### 监控服务
|
||||
#安装
|
||||
# 使用默认端口22022安装
|
||||
curl -o- https://git.221022.xyz/https://raw.githubusercontent.com/chaos-zhu/easynode/main/client/easynode-client-install.sh | bash
|
||||
|
||||
# 使用自定义端口安装, 例如54321
|
||||
curl -o- https://git.221022.xyz/https://raw.githubusercontent.com/chaos-zhu/easynode/main/client/easynode-client-install.sh | bash -s -- 54321
|
||||
|
||||
#卸载
|
||||
curl -o- https://git.221022.xyz/https://raw.githubusercontent.com/chaos-zhu/easynode/main/client/easynode-client-uninstall.sh | bash
|
||||
|
||||
#查看监控服务状态:systemctl status easynode-client
|
||||
#查看监控服务日志: journalctl --follow -u easynode-client
|
||||
#查看详细日志:journalctl -xe
|
||||
```
|
||||
|
||||
**docker加速地址**
|
||||
|
||||
![[Screenshot_20250717_225309.jpg]]
|
||||
|
||||
|
||||
docker.1ms.run/
|
||||
|
||||
docker run -d -p 4050:80 --restart=always -v /shumengya/tu:/var/www/html docker.1ms.run/oaooa/pichome
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
# Docker 常用命令总结
|
||||
|
||||
## 🐳 容器生命周期管理
|
||||
|
||||
### 容器操作
|
||||
```bash
|
||||
# 运行容器
|
||||
@@ -177,6 +175,4 @@ docker exec -it $(docker ps -lq) bash
|
||||
3. **标签管理**:为镜像打上有意义的标签
|
||||
4. **清理策略**:定期使用 `prune` 命令清理未使用资源
|
||||
5. **日志查看**:使用 `docker logs` 调试容器问题
|
||||
6. **组合命令**:将常用命令写入脚本或使用 docker-compose
|
||||
|
||||
记住这些命令可以帮助你高效地使用 Docker 进行容器化管理!
|
||||
6. **组合命令**:将常用命令写入脚本或使用 docker-compose
|
||||
@@ -1,10 +1,8 @@
|
||||
|
||||
---
|
||||
|
||||
## ✅ 方法一:直接导出容器(container → tar)
|
||||
|
||||
如果你运行的是一个 **容器**(而不是镜像),可以直接打包它:
|
||||
|
||||
```bash
|
||||
# 导出容器
|
||||
docker export <容器ID或名字> -o container.tar
|
||||
@@ -16,16 +14,12 @@ docker import container.tar new-image:latest
|
||||
特点:
|
||||
|
||||
- 容器的运行时文件系统会被打包(包含你安装的软件和修改),**但不会包含容器的历史层和环境变量**。
|
||||
|
||||
- 类似于“快照”迁移。
|
||||
|
||||
|
||||
---
|
||||
|
||||
## ✅ 方法二:保存镜像(image → tar)
|
||||
|
||||
如果你已经把容器做成了一个镜像,建议用 **save/load**:
|
||||
|
||||
```bash
|
||||
# 在源主机上保存镜像
|
||||
docker save -o myimage.tar myimage:latest
|
||||
@@ -39,11 +33,7 @@ docker load -i myimage.tar
|
||||
```
|
||||
|
||||
特点:
|
||||
|
||||
- 保留镜像层和构建历史。
|
||||
|
||||
- 推荐这种方式。
|
||||
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -0,0 +1,538 @@
|
||||
|
||||
|
||||
===========================
|
||||
|
||||
该文件用来测试和展示书写README的各种markdown语法。GitHub的markdown语法在标准的markdown语法基础上做了扩充,称之为`GitHub Flavored Markdown`。简称`GFM`,GFM在GitHub上有广泛应用,除了README文件外,issues和wiki均支持markdown语法。
|
||||
|
||||
****
|
||||
|
||||
|作者|果冻虾仁|
|
||||
|---|---
|
||||
|知乎|[![zhihu-shield]][zhihu]
|
||||
|公众号|编程往事
|
||||
|
||||
|
||||
****
|
||||
## 目录
|
||||
* [横线](#横线)
|
||||
* [标题](#标题)
|
||||
* [文本](#文本)
|
||||
* 普通文本
|
||||
* 单行文本
|
||||
* 多行文本
|
||||
* 文字高亮
|
||||
* 换行
|
||||
* 斜体
|
||||
* 粗体
|
||||
* 删除线
|
||||
* [图片](#图片)
|
||||
* 来源于网络的图片
|
||||
* GitHub仓库中的图片
|
||||
* [链接](#链接)
|
||||
* 文字超链接
|
||||
* 链接外部URL
|
||||
* 链接本仓库里的URL
|
||||
* 锚点
|
||||
* [图片链接](#图片链接)
|
||||
* [列表](#列表)
|
||||
* 无序列表
|
||||
* 有序列表
|
||||
* 复选框列表
|
||||
* [块引用](#块引用)
|
||||
* [代码高亮](#代码高亮)
|
||||
* [表格](#表格)
|
||||
* [Alerts](#Alerts)
|
||||
* [表情](#表情)
|
||||
* [diff语法](#diff语法)
|
||||
* [常用HTML语法](#常用HTML语法)
|
||||
* [折叠](#折叠)
|
||||
* [居中](#居中)
|
||||
* [其他](#其他)
|
||||
* [徽章](#徽章)
|
||||
* [star历史](#star历史)
|
||||
|
||||
### 横线
|
||||
-----------
|
||||
***、---、___可以显示横线效果
|
||||
|
||||
***
|
||||
---
|
||||
___
|
||||
|
||||
|
||||
|
||||
## 标题
|
||||
```
|
||||
# 一级标题
|
||||
## 二级标题
|
||||
### 三级标题
|
||||
#### 四级标题
|
||||
##### 五级标题
|
||||
###### 六级标题
|
||||
```
|
||||
效果如下:
|
||||
|
||||
# 一级标题
|
||||
## 二级标题
|
||||
### 三级标题
|
||||
#### 四级标题
|
||||
##### 五级标题
|
||||
###### 六级标题
|
||||
|
||||
|
||||
## 文本
|
||||
### 普通文本
|
||||
这是一段普通的文本
|
||||
### 单行文本
|
||||
Hello,大家好,我是果冻虾仁。
|
||||
在一行开头加入1个Tab或者4个空格。
|
||||
### 文本块
|
||||
#### 语法1
|
||||
在连续几行的文本开头加入1个Tab或者4个空格。
|
||||
|
||||
欢迎到访
|
||||
很高兴见到您
|
||||
祝您,早上好,中午好,下午好,晚安
|
||||
|
||||
#### 语法2
|
||||
使用一对各三个的反引号:
|
||||
```
|
||||
欢迎到访
|
||||
我是C++码农
|
||||
你可以在知乎、CSDN、简书搜索【果冻虾仁】找到我
|
||||
```
|
||||
该语法也可以实现代码高亮,见[代码高亮](#代码高亮)
|
||||
### 文字高亮
|
||||
文字高亮功能能使行内部分文字高亮,使用一对反引号。
|
||||
语法:
|
||||
```
|
||||
`linux` `网络编程` `socket` `epoll`
|
||||
```
|
||||
效果:`linux` `网络编程` `socket` `epoll`
|
||||
|
||||
也适合做一篇文章的tag
|
||||
#### 换行
|
||||
直接回车不能换行,
|
||||
可以在上一行文本后面补两个空格,
|
||||
这样下一行的文本就换行了。
|
||||
|
||||
或者就是在两行文本直接加一个空行。
|
||||
|
||||
也能实现换行效果,不过这个行间距有点大。
|
||||
#### 斜体、粗体、删除线
|
||||
|
||||
|语法|效果|
|
||||
|----|-----|
|
||||
|`*斜体1*`|*斜体1*|
|
||||
|`_斜体2_`| _斜体2_|
|
||||
|`**粗体1**`|**粗体1**|
|
||||
|`__粗体2__`|__粗体2__|
|
||||
|`这是一个 ~~删除线~~`|这是一个 ~~删除线~~|
|
||||
|`***斜粗体1***`|***斜粗体1***|
|
||||
|`___斜粗体2___`|___斜粗体2___|
|
||||
|`***~~斜粗体删除线1~~***`|***~~斜粗体删除线1~~***|
|
||||
|`~~***斜粗体删除线2***~~`|~~***斜粗体删除线2***~~|
|
||||
|
||||
斜体、粗体、删除线可混合使用
|
||||
|
||||
## 图片
|
||||
基本格式:
|
||||
```
|
||||

|
||||
```
|
||||
alt和title即对应HTML中的alt和title属性(都可省略):
|
||||
- alt表示图片显示失败时的替换文本
|
||||
- title表示鼠标悬停在图片时的显示文本(注意这里要加引号)
|
||||
|
||||
URL即图片的url地址,如果引用本仓库中的图片,直接使用**相对路径**就可了,如果引用其他github仓库中的图片要注意格式,即:`仓库地址/raw/分支名/图片路径`,如:
|
||||
```
|
||||
https://github.com/guodongxiaren/ImageCache/raw/master/Logo/foryou.gif
|
||||
```
|
||||
|
||||
|#|语法|效果|
|
||||
|---|---|----
|
||||
|1|``|
|
||||
|2|`![][code-past]`|![][code-past]
|
||||
|
||||
注意例2的写法使用了**URL标识符**的形式,在[链接](#链接)一节有介绍。
|
||||
>在文末有code-past的定义:
|
||||
```
|
||||
[code-past]:/img/codepast-logo.jpg "公众号:编程往事"
|
||||
```
|
||||
|
||||
## 链接
|
||||
### 链接外部URL
|
||||
|
||||
|#|语法|效果|
|
||||
|---|----|-----|
|
||||
|1|`[我的博客](http://blog.csdn.net/guodongxiaren "悬停显示")`|[我的博客](http://blog.csdn.net/guodongxiaren "悬停显示")|
|
||||
|2|`[我的知乎][zhihu] `|[我的知乎][zhihu] |
|
||||
|
||||
语法2由两部分组成:
|
||||
- 第一部分使用两个中括号,[ ]里的标识符(本例中zhihu),可以是数字,字母等的组合,标识符上下对应就行了(**姑且称之为URL标识符**)
|
||||
- 第二部分标记实际URL。
|
||||
|
||||
>使用URL标识符能达到复用的目的,一般把全文所有的URL标识符统一放在文章末尾,这样看起来比较干净。除了干净之外,它还能达到复用的目的,比如你在多个地方想使用同一个链接,那么文内使用标识符,只在最底部给标识符定义出实际的URL链接即可,类似编程语言中的变量。
|
||||
>>URL标识符是我起的名字,不知道是否准确。囧。。
|
||||
|
||||
### 链接本仓库里的URL
|
||||
|
||||
|语法|效果|
|
||||
|----|-----|
|
||||
|`[我的简介](/example/profile.md)`|[我的简介](/example/profile.md)|
|
||||
|`[example](./example)`|[example](./example)|
|
||||
|
||||
### 图片链接
|
||||
给图片加链接的本质是混合图片显示语法和普通的链接语法。普通的链接中[ ]内部是链接要显示的文本,而图片链接[ ]里面则是要显示的图片。
|
||||
直接混合两种语法当然可以,但是十分啰嗦,为此我们可以使用URL标识符的形式。
|
||||
|
||||
|#|语法|效果|
|
||||
|---|----|:---:|
|
||||
|1|`[![weibo-logo]](http://weibo.com/linpiaochen)`|[![weibo-logo]](http://weibo.com/linpiaochen)|
|
||||
|2|`[][zhihu]`|[][zhihu]|
|
||||
|3|`[![csdn-logo]][csdn]`|[![csdn-logo]][csdn]|
|
||||
|
||||
因为图片本身和链接本身都支持URL标识符的形式,所以图片链接也可以很简洁(见例3)。
|
||||
注意,此时鼠标悬停时显示的文字是图片的title,而非链接本身的title了。
|
||||
> 本文URL标识符都放置于文末
|
||||
|
||||
### 锚点
|
||||
其实呢,每一个标题都是一个锚点,和HTML的锚点(`#`)类似,比如我们
|
||||
|
||||
|语法|效果|
|
||||
|---|---|
|
||||
|`[回到顶部](#readme)`|[回到顶部](#readme)|
|
||||
|
||||
不过要注意,标题中的英文字母都被转化为**小写字母**了。
|
||||
> 以前GitHub对中文支持的不好,所以中文标题不能正确识别为锚点,但是现在已经没问题啦!
|
||||
|
||||
## 列表
|
||||
### 无序列表
|
||||
#### 语法
|
||||
```
|
||||
* 昵称:果冻虾仁
|
||||
- 别名:隔壁老王
|
||||
* 英文名:Jelly
|
||||
```
|
||||
#### 效果
|
||||
* 昵称:果冻虾仁
|
||||
- 别名:隔壁老王
|
||||
* 英文名:Jelly
|
||||
|
||||
### 多级无序列表
|
||||
#### 语法
|
||||
```
|
||||
* 编程语言
|
||||
* 脚本语言
|
||||
* Python
|
||||
```
|
||||
#### 效果
|
||||
* 编程语言
|
||||
* 脚本语言
|
||||
* Python
|
||||
|
||||
### 一级有序列表
|
||||
#### 语法
|
||||
就是在数字后面加一个点,再加一个空格。不过看起来起来可能不够明显。
|
||||
```
|
||||
面向对象的三个基本特征:
|
||||
|
||||
1. 封装
|
||||
2. 继承
|
||||
3. 多态
|
||||
```
|
||||
|
||||
#### 效果
|
||||
面向对象的三个基本特征:
|
||||
|
||||
1. 封装
|
||||
2. 继承
|
||||
3. 多态
|
||||
|
||||
|
||||
### 多级有序列表
|
||||
和无序列表一样,有序列表也有多级结构。
|
||||
#### 语法
|
||||
```
|
||||
1. 这是一级的有序列表,数字1还是1
|
||||
1. 这是二级的有序列表,阿拉伯数字在显示的时候变成了罗马数字
|
||||
1. 这是三级的有序列表,数字在显示的时候变成了英文字母
|
||||
```
|
||||
|
||||
#### 效果
|
||||
|
||||
1. 这是一级的有序列表,数字1还是1
|
||||
1. 这是二级的有序列表,阿拉伯数字在显示的时候变成了罗马数字
|
||||
1. 这是三级的有序列表,数字在显示的时候变成了英文字母
|
||||
|
||||
|
||||
### 复选框列表
|
||||
#### 语法
|
||||
```
|
||||
- [x] 需求分析
|
||||
- [x] 系统设计
|
||||
- [x] 详细设计
|
||||
- [ ] 编码
|
||||
- [ ] 测试
|
||||
- [ ] 交付
|
||||
```
|
||||
#### 效果
|
||||
|
||||
- [x] 需求分析
|
||||
- [x] 系统设计
|
||||
- [x] 详细设计
|
||||
- [ ] 编码
|
||||
- [ ] 测试
|
||||
- [ ] 交付
|
||||
|
||||
您可以使用这个功能来标注某个项目各项任务的完成情况。
|
||||
> Tip:
|
||||
>> 在GitHub的**issue**中使用该语法是可以实时点击复选框来勾选或解除勾选的,而无需修改issue原文。
|
||||
|
||||
## 块引用
|
||||
|
||||
### 常用于引用文本
|
||||
#### 文本摘自《深入理解计算机系统》P27
|
||||
令人吃惊的是,在哪种字节顺序是合适的这个问题上,人们表现得非常情绪化。实际上术语“little endian”(小端)和“big endian”(大端)出自Jonathan Swift的《格利佛游记》一书,其中交战的两个派别无法就应该从哪一端打开一个半熟的鸡蛋达成一致。因此,争论沦为关于社会政治的争论。只要选择了一种规则并且始终如一的坚持,其实对于哪种字节排序的选择都是任意的。
|
||||
> **“端”(endian)的起源**
|
||||
以下是Jonathan Swift在1726年关于大小端之争历史的描述:
|
||||
“……下面我要告诉你的是,Lilliput和Blefuscu这两大强国在过去36个月里一直在苦战。战争开始是由于以下的原因:我们大家都认为,吃鸡蛋前,原始的方法是打破鸡蛋较大的一端,可是当今的皇帝的祖父小时候吃鸡蛋,一次按古法打鸡蛋时碰巧将一个手指弄破了,因此他的父亲,当时的皇帝,就下了一道敕令,命令全体臣民吃鸡蛋时打破较小的一端,违令者重罚。”
|
||||
|
||||
### 块引用有多级结构
|
||||
#### 语法
|
||||
```
|
||||
> 数据结构
|
||||
>> 树
|
||||
>>> 二叉树
|
||||
>>>> 平衡二叉树
|
||||
>>>>> 满二叉树
|
||||
```
|
||||
#### 效果
|
||||
> 数据结构
|
||||
>> 树
|
||||
>>> 二叉树
|
||||
>>>> 平衡二叉树
|
||||
>>>>> 满二叉树
|
||||
|
||||
## 代码高亮
|
||||
|
||||
### 语法
|
||||
在三个反引号后面加上编程语言的名字,另起一行开始写代码,最后一行再加上三个反引号。
|
||||
|
||||
### 效果
|
||||
```Java
|
||||
public static void main(String[]args){} //Java
|
||||
```
|
||||
```c
|
||||
int main(int argc, char *argv[]) //C
|
||||
```
|
||||
```Bash
|
||||
echo "hello GitHub" #Bash
|
||||
```
|
||||
```javascript
|
||||
document.getElementById("myH1").innerHTML="Welcome to my Homepage"; //javascipt
|
||||
```
|
||||
```cpp
|
||||
string &operator+(const string& A,const string& B) //cpp
|
||||
```
|
||||
## 表格
|
||||
基本语法:
|
||||
```
|
||||
| 表头1 | 表头2|
|
||||
| ---------- | -----------|
|
||||
| 表格单元 | 表格单元 |
|
||||
| 表格单元 | 表格单元 |
|
||||
```
|
||||
|
||||
| 表头1 | 表头2|
|
||||
| ---------- | -----------|
|
||||
| 表格单元 | 表格单元 |
|
||||
| 表格单元 | 表格单元 |
|
||||
|
||||
简洁语法:
|
||||
```
|
||||
表头1 | 表头2|
|
||||
--------- | --------|
|
||||
表格单元 | 表格单元 |
|
||||
表格单元 | 表格单元 |
|
||||
```
|
||||
表头1 | 表头2|
|
||||
--------- | --------|
|
||||
表格单元 | 表格单元 |
|
||||
表格单元 | 表格单元 |
|
||||
|
||||
|
||||
### 对齐
|
||||
表格可以指定对齐方式
|
||||
```
|
||||
| 左对齐 | 居中 | 右对齐 |
|
||||
| :------------ |:---------------:| -----:|
|
||||
| col 3 is | some wordy text | $1600 |
|
||||
| col 2 is | centered | $12 |
|
||||
| zebra stripes | are neat | $1 |
|
||||
```
|
||||
|
||||
|
||||
| 左对齐 | 居中 | 右对齐 |
|
||||
| :------------ |:---------------:| -----:|
|
||||
| col 3 is | some wordy text | $1600 |
|
||||
| col 2 is | centered | $12 |
|
||||
| zebra stripes | are neat | $1 |
|
||||
|
||||
### 混合其他语法
|
||||
表格单元中的内容可以和其他大多数GFM语法配合使用,如:
|
||||
#### 使用普通文本的删除线,斜体等效果
|
||||
|
||||
| 名字 | 描述 |
|
||||
| ------------- | ----------- |
|
||||
| Help | ~~Display the~~ help window.|
|
||||
| Close | _Closes_ a window |
|
||||
|
||||
#### 表格中嵌入图片(链接)
|
||||
其实前面介绍图片显示、图片链接的时候为了清晰就是放在在表格中显示的。
|
||||
|
||||
| 图片 | 描述 |
|
||||
| ---- | ---- |
|
||||
|![baidu][baidu-logo] | 百度|
|
||||
|
||||
## Alerts
|
||||
```
|
||||
> [!NOTE]
|
||||
> 这是一个提示信息
|
||||
|
||||
> [!TIP]
|
||||
> 这是一个技巧提示
|
||||
|
||||
> [!IMPORTANT]
|
||||
> 这是重要信息
|
||||
|
||||
> [!WARNING]
|
||||
> 这是警告信息
|
||||
|
||||
> [!CAUTION]
|
||||
> 这是危险警告
|
||||
```
|
||||
效果如下:
|
||||
> [!NOTE]
|
||||
> 这是一个提示信息
|
||||
|
||||
> [!TIP]
|
||||
> 这是一个技巧提示
|
||||
|
||||
> [!IMPORTANT]
|
||||
> 这是重要信息
|
||||
|
||||
> [!WARNING]
|
||||
> 这是警告信息
|
||||
|
||||
> [!CAUTION]
|
||||
> 这是危险警告
|
||||
|
||||
## 表情
|
||||
Github的Markdown语法支持添加emoji表情,输入不同的符号码(两个冒号包围的字符)可以显示出不同的表情。
|
||||
|
||||
比如`:blush:`,可以显示:blush:。
|
||||
|
||||
具体每一个表情的符号码,可以查询GitHub的官方网页[http://www.emoji-cheat-sheet.com](http://www.emoji-cheat-sheet.com)。
|
||||
|
||||
但是这个网页每次都打开**奇慢**。。所以我整理到了本repo中,大家可以直接在此查看[emoji](./emoji.md)。
|
||||
|
||||
## diff语法
|
||||
版本控制的系统中都少不了diff的功能,即展示一个文件内容的增加与删除。
|
||||
GFM中可以显示的展示diff效果。使用绿色表示新增,红色表示删除。
|
||||
#### 语法
|
||||
其语法与代码高亮类似,只是在三个反引号后面写diff,
|
||||
并且其内容中,可以用 `+ `开头表示新增,`- `开头表示删除。
|
||||
另外还有有 `!`和`#`的语法。
|
||||
|
||||
#### 效果
|
||||
|
||||
```diff
|
||||
+ 人闲桂花落,
|
||||
- 夜静春山空。
|
||||
! 月出惊山鸟,
|
||||
# 时鸣春涧中。
|
||||
```
|
||||
## 常用HTML语法
|
||||
markdown是支持HTML语法的,虽然不鼓励大量使用HTML语法,毕竟那样就丧失了markdown的意义,但是有一些HTML语法在写README的时候是很好的补充。
|
||||
### 折叠
|
||||
```
|
||||
<details>
|
||||
<summary>Linux环境</summary>
|
||||
|
||||
##### 编译
|
||||
xxxx
|
||||
|
||||
##### 安装
|
||||
xxxx
|
||||
</details>
|
||||
```
|
||||
<details>
|
||||
<summary>Linux环境</summary>
|
||||
|
||||
##### 编译
|
||||
xxxx
|
||||
|
||||
##### 安装
|
||||
xxxx
|
||||
|
||||
</details>
|
||||
|
||||
### 居中
|
||||
|
||||
很多地方都会用到居中的效果,比如如下内容将会把一个表格在页面中居中展示:
|
||||
|
||||
```
|
||||
<div align="center">
|
||||
|
||||
| 表头1 | 表头2|
|
||||
| ---------- | -----------|
|
||||
| 表格单元 | 表格单元 |
|
||||
| 表格单元 | 表格单元 |
|
||||
|
||||
</div>
|
||||
```
|
||||
|
||||
<div align="center">
|
||||
|
||||
| 表头1 | 表头2|
|
||||
| ---------- | -----------|
|
||||
| 表格单元 | 表格单元 |
|
||||
| 表格单元 | 表格单元 |
|
||||
|
||||
</div>
|
||||
|
||||
其他任意需要居中展示的语法,都可以放在其中。
|
||||
|
||||
## 其他
|
||||
还有一些非markdown语法,但是在README文件中也很实用的组件。
|
||||
### 徽章
|
||||
绘制徽章,首选就是[shields.io](https://shields.io/) 具体语法去官网探索。
|
||||
|
||||

|
||||

|
||||
![zhihu-shield]
|
||||
|
||||
其次有些第三方平台也提供方便的徽章,比如gitter:
|
||||
|
||||
[](https://gitter.im/guodongxiaren/README?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
||||
|
||||
### star历史
|
||||
star历史可以使用这个网站[star-history.com](https://star-history.com/)
|
||||
```
|
||||
[](https://star-history.com/#guodongxiaren/README&Date)
|
||||
```
|
||||
这段代码的显示效果如下:
|
||||
|
||||
[](https://star-history.com/#guodongxiaren/README&Date)
|
||||
|
||||
|
||||
--------------------------------
|
||||
[csdn]:http://blog.csdn.net/guodongxiaren "我的博客"
|
||||
[zhihu]:https://www.zhihu.com/people/guodongxiaren "我的知乎,欢迎关注"
|
||||
[weibo]:http://weibo.com/linpiaochen
|
||||
[baidu-logo]:http://www.baidu.com/img/bdlogo.gif "百度logo"
|
||||
[weibo-logo]:/img/weibo.png "点击图片进入我的微博"
|
||||
[csdn-logo]:/img/csdn.png "我的CSDN博客"
|
||||
[code-past]:/img/codepast-logo.jpg "公众号:编程往事"
|
||||
[zhihu-shield]:https://img.shields.io/badge/dynamic/json?color=0084ff&logo=zhihu&label=%E6%9E%9C%E5%86%BB%E8%99%BE%E4%BB%81&query=%24.data.totalSubs&url=https%3A%2F%2Fapi.spencerwoo.com%2Fsubstats%2F%3Fsource%3Dzhihu%26queryKey%3Dguodongxiaren
|
||||
@@ -0,0 +1,119 @@
|
||||
# Markdown Cheat Sheet
|
||||
|
||||
Thanks for visiting [The Markdown Guide](https://www.markdownguide.org)!
|
||||
|
||||
This Markdown cheat sheet provides a quick overview of all the Markdown syntax elements. It can’t cover every edge case, so if you need more information about any of these elements, refer to the reference guides for [basic syntax](https://www.markdownguide.org/basic-syntax/) and [extended syntax](https://www.markdownguide.org/extended-syntax/).
|
||||
|
||||
## Basic Syntax
|
||||
|
||||
These are the elements outlined in John Gruber’s original design document. All Markdown applications support these elements.
|
||||
|
||||
### Heading
|
||||
|
||||
# H1
|
||||
## H2
|
||||
### H3
|
||||
|
||||
### Bold
|
||||
|
||||
**bold text**
|
||||
|
||||
### Italic
|
||||
|
||||
*italicized text*
|
||||
|
||||
### Blockquote
|
||||
|
||||
> blockquote
|
||||
|
||||
### Ordered List
|
||||
|
||||
1. First item
|
||||
2. Second item
|
||||
3. Third item
|
||||
|
||||
### Unordered List
|
||||
|
||||
- First item
|
||||
- Second item
|
||||
- Third item
|
||||
|
||||
### Code
|
||||
|
||||
`code`
|
||||
|
||||
### Horizontal Rule
|
||||
|
||||
---
|
||||
|
||||
### Link
|
||||
|
||||
[Markdown Guide](https://www.markdownguide.org)
|
||||
|
||||
### Image
|
||||
|
||||

|
||||
|
||||
## Extended Syntax
|
||||
|
||||
These elements extend the basic syntax by adding additional features. Not all Markdown applications support these elements.
|
||||
|
||||
### Table
|
||||
|
||||
| Syntax | Description |
|
||||
| ----------- | ----------- |
|
||||
| Header | Title |
|
||||
| Paragraph | Text |
|
||||
|
||||
### Fenced Code Block
|
||||
|
||||
```
|
||||
{
|
||||
"firstName": "John",
|
||||
"lastName": "Smith",
|
||||
"age": 25
|
||||
}
|
||||
```
|
||||
|
||||
### Footnote
|
||||
|
||||
Here's a sentence with a footnote. [^1]
|
||||
|
||||
[^1]: This is the footnote.
|
||||
|
||||
### Heading ID
|
||||
|
||||
### My Great Heading {#custom-id}
|
||||
|
||||
### Definition List
|
||||
|
||||
term
|
||||
: definition
|
||||
|
||||
### Strikethrough
|
||||
|
||||
~~The world is flat.~~
|
||||
|
||||
### Task List
|
||||
|
||||
- [x] Write the press release
|
||||
- [ ] Update the website
|
||||
- [ ] Contact the media
|
||||
|
||||
### Emoji
|
||||
|
||||
That is so funny! :joy:
|
||||
|
||||
(See also [Copying and Pasting Emoji](https://www.markdownguide.org/extended-syntax/#copying-and-pasting-emoji))
|
||||
|
||||
### Highlight
|
||||
|
||||
I need to highlight these ==very important words==.
|
||||
|
||||
### Subscript
|
||||
|
||||
H~2~O
|
||||
|
||||
### Superscript
|
||||
|
||||
X^2^
|
||||
479
mengyanote-backend/data/mengyanote/MarkDown/markdown实用格式.md
Normal file
479
mengyanote-backend/data/mengyanote/MarkDown/markdown实用格式.md
Normal file
@@ -0,0 +1,479 @@
|
||||
<h1 align="center">The Complete Guide of <br> Readme Markdown Syntax</h1>
|
||||
|
||||
Markdown is a syntax for styling all forms of writing on the GitHub platform.
|
||||
Mostly, it is just regular text with a few non-alphabetic characters thrown in, like ```git # or * ```
|
||||
|
||||
You can use Markdown most places around GitHub:
|
||||
|
||||
1. Gists
|
||||
2. Comments in Issues and Pull Requests
|
||||
3. Files with the .md or .markdown extension
|
||||
|
||||
___
|
||||
|
||||
### Headers
|
||||
|
||||
```git
|
||||
# Heading 1
|
||||
## Heading 2
|
||||
### Heading 3
|
||||
#### Heading 4
|
||||
##### Heading 5
|
||||
###### Heading 6
|
||||
```
|
||||
|
||||
# Heading 1
|
||||
## Heading 2
|
||||
### Heading 3
|
||||
#### Heading 4
|
||||
##### Heading 5
|
||||
###### Heading 6
|
||||
|
||||
___
|
||||
|
||||
### Font
|
||||
|
||||
```git
|
||||
*Italics*
|
||||
_This will also be italic_
|
||||
**Bold text**
|
||||
__This will also be bold__
|
||||
***Bold and Italics***
|
||||
_You **can** combine them_
|
||||
~~Striked Text~~
|
||||
***~~Italic, bold, and strikethrough1~~***
|
||||
```
|
||||
|
||||
*Italics* <br>
|
||||
_This will also be italic_<br>
|
||||
**Bold Text**<br>
|
||||
__This will also be bold__<br>
|
||||
***Bold and Italics***<br>
|
||||
_You **can** combine them_<br>
|
||||
~~Striked Text~~<br>
|
||||
***~~Italic, bold, and strikethrough1~~***
|
||||
___
|
||||
|
||||
### Lists
|
||||
|
||||
> Unordered
|
||||
|
||||
```git
|
||||
* Item 1
|
||||
* Item 2
|
||||
* Item 1a
|
||||
* Item 2a
|
||||
* Item 1b
|
||||
* Item 2b
|
||||
```
|
||||
|
||||
* Item 1
|
||||
* Item 2
|
||||
* Item 1a
|
||||
* Item 2a
|
||||
* Item 1b
|
||||
* Item 2b
|
||||
|
||||
OR
|
||||
`- Item 1`
|
||||
- Item 1
|
||||
|
||||
> Ordered
|
||||
|
||||
```git
|
||||
1. First
|
||||
2. jhg
|
||||
1. Second
|
||||
2. jhg
|
||||
1. Third
|
||||
2. jhg
|
||||
```
|
||||
|
||||
1. First
|
||||
2. jhg
|
||||
1. Second
|
||||
2. jhg
|
||||
1. Third
|
||||
2. jhg
|
||||
|
||||
___
|
||||
|
||||
### Links
|
||||
|
||||
```git
|
||||
* [Link with more info with various formatting options](https://docs.github.com/en/github/writing-on-github "more info")
|
||||
* https://www.google.com/
|
||||
* <https://www.google.com/>
|
||||
```
|
||||
|
||||
* [Link with more info with various formatting options](https://docs.github.com/en/github/writing-on-github "more info")
|
||||
* https://www.google.com/
|
||||
* <https://www.google.com/>
|
||||
|
||||
### Link Label
|
||||
```git
|
||||
[My GitHub][GitHubLink]
|
||||
```
|
||||
[My GitHub][GitHubLink]
|
||||
|
||||
You may define your link label anywhere in the document.
|
||||
```git
|
||||
e.g. put on bottom:
|
||||
|
||||
--------------------------------
|
||||
[GitHubLink]:https://github.com/darsaveli
|
||||
```
|
||||
|
||||
### Links to the URLs in a repository
|
||||
|
||||
```git
|
||||
[Example document](/example/example.md)
|
||||
```
|
||||
|
||||
[Example document](/example/example.md)
|
||||
|
||||
```git
|
||||
[example](./example)
|
||||
```
|
||||
|
||||
[example](./example)
|
||||
|
||||
___
|
||||
|
||||
### Inserting Images or Gifs using links
|
||||
|
||||
```git
|
||||

|
||||
```
|
||||
|
||||
- alt in square bracket indicates the replacement text when the image fails to display (can be omitted)
|
||||
- parenthesis contains image source
|
||||
- title in quotes indicates the text to display when the mouse hovers over the image (can be omitted)
|
||||
|
||||
Nite: Dropping the image to the readme file will upload it automatically with this syntax;
|
||||
It's the same as links, but add an exlamation mark (!) before opening square bracket;
|
||||
Image source can be either a location from the local machine or any valid image URL;
|
||||
|
||||
>Example
|
||||
|
||||
```git
|
||||

|
||||
```
|
||||

|
||||
|
||||
### Resize images/Gifs
|
||||
```
|
||||
<img src="https://github.com/darsaveli/Mariam/blob/main/1479814528_webarebears.gif" width="385px" align="center">
|
||||
```
|
||||
<img src="https://github.com/darsaveli/Mariam/blob/main/1479814528_webarebears.gif" width="385px" align="center">
|
||||
|
||||
You can use HTML tags like width="385px", hight="876px", align="center", etc depending what you need. In this case this gif was once uploaded to the repository and the link was taken from there.
|
||||
|
||||
Other options to resize:
|
||||
- ``
|
||||
|
||||
___
|
||||
|
||||
### Linking Image/Gif
|
||||
To open another webpage when image is clicked, enclose the Markdown for the image in brackets, and then add the link in parentheses.
|
||||
|
||||
```
|
||||
[](https://github.com/)
|
||||
|
||||
```
|
||||
|
||||
[](https://github.com/)
|
||||
|
||||
___
|
||||
|
||||
### Tables
|
||||
|
||||
```git
|
||||
|Header1|Header2|Header3|
|
||||
| --- | --- | --- |
|
||||
| This | is a | table |
|
||||
| This | is 2nd | row |
|
||||
| This | is 3rd | row |
|
||||
```
|
||||
|
||||
|Header1|Header2|Header3|
|
||||
| --- | --- | --- |
|
||||
| This | is a | table |
|
||||
| This | is 2nd | row |
|
||||
| This | is 3rd | row |
|
||||
|
||||
### Align
|
||||
You may specify alignment like this:
|
||||
```git
|
||||
| Align left | Centered | Align right |
|
||||
| :------------ |:---------------:| -----:|
|
||||
| col 3 is | some wordy text | $1600 |
|
||||
```
|
||||
| Align left | Centered | Align right |
|
||||
| :------------ |:---------------:| -----:|
|
||||
| aaa | bbb | ccc |
|
||||
|
||||
p.s. You can use alignment with `<h1 (or 2 etc.) align="center"> your text </h1>` tags or with `<p align="center"> your text</p>` tag to align plain text.
|
||||
___
|
||||
|
||||
### CheckBox
|
||||
|
||||
```git
|
||||
* [ ] Checkbox1
|
||||
|
||||
* [ ] Checkbox2
|
||||
|
||||
* [x] Checkbox selected
|
||||
```
|
||||
|
||||
|
||||
* [ ] Checkbox1
|
||||
|
||||
* [ ] Checkbox2
|
||||
|
||||
* [x] Checkbox selected
|
||||
|
||||
You may use this syntax in GitHub's issue to check or uncheck the checkbox in real time without having to modify the original version of the issue.
|
||||
|
||||
___
|
||||
|
||||
### Quoting Text
|
||||
|
||||
```git
|
||||
> This is a block quoted text
|
||||
```
|
||||
|
||||
> This is a block quoted text
|
||||
|
||||
### Multi-level blockquotes
|
||||
```
|
||||
> Asia
|
||||
>> China
|
||||
>>> Beijing
|
||||
>>>> Haidian
|
||||
>>>>> Tsinghua
|
||||
```
|
||||
#### Look like
|
||||
> Asia
|
||||
>> China
|
||||
>>> Beijing
|
||||
>>>> Haidian
|
||||
>>>>> Tsinghua
|
||||
|
||||
* These are fenced code blocks
|
||||
|
||||
___
|
||||
|
||||
### Text highlighting
|
||||
|
||||
```git
|
||||
`linux` `ubuntu`
|
||||
```
|
||||
Using a pair of backquotes is suitable for making tags for articles
|
||||
`linux` `ubuntu`
|
||||
|
||||
___
|
||||
|
||||
### Horizontal Line
|
||||
|
||||
```git
|
||||
***
|
||||
___
|
||||
---
|
||||
```
|
||||
|
||||
All three will be rendered as:
|
||||
___
|
||||
p.s.
|
||||
```git
|
||||
<hr> works too
|
||||
```
|
||||
___
|
||||
|
||||
### Break between lines
|
||||
|
||||
```git
|
||||
<br>
|
||||
```
|
||||
___
|
||||
|
||||
### Visible markdown characters
|
||||
|
||||
```git
|
||||
```git
|
||||
* __ <br> etc ```
|
||||
```
|
||||
___
|
||||
|
||||
### Multi-line text
|
||||
|
||||
aaa,
|
||||
sss,
|
||||
ddd!
|
||||
|
||||
Add 1 tab or 4 spaces at the beginning of several lines of text.
|
||||
|
||||
OR
|
||||
|
||||
Use three backticks:
|
||||
|
||||
```
|
||||
asd,
|
||||
sfd,
|
||||
wer!
|
||||
```
|
||||
This syntax can also be used for code highlighting
|
||||
|
||||
___
|
||||
|
||||
### Comments in Markdown
|
||||
|
||||
```git
|
||||
<!-- comment written in markdown -->
|
||||
```
|
||||
They will be invisible on readme
|
||||
___
|
||||
|
||||
### Emoji
|
||||
```git
|
||||
:grinning: or just place the emoji 😀
|
||||
```
|
||||
:grinning: or just place the emoji 😀
|
||||
|
||||
To see a list of every image Github supports, check out the [Emoji Cheat Sheet](https://github.com/ikatyang/emoji-cheat-sheet/blob/master/README.md)
|
||||
|
||||
___
|
||||
|
||||
### Code Block
|
||||
There are three ways to add code in markdown
|
||||
1. Inline Code (single backtick)
|
||||
2. Whitespace
|
||||
|
||||
```git
|
||||
`this` is an example of inline code.
|
||||
```
|
||||
four spaces work too!
|
||||
|
||||
3. Fenced code blocks
|
||||
With GFM you can wrap your code with three back quotes to create a code block without the leading spaces. Add annoptional language identifier and your code will get syntax highlighting.
|
||||
|
||||
```Java
|
||||
public static void main(String[]args){} //Java
|
||||
```
|
||||
|
||||
```javascript
|
||||
document.getElementById("myH1").innerHTML="Welcome to my Homepage"; //javascipt
|
||||
```
|
||||
|
||||
___
|
||||
|
||||
### Syntax Highlighting
|
||||
If language name is mentioned after the end of first set of backticks, the code snippet will be highlighted according to the language.
|
||||
|
||||
```js
|
||||
console.log('javascript')
|
||||
```
|
||||
|
||||
```python
|
||||
print('python')
|
||||
```
|
||||
|
||||
```java
|
||||
System.out.println('java')
|
||||
```
|
||||
|
||||
```json
|
||||
{
|
||||
"firstName": "A",
|
||||
"lastName": "B
|
||||
"age": 18
|
||||
}
|
||||
```
|
||||
|
||||
```js
|
||||
console.log('javascript')
|
||||
```
|
||||
|
||||
```python
|
||||
print('python')
|
||||
```
|
||||
|
||||
```java
|
||||
System.out.println('java')
|
||||
```
|
||||
|
||||
```json
|
||||
{
|
||||
"firstName": "A",
|
||||
"lastName": "B",
|
||||
"age": 18
|
||||
}
|
||||
```
|
||||
___
|
||||
|
||||
### diff syntax
|
||||
|
||||
In the version control system, the function of diff is indispensable, i.e., the addition and deletion of a file content is displayed.
|
||||
The diff effect that can be displayed in GFM. Green is for new, while red is for deleted.
|
||||
#### Syntax
|
||||
The syntax is similar to code [fenced code blocks](#fenced-code-blocks), except that the diff is written after the three backticks.
|
||||
And in the content, the beginning of `+ ` indicates the addition, and the beginning of `- ` indicates the deletion.
|
||||
|
||||
```diff
|
||||
+ Hello world!
|
||||
- This is useless.
|
||||
```
|
||||
|
||||
___
|
||||
|
||||
### Use YAML: human friendly data serialization language for all programming languages
|
||||
|
||||
```yaml
|
||||
name: Mariam
|
||||
located_in: ***
|
||||
from: ***
|
||||
education: ***
|
||||
job: ***
|
||||
company: ***
|
||||
```
|
||||
___
|
||||
|
||||
### Anchor
|
||||
In fact, each title is an anchor, similar to the HTML anchor (`#`), e.g.
|
||||
|
||||
|Syntax|Look like|
|
||||
|---|---|
|
||||
|`[Back to top](#readme)`|[Back to top](#readme)|
|
||||
|
||||
Note that all the letters in the title are converted to **lowercase letters**.
|
||||
|
||||
___
|
||||
|
||||
### Render mathematical expressions in Markdown
|
||||
|
||||
You can now use LaTeX style syntax to render math expressions within Markdown inline (using $ delimiters) or in blocks (using $$ delimiters).
|
||||
|
||||
Writing expressions as blocks
|
||||
To add math as a multiline block displayed separately from surrounding text, start a new line and delimit the expression with two dollar symbols $$.
|
||||
|
||||
$$\left( \sum_{k=1}^n a_k b_k \right)^2 \leq \left( \sum_{k=1}^n a_k^2 \right) \left( \sum_{k=1}^n b_k^2 \right)$$
|
||||
|
||||
```git
|
||||
$$\left( \sum_{k=1}^n a_k b_k \right)^2 \leq \left( \sum_{k=1}^n a_k^2 \right) \left( \sum_{k=1}^n b_k^2 \right)$$
|
||||
```
|
||||
## Writing inline expressions
|
||||
To include a math expression inline with your text, delimit the expression with a dollar symbol $.
|
||||
|
||||
This sentence uses `$` delimiters to show math inline: $\sqrt{3x-1}+(1+x)^2$
|
||||
|
||||
```git
|
||||
This sentence uses `$` delimiters to show math inline: $\sqrt{3x-1}+(1+x)^2$
|
||||
```
|
||||
|
||||
___
|
||||
|
||||
|
||||
### [Markdown posts on GitHub](https://github.blog/changelog/label/markdown/)
|
||||
|
||||
___
|
||||
|
||||
@@ -136,5 +136,3 @@ print(message)
|
||||
2. **代码块**使用三个反引号并指定语言:\`\`\`language
|
||||
3. 在代码块中,可以避免Markdown语法的转义问题
|
||||
4. 内联代码适合简短的代码片段,代码块适合多行代码
|
||||
|
||||
这样使用代码格式,可以让技术文档更加清晰易读!
|
||||
369
mengyanote-backend/data/mengyanote/MarkDown/史上最全markdown格式大全.md
Normal file
369
mengyanote-backend/data/mengyanote/MarkDown/史上最全markdown格式大全.md
Normal file
@@ -0,0 +1,369 @@
|
||||
|
||||
# 认识 Markdown
|
||||
> Markdown 是一种用来写作的轻量级「标记语言」,它用简洁的语法代替排版,而不像一般我们用的字处理软件 Word 或 Pages 有大量的排版、字体设置。它使我们专心于码字,用「标记」语法,来代替常见的排版格式。例如此文从内容到格式,甚至插图,键盘就可以通通搞定了。目前来看,支持 Markdown 语法的编辑器有很多,包括很多网站(例如简书)也支持了 Markdown 的文字录入。Markdown 从写作到完成,导出格式随心所欲,你可以导出 HTML 格式的文件用来网站发布,也可以十分方便的导出 PDF 格式。
|
||||
|
||||
# Markdown 的优点
|
||||
* 页面内容可读性强,简洁直观。
|
||||
* 纯文本,兼容性强,几乎任何文本编辑器都可打开。
|
||||
* 格式转换简便,轻松的导出HTML、PDF、.md等多种格式文件。
|
||||
* 不需太过于关心页面排版,只需关注内容。
|
||||
|
||||
# Markdown 官方文档
|
||||
[创始人 John Gruber 的 Markdown 语法说明](https://daringfireball.net/projects/markdown/syntax)
|
||||
[Markdown 中文版语法说明](http://wowubuntu.com/markdown/#list)
|
||||
|
||||
# Markdown 语法的简要介绍
|
||||
[换行符](#换行符)
|
||||
[强调(Strong and Emphasize)](#强调)
|
||||
[标题(Headers)](#标题)
|
||||
[URL链接](#URL链接)
|
||||
[引用图片](#引用图片)
|
||||
[列表](#列表)
|
||||
[引用](#引用)
|
||||
[Inline Code](#InlineCode)
|
||||
[Block Code](#BlockCode)
|
||||
[Code Block](#CodeBlock)
|
||||
[分割线](#分割线)
|
||||
[表格](#表格)
|
||||
[锚点](#锚点)
|
||||
[del标签](#del标签)
|
||||
[u标签](#u标签)
|
||||
[mark标签](#mark标签)
|
||||
[font标签](#font标签)
|
||||
|
||||
# 换行符
|
||||
> 在Markdown语法中,换行需要敲两个回车键,即在两段文本之间添加一个空行来达到换行的效果。
|
||||
|
||||
*敲一个回车键*
|
||||
|
||||
**这是第一个段落**
|
||||
**这是第二个段落**
|
||||
|
||||
*上面的写法在编辑器中显示是两行,但是在Macdown预览效果发现,他们还是在同一行,只是两个段落中间多出来一个空格。(注意:简书中的效果是两行显示的,在简书中编辑时,敲一个回车键即可实现换行效果!)*
|
||||
|
||||
**这时我们在两行中间多敲一个回车键就能达到换行的效果**
|
||||
|
||||
*敲两个回车键键的效果:*
|
||||
|
||||
**这是第一个段落**
|
||||
|
||||
**这时第二个段落**
|
||||
|
||||
*有同学发现,我本来只是想让同一句话换个行显示而已,你这中间还多出来一空行,不够美观。能不能中间没有留白的空行,但是也能实现换行的效果尼?当然办法总是有的,下面就介绍第二种换行方式。*
|
||||
|
||||
**另一种方式实现换行的方式,两个段落之间没有空行**
|
||||
> 官方解释:To force a line break, put two spaces and a newline (return) at the end of the line.
|
||||
|
||||
*在同一段落中,在需要换行的字符后敲两个空格,再敲回车键就能达到同一段落换行的效果*
|
||||
|
||||
*例如这样:*
|
||||
|
||||
**这是第一个段落**
|
||||
**这时第二个段落**
|
||||
|
||||
# 强调
|
||||
> 在Markdown语法中,想要着重强调某一部分内容时,可以使用`*`或者是`_`来包裹要着重强调的内容。`**`或`__`表示字体加粗,`*`或`_`表示字体斜体,(个人推荐使用`*`)
|
||||
|
||||
*这里的内容强调分两种语法,一种是字体加粗强调,另一种是为斜体强调*
|
||||
|
||||
1. 加粗(**可以使用快捷键生成加粗符号:Command+b**)
|
||||
|
||||
* 方式1:**这是字体加粗强调**
|
||||
* 方式2:__这是字体加粗强调__
|
||||
|
||||
2. 斜体(**可以使用快捷键生成斜体符号:Command+i**)
|
||||
|
||||
* 方式1:*这是斜体强调*
|
||||
* 方式2:_这是斜体强调_
|
||||
|
||||
# 标题
|
||||
> 在Markdown语法中,添加标题使用`#`,就会有标题加粗的效果出现。标题分为六个等级,即1个#代表一级标题,2个#代表二级标题,直到六级标题。
|
||||
|
||||
# Header 1
|
||||
## Header 2
|
||||
### Header 3
|
||||
#### Header 4
|
||||
##### Header 5
|
||||
###### Header 6
|
||||
|
||||
*这可以使用下面的方式来设置一级、二级标题,不过不推荐使用。*
|
||||
|
||||
Header 1
|
||||
========
|
||||
Header 2
|
||||
---------
|
||||
|
||||
# URL链接
|
||||
> 在写自己的博客中,经常有需求要跳转到某一个网页或者邮件。这时需要使用link链接。link链接方式分为内联(Inline)和外部引用(Reference)
|
||||
|
||||
* Inline
|
||||
|
||||
*将邮箱地址包裹在<>内部,就形成了可以点击的邮箱地址: <1126756952@qq.com>*
|
||||
|
||||
*<a name="markdown-anchor"></a>*
|
||||
|
||||
*将网页url包裹在<>内部,就形成了可以点击访问的网页地址: <http://www.jianshu.com/u/023338566ca5>*
|
||||
|
||||
*自定义网页链接的标题`[标题](链接)`: [光强的简书](http://www.jianshu.com/u/023338566ca5)*
|
||||
|
||||
* Reference (外部引用的好处可以在整个文章中重复引用网页地址或者图片地址而不需要多些拷贝同一个url)
|
||||
|
||||
*Make [a link][arbitrary_id] `[a link][arbitrary_id]`*
|
||||
|
||||
*[like this][] `[like this][]`*
|
||||
|
||||
[arbitrary_id]: http://www.jianshu.com/u/023338566ca5
|
||||
[like this]: http://www.jianshu.com/u/023338566ca5
|
||||
|
||||
# 引用图片
|
||||
> Markdown中引用图片资源同样也是分为内联(Inline)和外部引用(Reference)
|
||||
|
||||
* Inline
|
||||
|
||||
*语法:*
|
||||
|
||||
``
|
||||
|
||||
*使用方式:*
|
||||
|
||||

|
||||
|
||||
* Reference
|
||||
|
||||
*语法*
|
||||
|
||||
`![Alt Image Text][image-id]`
|
||||
|
||||
`[image-id]: http://ovyjkveav.bkt.clouddn.com/17-10-19/15885901.jpg`
|
||||
|
||||
*使用方式:*
|
||||
|
||||
![Alt Image Text][image-id]
|
||||
|
||||
[image-id]: http://ovyjkveav.bkt.clouddn.com/17-10-19/15885901.jpg
|
||||
|
||||
# 列表
|
||||
> Markdown语法中,列表分为三类:有序列表、无序列表、嵌套列表
|
||||
|
||||
* ####有序列表
|
||||
|
||||
1. 列表1
|
||||
2. 列表2
|
||||
3. 列表3
|
||||
|
||||
* ####无序列表(无序列表中,`*`、`+`、`-`效果一样,个人推荐使用`*`)
|
||||
|
||||
* 列表1
|
||||
* 列表2
|
||||
+ 列表4
|
||||
+ 列表5
|
||||
- 列表7
|
||||
- 列表8
|
||||
|
||||
* ####缩进层次嵌套列表
|
||||
|
||||
* 这是一个嵌套列表
|
||||
1. 列表1
|
||||
2. 列表2
|
||||
3. 列表3
|
||||
|
||||
# 引用
|
||||
> Markdown语法中,使用`>`表示引用,引用名人名言或者是别人的一段文本等。
|
||||
|
||||
---
|
||||
|
||||
> "三天不学习,赶不上刘少奇。" - 毛泽东
|
||||
|
||||
*当然引用也可以嵌套使用的*
|
||||
|
||||
> 这时一级引用
|
||||
>> 这时二级引用
|
||||
>>> 这时三级引用
|
||||
>>> 还是三级引用
|
||||
|
||||
>> 二级引用
|
||||
|
||||
> 一级引用
|
||||
|
||||
*引用也可以和其他的markdown语法混合使用*
|
||||
|
||||
> ###这是一级引用
|
||||
>> *这是二级引用*
|
||||
>>> * 这是三级引用
|
||||
>>> * 还是三级引用
|
||||
>>> 1. 还是三级标题
|
||||
>>> 1. 还是三级标题
|
||||
|
||||
>> **二级引用**
|
||||
|
||||
> [一级引用][arbitrary_id]
|
||||
|
||||
# InlineCode
|
||||
>内嵌文本,当我们想让某一文本内容内嵌在边框内,我们可以使用一对反引号包裹内容:`内容`
|
||||
|
||||
**使用方式:**
|
||||
|
||||
*内容本身不包含反引号*
|
||||
|
||||
* `Inline code`
|
||||
|
||||
*内容本身包含反引号。当文本内容中正好包含有反引号,这时需要使用空格隔开:*
|
||||
|
||||
* ``code has `backticks` ``
|
||||
|
||||
* ```` ``Code with `backticks` `` ````
|
||||
|
||||
# BlockCode
|
||||
> 当我们敲4个空格键或者是一个tab键,这样就形成一个代码块区域。不推荐使用
|
||||
|
||||
**使用方式:**
|
||||
|
||||
print('This is a code block')
|
||||
print('The block must be preceded by a blank line')
|
||||
print('Then indent at least 4 spaces or 1 tab')
|
||||
print('Nesting does nothing. Your code is displayed Literally')
|
||||
|
||||
|
||||
# CodeBlock
|
||||
> 对于程序员来说,很多时候我们写技术博客都需要贴上自己的代码来给读者讲解,这时就用到了代码引用语法:三个反引号```Code```或者三个波浪号~~~Code~~~。
|
||||
|
||||
* 方式1
|
||||
|
||||
```
|
||||
render() {
|
||||
const dataArr = this.state.dataSource
|
||||
return (
|
||||
<ListView
|
||||
style={styles.listStyle}
|
||||
dataSource={dataArr}
|
||||
renderRow={this.renderRow}
|
||||
renderSeparator={() => this._renderSeparator()}
|
||||
/>
|
||||
)
|
||||
}
|
||||
```
|
||||
|
||||
* 方式2
|
||||
|
||||
~~~
|
||||
render() {
|
||||
const dataArr = this.state.dataSource
|
||||
return (
|
||||
<ListView
|
||||
style={styles.listStyle}
|
||||
dataSource={dataArr}
|
||||
renderRow={this.renderRow}
|
||||
renderSeparator={() => this._renderSeparator()}
|
||||
/>
|
||||
)
|
||||
}
|
||||
~~~
|
||||
|
||||
# 分割线
|
||||
> 当我们想对文章的某些内容做上下分割,这时我们可以使用分割线语法:`***或---`
|
||||
|
||||
*在MacDown编辑器中,分割线分为粗线和细线。*
|
||||
|
||||
**注意:在简书中,`***`或`---`不显示粗线,只有细线,一个或者两个`-`也不显示细线**
|
||||
|
||||
* 粗线
|
||||
|
||||
***
|
||||
|
||||
or
|
||||
|
||||
---
|
||||
|
||||
* 细线(细线只需一个或者两个`-`)
|
||||
|
||||
-
|
||||
|
||||
or
|
||||
|
||||
--
|
||||
|
||||
# 表格
|
||||
> 表格的使用肯定我们每一位同学都不陌生,因为我们经常使用Excel表格来展示各种数据报表。很庆幸Markdown同样也支持表格制作,而且使用方式很简单。表格由行与列组成,这里只需要注意表格的内容对齐方式即可。
|
||||
|
||||
*没有设置对齐方式*
|
||||
|
||||
First Header | Second Header
|
||||
------------- | -------------
|
||||
Content Cell | Content Cell
|
||||
Content Cell | Content Cell
|
||||
|
||||
*中间表格对齐*
|
||||
|
||||
| Left Aligned | Center Aligned | Right Aligned |
|
||||
|:------------- |:---------------:| -------------:|
|
||||
| col 3 is | some wordy text | $1600 |
|
||||
| col 2 is | centered | $12 |
|
||||
| zebra stripes | are neat | $1 |
|
||||
|
||||
**这里需要注意:表格的左边和右边的`|`可以省略不需要使用,表格左右两边加上`|`主要基于美观考虑,表格的对齐方式仅仅取决于`:`**
|
||||
|
||||
# 锚点
|
||||
>在写文章时,有时候我们有这样的需求,从文章的某一个位置直接跳转到指定的另一个位置,这时使用到a标签的锚点语法。
|
||||
|
||||
**注意: a标签跳转到指定位置在简书中无效**
|
||||
|
||||
*使用方式:*
|
||||
|
||||
**在待跳转到的位置上添加一行:`<a name="markdown-anchor"></a>`**
|
||||
|
||||
**`[*Markdown高级用法:* 跳转到作者的简书链接处](#markdown-anchor)`:通过name就可以找到指定的位置**
|
||||
|
||||
[*Markdown高级用法:* 跳转到作者的简书链接处](#markdown-anchor)
|
||||
|
||||
# del标签
|
||||
> 内容中间添加一条横线: `<del>xxx</del>`
|
||||
|
||||
**注意:del标签在简书中无效**
|
||||
|
||||
First Header | Second Header
|
||||
------------- | -------------
|
||||
Content Cell | <del>Content Cell</del>
|
||||
Content Cell | Content Cell
|
||||
|
||||
# u标签
|
||||
> 内容底部添加一条横线: `<u>xxx</u>`
|
||||
|
||||
**注意:u标签在简书中无效**
|
||||
|
||||
First Header | Second Header
|
||||
------------- | -------------
|
||||
Content Cell | <u>Content Cell</u>
|
||||
Content Cell | Content Cell
|
||||
|
||||
# mark标签
|
||||
> 内容颜色高亮处理: `<mark>xxx</mark>`
|
||||
|
||||
**注意:mark标签在简书中无效**
|
||||
|
||||
First Header | Second Header
|
||||
------------- | -------------
|
||||
Content Cell | <mark>Content Cell</mark>
|
||||
Content Cell | Content Cell
|
||||
|
||||
# font标签
|
||||
> 设置文本的字体颜色: `<font color=Red>xxx</font>`
|
||||
|
||||
**注意:font标签在简书中无效**
|
||||
|
||||
<font color=Red>修改文本的字体颜色为红色</font>
|
||||
|
||||
# 注意事项
|
||||
|
||||
* 换行符MacDown编辑器和简书编辑器语法效果上略有不同
|
||||
* 简书编辑不支持快捷键生成标签
|
||||
* 在简书中,`***`或`---`不显示粗线,只有细线,一个或者两个`-`也不显示细线
|
||||
* 简书中使用a标签跳转到指定的位置没有效果
|
||||
* 简书中使用del、u、mark、font等标签都没有效果
|
||||
|
||||
#总结
|
||||
|
||||
**以上内容是作者花了好几个小时总结出来的常用Markdown语法,介绍了Markdown的十几种常用的语法知识,并逐一的进行了示例展示。可以说足以满足读者们日常中各种使用Markdown编写文章的需求。老铁们要是感觉文章对您有帮助,请 点赞 关注 666**
|
||||
|
||||
*最后再啰嗦一句:一定要趁热打铁!*
|
||||
|
||||
**强烈建议读者们认真浏览作者的这篇文章后,自己使用Markdown写一篇文章,体会一下Markdown语法的优雅之处!**
|
||||
52
mengyanote-backend/data/mengyanote/MarkDown/树萌芽のGithub主页.md
Normal file
52
mengyanote-backend/data/mengyanote/MarkDown/树萌芽のGithub主页.md
Normal file
@@ -0,0 +1,52 @@
|
||||
<!-- =========================== -->
|
||||
<!-- GitHub Profile README -->
|
||||
<!-- =========================== -->
|
||||
|
||||
<div align="center">
|
||||
# 🔍 你好,我是 **树萌芽** 🌱
|
||||
**一个喜欢捣鼓各种奇奇怪怪的玩意的人**
|
||||
<!-- 头图 / 头像-->
|
||||
<br/>
|
||||
<img src="https://avatars.githubusercontent.com/u/50783834?v=4" alt="avatar" width="140" style="border-radius:50%"/>
|
||||
</div>
|
||||
---
|
||||
## ✨ 关于我(About Me)
|
||||
- **昵称**:树萌芽 🌿
|
||||
- **定位**:Full-Stack / Backend / DevOps ⚙️
|
||||
- **简介**:努力学习,努力生活!💪
|
||||
|
||||
---
|
||||
## 🛠 技术栈(Tech Stack)
|
||||
🐍 Golang-Gin · Python-Flask · Java-SpringBoot
|
||||
☕ MySQL · MongoDB · SQLite · Redis
|
||||
🐳 Docker · LXC
|
||||
🐧 Debian · Ubuntu
|
||||
|
||||
---
|
||||
## 📦 精选项目(Selected Projects)
|
||||
|
||||
| 项目名称 | 项目简介 | 项目地址 | 开源地址 | 技术栈 |
|
||||
| ------------ | -------------------- | ---------------------------------------------------------- | ---------------------------------------------------------------------------- | ----------------------------- |
|
||||
| **萌芽主页** | 简单好看的个人主页 | [www.shumengya.top](https://www.shumengya.top) | | Python Flask + React + Docker |
|
||||
| **萌芽笔记** | Obsidian MarkDown笔记库 | [note.shumengya.top](https://note.shumengya.top) | | Python Flask + React + Docker |
|
||||
| **萌芽作品集** | 个人作品合集 | [work.shumengya.top](https://work.shumengya.top) | | Golang Gin + React + Docker |
|
||||
| **万象口袋** | 一站式跨平台工具合集 | [infogenie.shumengya.top](https://infogenie.shumengya.top) | [github.com/shumengya/InfoGenie](https://github.com/shumengya/InfoGenie) | Golang Gin + React + Docker |
|
||||
| **萌芽短链** | 短链接分享工具 | [short.shumengya.top](https://short.shumengya.top) | | Python Flask + React + Docker |
|
||||
| **萌芽漂流瓶** | 个人小玩具 | [bottle.shumengya.top](https://bottle.shumengya.top) | | Python Flask + React + Docker |
|
||||
| **萌芽SSH** | 网页SSH连接工具 | [ssh.shumengya.top](https://ssh.shumengya.top) | | Golang Gin + React + Docker |
|
||||
| **萌芽小店** | 轻量级商城系统 | [store.shumengya.top](https://store.shumengya.top) | [github.com/shumengya/mengyastore](https://github.com/shumengya/mengyastore) | Golang Gin + React + Docker |
|
||||
| **萌芽导航** | 浏览器网站导航 | [nav.smyhub.com](https://nav.smyhub.com) | | CloudFlare Worker + D1 SQL |
|
||||
| **萌芽账户认证中心** | 自制软件作品统一账户认证中心 | [auth.shumengya.top](https://auth.shumengya.top) | | Golang Gin + React + Docker |
|
||||
| **萌芽Ping** | 网站监控面板 | [ping.shumengya.top](https://ping.shumengya.top) | | Golang Gin + React + Docker |
|
||||
| **萌芽VPS监控** | 服务器监控面板 | [monitor.shumengya.top](https://monitor.shumengya.top) | | Golang Gin + React + Docker |
|
||||
| **萌芽博客** | 极客轻量级极简博客 | [blog.smyhub.com](https://blog.smyhub.com) | | CloudFlare Worker + D1 SQL |
|
||||
|
||||
---
|
||||
## 📫 联系方式(Contact)
|
||||
- 📧 **联系邮箱:**[mail@smyhub.com](mailto:mail@smyhub.com)
|
||||
- 🌐 **个人主页:**[smyhub.com](https://smyhub.com)
|
||||
- 🐙 **GitHub主页:**[github.com/shumengya](https://github.com/shumengya)
|
||||
- 📝 **个人博客:**[blog.smyhub.com](https://blog.smyhub.com)
|
||||
- 💬 **闲聊说说:**[memos.shumengya.top](https://memos.shumengya.top)
|
||||
|
||||
---
|
||||
8
mengyanote-backend/data/mengyanote/MarkDown/等级表示方法.md
Normal file
8
mengyanote-backend/data/mengyanote/MarkDown/等级表示方法.md
Normal file
@@ -0,0 +1,8 @@
|
||||
阿拉伯数字:
|
||||
1,2,3,4,5,6,7,8,9,10
|
||||
简体中文:
|
||||
一、二、三、四、五、六、七、八、九、十
|
||||
繁体中文:
|
||||
壹、貳、參、肆、伍、陸、柒、捌、玖、拾
|
||||
罗马数字:
|
||||
I,II,III,IV,V,VI,VII,VIII,IX,X
|
||||
6
mengyanote-backend/data/mengyanote/MarkDown/表情包表格.md
Normal file
6
mengyanote-backend/data/mengyanote/MarkDown/表情包表格.md
Normal file
@@ -0,0 +1,6 @@
|
||||
| | | | |
|
||||
| ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ |
|
||||
|  |  |  |  |
|
||||
|  | | | |
|
||||
|  | | | |
|
||||
|  | | |  |
|
||||
167
mengyanote-backend/data/mengyanote/Minecraft/MD测试.md
Normal file
167
mengyanote-backend/data/mengyanote/Minecraft/MD测试.md
Normal file
File diff suppressed because one or more lines are too long
@@ -1,6 +1,42 @@
|
||||
## /shumengya/mengyanote
|
||||
# 萌芽笔记
|
||||
|
||||
- 所在主机:bigmengya
|
||||
- 用途:知识库目录
|
||||
- 说明:用于存放树萌芽的知识库、笔记资料及相关内容
|
||||
- 建议:与 Docker 运行目录分开维护,避免运行数据与知识资料混杂
|
||||
树萌芽的 Markdown 知识库与资料仓库,用于集中整理技术笔记、项目策划、运维记录、学习资料和个人沉淀内容。
|
||||
|
||||
## 仓库定位
|
||||
|
||||
这个仓库不是传统的软件项目,而是一个按主题分类维护的文档库。内容以 `.md` 文件为主,适合在 Obsidian、VS Code 或任意 Markdown 编辑器中查看和维护。
|
||||
|
||||
## 主要目录
|
||||
|
||||
- `AI/`:大模型、提示词工程、Agent、AI 工具使用记录
|
||||
- `Linux/`、`Windows/`、`Docker/`:系统运维与环境配置笔记
|
||||
- `数据库/`:MySQL、Postgres、MongoDB、Redis、SQLite 等相关记录
|
||||
- `编程语言/`:Golang、Java、Python、前端、C/C++ 等语言学习与代码片段
|
||||
- `内网穿透/`、`CloudFlare/`、`运维/`:网络、代理、部署、域名与服务治理
|
||||
- `项目策划/`:各类产品、工具和项目想法草案
|
||||
- `博客文章/`:可进一步整理发布的文章内容
|
||||
- `树萌芽の小本本/`、`临时/`:个人记录与阶段性临时资料
|
||||
|
||||
## 使用方式
|
||||
|
||||
1. 直接用 Obsidian 打开仓库目录,可获得更好的目录浏览和双链体验。
|
||||
2. 使用 VS Code 或其他编辑器维护 Markdown 也完全可行。
|
||||
3. 提交前建议先检查改动:
|
||||
|
||||
```bash
|
||||
git status --short
|
||||
git diff -- README.md
|
||||
rg --files
|
||||
```
|
||||
|
||||
## 维护建议
|
||||
|
||||
- 一篇文档尽量只讲一个主题,方便后续检索和迁移。
|
||||
- 文件名尽量直白,优先沿用现有中文分类和命名风格。
|
||||
- 新文档优先放入已有分类目录,避免根目录堆积。
|
||||
- `.obsidian/` 仅在确实需要共享工作区配置时再提交。
|
||||
|
||||
## 说明
|
||||
|
||||
- 当前知识库主要部署和使用位置为 `bigmengya` 的 `/shumengya/mengyanote`
|
||||
- 建议与 Docker 运行目录分开维护,避免业务数据和知识资料混放
|
||||
|
||||
18
mengyanote-backend/data/mengyanote/Windows/刷新浏览器和系统DNS缓存.md
Normal file
18
mengyanote-backend/data/mengyanote/Windows/刷新浏览器和系统DNS缓存.md
Normal file
@@ -0,0 +1,18 @@
|
||||
1. 强制刷新:Ctrl+Shift+R(或 Cmd+Shift+R)。
|
||||
2. 清理站点缓存与 Service Worker:DevTools → Application → Service Workers → Unregister,然后 Clear storage。
|
||||
|
||||
在 Windows 系统中,刷新系统 DNS 缓存的命令是 `ipconfig /flushdns`。
|
||||
|
||||
### 操作步骤
|
||||
1. **以管理员身份打开命令行**:
|
||||
* 点击“开始”菜单,输入 `cmd` 或 `命令提示符`。
|
||||
* 在搜索结果中,右键点击“命令提示符”图标,选择 **“以管理员身份运行”**。
|
||||
2. **执行刷新命令**:
|
||||
* 在弹出的黑色窗口中,输入以下命令并按回车键:
|
||||
```cmd
|
||||
ipconfig /flushdns
|
||||
```
|
||||
|
||||
### 附加说明
|
||||
* **替代命令**:如果你使用的是 PowerShell,也可以输入 `Clear-DnsClientCache` 命令来达到同样的效果。
|
||||
* **验证结果**:如果想确认缓存是否已被清空,可以运行 `ipconfig /displaydns` 命令。如果返回结果为空,则表示刷新成功。
|
||||
@@ -1,3 +0,0 @@
|
||||
1. 强制刷新:Ctrl+Shift+R(或 Cmd+Shift+R)。
|
||||
2. 清理站点缓存与 Service Worker:DevTools → Application → Service Workers → Unregister,然后 Clear storage。
|
||||
3. 如果有发布流程,建议更新 public/manifest.webmanifest 或 service worker 的版本号/内容,触发刷新。
|
||||
10
mengyanote-backend/data/mengyanote/临时/cursor半价.md
Normal file
10
mengyanote-backend/data/mengyanote/临时/cursor半价.md
Normal file
@@ -0,0 +1,10 @@
|
||||
## 所谓的"半价"来源
|
||||
|
||||
|渠道|折扣|真实性|
|
||||
|---|---|---|
|
||||
|**推荐码首月半价**|✅ 首月 50% off|真实,Reddit 有分享,如 `cursor.com/referral?code=EPWK153JMKSR`|
|
||||
|**学生免费**|✅ **Pro 免费一年**|真实,教育邮箱验证即可|
|
||||
|**Startup 计划**|✅ **免费 Pro**|真实,符合条件的初创团队|
|
||||
|**年付**|✅ ~**17% off**(≈$16/月)|真实|
|
||||
|**拼车/合租**|⚠️ 半价甚至更低|灰色地带,有封号风险|
|
||||
|**第三方促销码网站**|❌ 大多无效|Cursor 官方不发公开折扣码|
|
||||
@@ -1,9 +0,0 @@
|
||||
杨耀翔/李昶佑/夏春鹏/王彤
|
||||
|
||||
电气信息学院/计算机与软件学院/计算机与软件学院/计算机与软件学院
|
||||
|
||||
202431076214/202431062440/202431061719/202431062229
|
||||
|
||||
| |
|
||||
| -------------------------------------------------- |
|
||||
| 1、周幂 西南石油大学 教师 1203212378@qq.com 17781100230 |
|
||||
58
mengyanote-backend/data/mengyanote/临时/浏览器更换默认字体.md
Normal file
58
mengyanote-backend/data/mengyanote/临时/浏览器更换默认字体.md
Normal file
@@ -0,0 +1,58 @@
|
||||
|
||||
### 1. 先安装思源黑体字体
|
||||
- 下载地址:Adobe 官网或 GitHub(Source Han Sans SC)。
|
||||
- **Windows**:双击字体文件 → 安装(或右键“安装为所有用户”)。
|
||||
- **macOS**:双击打开字体册安装。
|
||||
- **Linux**:复制到 `~/.local/share/fonts/` 并运行 `fc-cache -fv`。
|
||||
安装后重启浏览器即可在字体列表中看到。
|
||||
|
||||
---
|
||||
|
||||
### 2. Chrome / Edge / 新版 Chromium 浏览器
|
||||
1. 打开浏览器,输入地址栏:
|
||||
**`chrome://settings/fonts`**(Edge 用 `edge://settings/fonts`)
|
||||
2. 点击 **“自定义字体”**(Customize fonts)。
|
||||
3. 修改以下选项(推荐):
|
||||
- **标准字体(Standard font)**:选择 **思源黑体**(或 Noto Sans SC)
|
||||
- **无衬线字体(Sans-serif)**:选择 **思源黑体**(最重要,中文字体主要走这个)
|
||||
- **衬线字体(Serif)**:可保留默认或也改成思源宋体
|
||||
- **等宽字体(Fixed-width)**:可选改成等宽版本或保持默认
|
||||
4. 调整字体大小(推荐 16px 或以上)。
|
||||
**注意**:
|
||||
- 这个设置只影响**网页没有明确指定字体**的情况。如果网站强制用了其他字体(如微软雅黑),效果有限。
|
||||
- 想**强制所有网页**使用思源黑体,可安装扩展如“网页字体替换”或 Stylus + 自定义 CSS。
|
||||
|
||||
---
|
||||
|
||||
### 3. Firefox 火狐浏览器
|
||||
1. 打开菜单 → **设置**(或输入 `about:preferences`)。
|
||||
2. 左侧选择 **常规** → 向下找到 **语言与外观** → **字体** → 点击 **高级**。
|
||||
3. 设置:
|
||||
- **默认字体**:选择 **思源黑体**
|
||||
- **无衬线**:思源黑体
|
||||
- **衬线**:思源宋体(可选)
|
||||
- **等宽**:可选
|
||||
4. **重要**:取消勾选 **“允许页面选择自己的字体代替您的上述选择”**,这样可以强制覆盖大部分网站字体。
|
||||
**额外高级方法**(更彻底):
|
||||
- 输入 `about:config` → 搜索 `font.name.sans-serif.zh-CN`,双击修改为 `思源黑体`(或完整字体名称)。
|
||||
- 可分别设置简体(zh-CN)、繁体(zh-TW)等。
|
||||
|
||||
---
|
||||
|
||||
### 4. 如果想全局强制
|
||||
很多网站会通过 CSS 指定字体,浏览器内置设置可能不够强。推荐方案:
|
||||
- **安装 Stylus 扩展**(Chrome/Firefox 都有) → 新建样式,写入类似以下 CSS:
|
||||
```css
|
||||
* {
|
||||
font-family: "思源黑体", "Noto Sans SC", sans-serif !important;
|
||||
}
|
||||
```
|
||||
- 或使用现成扩展:“网页字体替换”等。
|
||||
|
||||
---
|
||||
|
||||
### 常见问题
|
||||
- **字体没生效**:重启浏览器,或检查系统是否正确安装了思源黑体(字体设置里能搜索到)。
|
||||
- **中英混排不协调**:思源黑体对中英文搭配较好,也可搭配系统英文字体(如 Segoe UI / San Francisco)。
|
||||
- **Chrome 较新版本**:部分 Windows 系统下会自动倾向使用 Noto/思源系列,安装字体后效果更好。
|
||||
- **移动端**:Android Chrome 可通过旗标(chrome://flags)或扩展有限调整;iOS 较难强制修改。
|
||||
@@ -1,17 +0,0 @@
|
||||
### 灵创实验室相关网站
|
||||
|
||||
#### 招新官网: [https://www.lcxm.site](https://www.lcxm.site)
|
||||
#### 灵创作品集: [https://show.lcxm.site](https://show.lcxm.site)
|
||||
#### 灵创云盘: [https://pan.lcxm.site](https://pan.lcxm.site)
|
||||
|
||||
---
|
||||
|
||||
### 📞 网盘问题联系
|
||||
|
||||
| 联系人 | QQ号码 |
|
||||
| ---- | ---------- |
|
||||
| 北冥有鱼 | 1151175089 |
|
||||
| 语棄 | 3961448694 |
|
||||
| 树萌芽 | 3205788256 |
|
||||
|
||||
> 如有网盘相关问题和需求,请联系以上负责人
|
||||
@@ -1,3 +0,0 @@
|
||||
# 🎯 灵创新媒实验室网盘
|
||||
|
||||
>⚠️ 上传文件前请遵守相应上传规则,避免文件乱放
|
||||
106
mengyanote-backend/data/mengyanote/内网穿透/NAT打洞原理文档.md
Normal file
106
mengyanote-backend/data/mengyanote/内网穿透/NAT打洞原理文档.md
Normal file
@@ -0,0 +1,106 @@
|
||||
|
||||
### 1. NAT 基本概念与类型
|
||||
**NAT(Network Address Translation,网络地址转换)** 是路由器/防火墙将内网(私有IP)数据包的源地址和端口转换为公网(公有IP)地址和端口的技术。主要用于地址复用和安全隔离。
|
||||
|
||||
根据 **RFC 3489**(STUN 协议)和 **RFC 4787/5780** 的行为分类(映射行为 + 过滤行为),NAT 分为四种主要类型(中文社区常用 NAT1~NAT4 命名):
|
||||
|
||||
- **NAT1:Full Cone NAT(全锥形 NAT / 完全圆锥型)**
|
||||
最宽松类型。
|
||||
- **映射行为**:Endpoint-Independent Mapping(端点无关映射)。同一个内网 (IP:Port) 映射到固定的公网 (IP:Port),与目标地址无关。
|
||||
- **过滤行为**:Endpoint-Independent Filtering(端点无关过滤)。一旦映射建立,**任何外部主机** 都可以向该公网 (IP:Port) 发送数据包。
|
||||
相当于“门卫不在岗”,非常开放。
|
||||
|
||||
- **NAT2:Address-Restricted Cone NAT(地址限制锥形 NAT / 受限圆锥型)**
|
||||
- **映射行为**:端点无关映射(公网端口固定)。
|
||||
- **过滤行为**:Address-Dependent Filtering(仅地址相关过滤)。只允许**之前发送过数据的外部 IP** 的数据包进入(端口不限制)。
|
||||
相当于“只认之前联系过的 IP”。
|
||||
|
||||
- **NAT3:Port-Restricted Cone NAT(端口限制锥形 NAT / 端口受限圆锥型)**
|
||||
- **映射行为**:端点无关映射(公网端口固定)。
|
||||
- **过滤行为**:Address and Port-Dependent Filtering(地址+端口相关过滤)。只允许**之前发送过数据的外部 (IP:Port)** 的数据包进入。
|
||||
家庭宽带最常见类型,限制较严格。
|
||||
|
||||
- **NAT4:Symmetric NAT(对称型 NAT)**
|
||||
最严格类型(也称 Hard NAT)。
|
||||
- **映射行为**:Endpoint-Dependent Mapping(端点相关映射)。同一个内网 (IP:Port) 向**不同目标 (IP:Port)** 发送时,会映射到**不同公网端口**。
|
||||
- **过滤行为**:通常为地址+端口相关过滤。
|
||||
P2P 直连最困难,常需端口预测或中继。
|
||||
|
||||
**开放性排序**(从易到难):NAT1 > NAT2 > NAT3 > NAT4
|
||||
**安全性排序**(从低到高):NAT1 < NAT2 < NAT3 < NAT4
|
||||
|
||||
**打洞可行性总结表**(UDP 打洞,基于常见实践):
|
||||
|
||||
| | NAT1 | NAT2 | NAT3 | NAT4 |
|
||||
|----------|------|------|------|------|
|
||||
| **NAT1** | ✅ | ✅ | ✅ | ✅ |
|
||||
| **NAT2** | ✅ | ✅ | ✅ | ✅ |
|
||||
| **NAT3** | ✅ | ✅ | ✅ | ❌(难) |
|
||||
| **NAT4** | ✅ | ✅ | ❌ | ❌(最难) |
|
||||
|
||||
(注:NAT4 组合成功率低,常需端口预测 + 多次尝试或 TURN 中继。A+B ≤ 6 的经验法则有时被提及,但实际以具体行为为准。)
|
||||
|
||||
### 2. 打洞(Hole Punching / NAT Traversal)基本原理
|
||||
打洞的核心是 **利用 NAT 的“状态保持”特性**:内网主机主动向外发送 UDP 数据包时,NAT 会创建临时映射表项(“打一个洞”),允许对应外部流量返回。
|
||||
|
||||
**经典 UDP Hole Punching 流程**(假设双方 A 和 B 都在 NAT 后,使用公网 STUN/协调服务器 S):
|
||||
|
||||
1. **发现公网映射**:A 和 B 分别向 STUN 服务器 S 发送 UDP 包,S 返回各自的公网 (IP:Port)(称为 Candidate)。
|
||||
2. **交换候选地址**:通过 S(信令通道)互相告知对方的公网 (IP:Port)。
|
||||
3. **同时打洞**:A 和 B 在极短时间内**同时向对方的公网 (IP:Port) 发送 UDP 包**。
|
||||
- 第一个包可能被对方 NAT 丢弃(因为还没建立对应状态)。
|
||||
- 但发送动作会在自己 NAT 上创建映射,允许对方后续包进入。
|
||||
4. **连接建立**:双方状态表更新后,UDP 数据可双向直连。
|
||||
|
||||
**关键点**:
|
||||
- 必须使用 **UDP**(无连接,状态易维护;TCP 打洞更复杂,需 Simultaneous Open)。
|
||||
- 需要第三方协调服务器(STUN 获取映射,ICE 框架优化候选)。
|
||||
- 如果一方是 NAT4,映射端口随目标变化,需预测端口增量或多次尝试。
|
||||
|
||||
**辅助技术**:
|
||||
- **STUN**:发现公网地址和 NAT 类型。
|
||||
- **TURN**:当打洞失败时,中继转发(Relay)。
|
||||
- **ICE**(Interactive Connectivity Establishment):WebRTC 等使用的框架,综合多种候选(主机、服务器反射、TURN)并优先直连。
|
||||
|
||||
### 3. 不同 NAT 类型组合下的打洞原理详解
|
||||
|
||||
#### 3.1 NAT1 ↔ NAT1(最简单)
|
||||
- 双方公网端口固定,且过滤宽松。
|
||||
- 交换公网地址后,任意一方发送即可建立,无需严格同时性。
|
||||
- 成功率接近 100%。
|
||||
|
||||
#### 3.2 NAT1 ↔ NAT3(或 NAT2)
|
||||
- NAT1 过滤宽松(几乎任何包都可进)。
|
||||
- NAT3 需先“见过”对方:让 NAT3 侧先向 NAT1 发送包,更新 NAT3 状态表。
|
||||
- 然后 NAT1 向 NAT3 发送,轻松通过。
|
||||
- 成功率很高。
|
||||
|
||||
#### 3.3 NAT3 ↔ NAT3(常见家庭宽带场景)
|
||||
- 双方公网端口固定,但过滤严格(需 IP+Port 匹配之前请求)。
|
||||
- **必须同时发送**:双方在毫秒级窗口内互相发送 UDP 包,各自在对方 NAT 上“打洞”。
|
||||
- 第一个包可能丢弃,但后续包因状态已建立而通过。
|
||||
- 实际中通过 ICE/STUN 多次尝试 + 定时同步实现,高成功率(90%以上)。
|
||||
|
||||
#### 3.4 涉及 NAT4 的场景(较困难)
|
||||
- **NAT1/NAT2/NAT3 ↔ NAT4**:
|
||||
- NAT4 向对方发送时,因目标不同可能换新端口。
|
||||
- 解决方案:NAT4 先向协调服务器发送获取“基础端口”,预测增量;对方尝试多个预测端口;或让非 NAT4 侧主动。
|
||||
- 常结合端口猜测(Port Prediction)。
|
||||
- **NAT4 ↔ NAT4**:
|
||||
- 最难。双方端口都随目标变化。
|
||||
- 需高级端口预测算法、多次并行尝试,或直接 fallback 到 TURN 中继。
|
||||
- 成功率低(依赖运营商 NAT 实现,有些可达 70-90%,有些几乎为 0)。
|
||||
|
||||
### 4. 实际应用与注意事项
|
||||
- **游戏联机、P2P 下载、VoIP/WebRTC**:依赖 NAT 打洞实现低延迟直连。
|
||||
- **失败处理**:打洞超时 → 切换 TURN 中继(牺牲一些延迟,但保证连通)。
|
||||
- **提升 NAT 类型方法**(可选,非打洞替代):
|
||||
- 路由器开启 UPnP 或手动端口映射。
|
||||
- 部分运营商支持 DMZ 或桥接模式。
|
||||
- 使用支持 NAT 优化的 VPN(如某些 P2P VPN)。
|
||||
- **当前现状(2026 年)**:家庭宽带多为 NAT3;运营商 CGNAT(大 NAT4)增多,打洞难度上升;ICE + TURN 仍是主流保底方案。
|
||||
|
||||
### 5. 参考与扩展
|
||||
- RFC 3489(STUN)、RFC 4787(NAT 行为)、RFC 5780(NAT 类型检测)。
|
||||
- 常见实现:WebRTC(ICE)、libp2p、各种 P2P VPN。
|
||||
- 实战建议:使用 STUN 服务器测试自身 NAT 类型(如 stun.l.google.com:19302),然后观察打洞日志。
|
||||
47
mengyanote-backend/data/mengyanote/前后端项目env环境配置解析.md
Normal file
47
mengyanote-backend/data/mengyanote/前后端项目env环境配置解析.md
Normal file
@@ -0,0 +1,47 @@
|
||||
|
||||
## 一、文件类型与用途
|
||||
|
||||
| 文件 | 用途 | 提交Git |
|
||||
|------|------|----------|
|
||||
| `.env.example` | 配置模板,含占位符 | ✅ 是 |
|
||||
| `.env` | 基础默认配置 | ❌ 否 |
|
||||
| `.env.development` | 开发环境配置 | ✅ 是 |
|
||||
| `.env.production` | 生产环境配置 | ✅ 是 |
|
||||
| `.env.test` | 测试环境配置 | ✅ 是 |
|
||||
| `.env.local` | 本地个人覆盖 | ❌ 否 |
|
||||
| `.env.development.local` | 开发环境本地覆盖 | ❌ 否 |
|
||||
| `.env.branch.<name>` | 特定分支配置(可选) | ❌ 否 |
|
||||
|
||||
## 二、加载优先级(从低到高)
|
||||
系统环境变量 > .env.local > .env.[mode].local > .env.[mode] > .env
|
||||
> 同名变量:高优先级覆盖低优先级
|
||||
## 三、各框架差异速查
|
||||
|
||||
| 框架 | 客户端变量前缀 | 特殊文件 |
|
||||
|------|---------------|----------|
|
||||
| Next.js | `NEXT_PUBLIC_` | `.env.production.local` |
|
||||
| Vite | `VITE_` | 无 |
|
||||
| Laravel | 无(仅服务端) | `.env.testing` |
|
||||
| Spring Boot | 需第三方库 | 配合 `application.yml` |
|
||||
|
||||
## 四、核心规则
|
||||
1. **敏感信息不进Git** — 密钥、密码、Token 只放 `.gitignore` 涵盖的文件
|
||||
2. **变量值默认为字符串** — 布尔/数字按字符串解析,框架可能有特殊处理
|
||||
3. **客户端暴露需前缀** — 浏览器可访问的变量必须加特定前缀(如 `VITE_`、`NEXT_PUBLIC_`)
|
||||
|
||||
## 五、示例文件结构
|
||||
project/
|
||||
├── .env.example # DB_HOST=localhost
|
||||
├── .env # 实际配置(git ignored)
|
||||
├── .env.development # API_URL=http://dev.api
|
||||
├── .env.production # API_URL=https://api.com
|
||||
├── .env.local # 个人覆盖(git ignored)
|
||||
└── .gitignore # 包含 .env, *.local
|
||||
## 六、常见反模式
|
||||
|
||||
| ❌ 错误做法 | ✅ 正确做法 |
|
||||
|------------|------------|
|
||||
| 将 `.env` 提交到 Git | 只提交 `.env.example` |
|
||||
| 硬编码变量在代码中 | 通过环境变量读取 |
|
||||
| 所有环境共用一个文件 | 按环境拆分文件 |
|
||||
| 不设默认值 | `.env.example` 提供占位符 |
|
||||
205
mengyanote-backend/data/mengyanote/博客文章/Markdown 渲染格式大全.md
Normal file
205
mengyanote-backend/data/mengyanote/博客文章/Markdown 渲染格式大全.md
Normal file
@@ -0,0 +1,205 @@
|
||||
|
||||
# Markdown 渲染格式大全
|
||||
|
||||
## 1. 基础文本格式
|
||||
|
||||
*斜体* 或 _斜体_
|
||||
**粗体** 或 __粗体__
|
||||
***粗斜体*** 或 ___粗斜体___
|
||||
~~删除线~~
|
||||
<u>下划线(使用 HTML)</u>
|
||||
==高亮标记== (部分渲染器支持)
|
||||
H~2~O (下标)
|
||||
X^2^ (上标)
|
||||
|
||||
## 2. 标题(1-6级)
|
||||
|
||||
# H1
|
||||
## H2
|
||||
### H3
|
||||
#### H4
|
||||
##### H5
|
||||
###### H6
|
||||
|
||||
## 3. 列表
|
||||
|
||||
### 无序列表
|
||||
- 项目 1
|
||||
- 嵌套项目 1.1
|
||||
* 第三层(可用 * + -)
|
||||
+ 项目 2
|
||||
* 项目 3
|
||||
|
||||
### 有序列表
|
||||
1. 第一项
|
||||
2. 第二项
|
||||
3. 嵌套 2.1
|
||||
4. 嵌套 2.2
|
||||
5. 第三项
|
||||
|
||||
### 任务列表
|
||||
- [x] 已完成任务
|
||||
- [ ] 未完成任务
|
||||
- [ ] 子任务 [优先级高]
|
||||
|
||||
## 4. 链接与图片
|
||||
|
||||
[普通链接](https://example.com)
|
||||
[带标题的链接](https://example.com "鼠标悬停显示")
|
||||
<https://自动链接.com>
|
||||
|
||||

|
||||
|
||||
## 5. 引用
|
||||
|
||||
> 这是一级引用
|
||||
>> 嵌套引用
|
||||
>>> 三级引用
|
||||
>
|
||||
> 回到一级
|
||||
|
||||
## 6. 代码
|
||||
|
||||
行内代码:`console.log("Hello");`
|
||||
|
||||
代码块(带语法高亮):
|
||||
```javascript
|
||||
function greet(name) {
|
||||
return `Hello, ${name}!`;
|
||||
}
|
||||
```
|
||||
|
||||
## 7. 表格
|
||||
|
||||
| 左对齐 | 居中对齐 | 右对齐 |
|
||||
|:-------|:--------:|-------:|
|
||||
| 单元格1 | 单元格2 | 单元格3 |
|
||||
| *斜体* | **粗体** | `代码` |
|
||||
|
||||
复杂表格(HTML 方式,见第14节)
|
||||
|
||||
## 8. 分割线
|
||||
|
||||
---
|
||||
|
||||
***
|
||||
|
||||
___
|
||||
|
||||
## 9. 脚注
|
||||
|
||||
这是带脚注的句子[^1]
|
||||
[^1]: 脚注内容可以写在这里,甚至多段。
|
||||
|
||||
## 10. 转义字符
|
||||
|
||||
\*这不是斜体\*
|
||||
\# 不是标题
|
||||
\[非链接\]
|
||||
|
||||
## 11. 定义列表(部分渲染器支持)
|
||||
|
||||
: 定义内容
|
||||
|
||||
## 12. 数学公式(需要 LaTeX 渲染)
|
||||
|
||||
行内公式:$E = mc^2$
|
||||
|
||||
块级公式:
|
||||
$$
|
||||
\int_{a}^{b} f(x) \, dx = F(b) - F(a)
|
||||
$$
|
||||
|
||||
## 13. 图表与流程图(Mermaid)
|
||||
|
||||
```mermaid
|
||||
graph TD
|
||||
A[开始] --> B{条件}
|
||||
B -->|是| C[执行]
|
||||
B -->|否| D[结束]
|
||||
```
|
||||
|
||||
## 14. 嵌入 HTML(无所不能!)
|
||||
|
||||
### 14.1 基础 HTML 标签
|
||||
<mark>高亮标记</mark>
|
||||
<kbd>Ctrl</kbd> + <kbd>C</kbd>
|
||||
<span style="color: red;">彩色文字</span>
|
||||
<div align="center">居中的 div</div>
|
||||
|
||||
### 14.2 表格增强
|
||||
<table>
|
||||
<tr>
|
||||
<th colspan="2">合并单元格</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td rowspan="2">行合并</td>
|
||||
<td>内容</td>
|
||||
</tr>
|
||||
<tr><td>另一行</td></tr>
|
||||
</table>
|
||||
|
||||
### 14.3 嵌入视频 / 音频
|
||||
|
||||
|
||||
### 14.4 嵌入 YouTube 视频
|
||||
<iframe width="560" height="315" src="https://www.youtube.com/embed/dQw4w9WgXcQ" frameborder="0" allowfullscreen></iframe>
|
||||
|
||||
### 14.5 自定义样式(甚至 CSS)
|
||||
<style>
|
||||
.markdown-demo {
|
||||
background: #f0f0f0;
|
||||
padding: 10px;
|
||||
border-radius: 8px;
|
||||
}
|
||||
</style>
|
||||
<div class="markdown-demo">
|
||||
这是一个带样式的盒子
|
||||
</div>
|
||||
|
||||
### 14.6 嵌入 SVG
|
||||
<svg width="100" height="100">
|
||||
<circle cx="50" cy="50" r="40" stroke="black" stroke-width="2" fill="red" />
|
||||
</svg>
|
||||
|
||||
### 14.7 表单元素
|
||||
<input type="text" placeholder="文本框" />
|
||||
<button onclick="alert('Hi')">点我</button>
|
||||
|
||||
### 14.8 进度条、输入框等
|
||||
<progress value="70" max="100">70%</progress>
|
||||
<meter value="0.6">60%</meter>
|
||||
|
||||
## 15. 注解与评论(仅部分支持)
|
||||
|
||||
[//]: # (这是注释,不会显示)
|
||||
|
||||
<!-- 这也是 HTML 注释,完全隐藏 -->
|
||||
|
||||
## 16. 特殊技巧
|
||||
|
||||
### 16.1 避免嵌套冲突(用反斜杠或HTML包裹)
|
||||
`<div>` 原样显示
|
||||
|
||||
### 16.2 内联 HTML + Markdown 混用(需要渲染器支持)
|
||||
<span style="font-weight:bold">**粗体** 也能用</span>
|
||||
|
||||
### 16.3 锚点跳转
|
||||
[跳转到表格](#7-表格)
|
||||
|
||||
### 16.4 键盘按键样式(HTML)
|
||||
<kbd>Ctrl</kbd> + <kbd>Alt</kbd> + <kbd>Del</kbd>
|
||||
|
||||
### 16.5 缩写(HTML)
|
||||
<abbr title="Cascading Style Sheets">CSS</abbr> 是样式语言。
|
||||
|
||||
## 17. 完整示例:一个带 HTML 的复杂卡片
|
||||
|
||||
<div style="border: 1px solid #ccc; border-radius: 8px; padding: 16px; max-width: 300px;">
|
||||
<img src="https://picsum.photos/100/100" style="border-radius: 50%;" />
|
||||
<h3 style="margin: 8px 0;">Markdown 用户</h3>
|
||||
<p>支持 <strong>粗体</strong> 和 <em>斜体</em> 以及 <code>代码</code>。</p>
|
||||
<button onclick="alert('Hello from Markdown + HTML')">打招呼</button>
|
||||
</div>
|
||||
|
||||
---
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user