Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions content/blog/2026-05-11-vsc-open-in-integrated-browser/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ contributors:
- "nevstop-lab"
---

> 本文根据知乎专栏原文补充细节并整理为站点版本。
> 原文链接:https://zhuanlan.zhihu.com/p/2037600105537201607

最近脑子里转着一个问题:**AI 时代,文档该用什么格式写?**

## 先扯两句背景:HTML 会是比 Markdown 更好的文档格式吗?
Expand Down Expand Up @@ -53,6 +56,35 @@ HTML 这边的论据是:语义结构更丰富、更精确。`<h1>` 就是主

装进 VSCode 测了一下,右键 `.html`,Simple Browser 弹出来,完事。

## 再展开一点:这个插件到底做了什么?

如果只看效果,它只是右键多了一个菜单项;但从实现上看,关键点有几个:

1. **统一入口**:Explorer 文件右键、编辑器 Tab 右键、编辑区上下文菜单都挂同一个命令 `openInIntegratedBrowser.open`,避免多处实现分叉。
2. **调用内置能力**:优先走 VSCode 的 `simpleBrowser.api.open`,在不可用场景再回退 `vscode.open`,保证行为稳定。
3. **可配置扩展名**:通过 `openInIntegratedBrowser.extensions` 控制菜单出现条件,不把文件类型写死在代码里。
4. **本地化文案**:命令标题和菜单文案同时提供中文与英文,避免只适配单语言环境。

这几个点看起来简单,但基本覆盖了一个“小而完整”插件该有的骨架:可用、可配、可维护。

## 配置示例

默认支持扩展名:

```text
html, htm, pdf, xml, xsl, txt, md
```

如果你想只保留自己常用的类型,可以在 `settings.json` 里改成:

```json
{
"openInIntegratedBrowser.extensions": ["html", "htm", "pdf", "svg", "md"]
}
```

这样右键菜单会更干净,减少无关文件上的干扰。

## 有一点要说实话

如果你从没发布过 VSCode 插件,光是搞清楚发布流程(注册 Azure DevOps 账号、生成 PAT、用 `vsce` 打包上传)可能就要花不少时间——不难,但第一次总要摸索一遍。
Expand All @@ -61,8 +93,11 @@ HTML 这边的论据是:语义结构更丰富、更精确。`<h1>` 就是主

## 插件信息

![Open in Integrated Browser 插件图标](plugin-icon.png)

**🌐 Open in Integrated Browser**
[![GitHub](https://img.shields.io/badge/GitHub-vsc--open--in--integrated--browser-blue)](https://github.com/NEVSTOP-LAB/vsc-open-in-integrated-browser)
[![VS Code Marketplace](https://img.shields.io/visual-studio-marketplace/v/NEVSTOP-LAB.open-in-integrated-browser?label=Marketplace)](https://marketplace.visualstudio.com/items?itemName=NEVSTOP-LAB.open-in-integrated-browser)

本文的主角。右键任意支持的文件,直接在 VSCode 内置 Simple Browser 里打开。支持的扩展名可以自己配,默认有 `html`、`htm`、`pdf`、`xml`、`xsl`、`txt`、`md`。你要是也在试 HTML 文档这条路,装上可以省不少麻烦。

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading