Skip to content
| Marketplace
Sign in
Visual Studio Code>Formatters>Markdown to OneNote (Rich Text)New to Visual Studio Code? Get it now.
Markdown to OneNote (Rich Text)

Markdown to OneNote (Rich Text)

h1nseas0n

|
3 installs
| (0) | Free
Convert Markdown files, selections, or clipboard text into OneNote-optimized rich text (preserving syntax-highlighted code boxes, tables, local images, and inline math).
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Markdown to OneNote (Rich Text)

Visual Studio Marketplace Installs Latest Release Downloads License: MIT

English · 中文 · 🛒 Install from Marketplace · 📦 Download Latest .vsix

Convert Markdown documents, editor selections, or clipboard text in VS Code into OneNote Desktop-optimized rich text (CF_HTML) with one click. Runs 100% locally and offline—no administrator privileges or external tools required. Menus, commands, and notifications automatically follow your VS Code display language (English and 简体中文).

Demo: copy Markdown in VS Code and paste it into OneNote

Key Features

  • Boxed Syntax-Highlighted Code Blocks: Wraps fenced code blocks in a 1×1 light-gray table cell (solving OneNote's limitation of stripping <pre> backgrounds) with built-in highlight.js inline syntax highlighting and Consolas + Microsoft YaHei hybrid fonts.
  • Local Image Resolution & Auto-Scaling: Resolves relative image paths (e.g., image/xxx.png) and VS Code preview URLs into local file:/// URIs, proportionally scaling oversized images down to 760px (configurable via md2onenote.maxImageWidth).
  • Styled Tables & Blockquote Callouts: Renders clean borders, header shading, and zebra striping for Markdown tables; converts > blockquotes into light-blue callout boxes.
  • Inline Math & Task Lists: Formats common inline math expressions (such as $O(N)$, $B \ll N$, superscripts, and subscripts) and - [ ] / - [x] checkboxes, while preventing OneNote from tinting list bullets with inline code/bold styles.
  • Mermaid Diagrams as Images: Renders ```mermaid blocks to high-resolution PNG images (via mermaid-cli) and embeds them as pictures, matching VS Code's Markdown Preview. Uses your locally installed Edge or Chrome — no bundled browser. If rendering fails, the source block is preserved as a fallback.
  • Clean Paste Without Source Footer: Generates UTF-8 CF_HTML without SourceURL, so OneNote will not append From: file:///... at the bottom.

Usage

  1. Editor Title Bar Button: Open any .md file and click the purple OneNote icon in the top-right editor toolbar.
  2. Copy Selection or Full Document: Select any section in a .md editor (or leave unselected for the entire file) -> Right-click -> Copy to OneNote (Rich Text).
  3. Keyboard Shortcut: Press Ctrl + Alt + C (Cmd + Alt + C on macOS) inside a .md editor.
  4. Explorer Context Menu: Right-click any .md file in the Explorer sidebar -> Copy to OneNote (Rich Text).
  5. Convert Clipboard Markdown: Open the Command Palette (Ctrl + Shift + P) and run Markdown -> OneNote: Convert Clipboard Markdown to Rich Text.

Then switch to OneNote and press Ctrl + V to paste.

Configuration

Setting Default Description
md2onenote.maxImageWidth 760 Maximum width (in pixels) for local images when pasting into OneNote. Larger images are scaled down proportionally.

Installation & Development

  • Install from Marketplace: Open the Extensions view (Ctrl + Shift + X), search for Markdown to OneNote (Rich Text), then click Install — or open the Marketplace page.
  • Install from VSIX: Download the latest .vsix from GitHub Releases, then open Extensions (Ctrl + Shift + X) -> ... -> Install from VSIX... and select the file.
  • Build & Package:
    npm test          # Run unit tests
    npm run package   # Bundle and package into .vsix
    
  • Automated Release (GitHub Actions): Push a version tag (e.g. git tag v1.0.7 && git push --tags) or trigger the Release VSIX workflow in GitHub Actions to automatically build the .vsix, attach it to a new GitHub Release, and publish to the VS Code Marketplace via Trusted Publishing (OIDC).


Markdown to OneNote (富文本复制)

Visual Studio Marketplace Installs Latest Release Downloads License: MIT

English · 中文 · 🛒 从扩展市场安装 · 📦 下载最新 .vsix 安装包

一键将 VS Code 中的 Markdown 文档、选中片段或剪贴板文本转换为专为 Windows 桌面版 OneNote 优化的富文本(CF_HTML)。纯本地离线转换,无需管理员权限,无需安装第三方外部工具。插件菜单、命令与提示信息自动跟随 VS Code 界面语言(支持 English 与 简体中文)。

演示:在 VS Code 中复制 Markdown,粘贴到 OneNote

核心特性

  • 代码块完美带框高亮:自动将代码块包裹为 1×1 浅灰底色单格表格(解决 OneNote 吞 <pre> 背景色的痛点),内置 highlight.js 内联语法高亮,采用 Consolas + Microsoft YaHei 混排字体(代码等宽、中文注释清晰)。
  • 本地图片自动解析与自适应缩放:支持相对路径(如 image/xxx.png)与 VS Code 预览路径,自动转为本地 file:/// 链接,超宽大图自动等比缩放到 760px(可在设置中调整 md2onenote.maxImageWidth)。
  • 数据表格 & 引用提示框:自动渲染清晰细边框、浅灰表头与斑马纹;> 引用 自动转换为浅蓝底色提示框。
  • 行内公式与任务列表美化:自动美化 $O(N)$、$B \ll N$ 等常见数学符号与上下标,支持 - [ ] / - [x] 任务复选框,并修复 OneNote 列表项目符号被行内样式染色的问题。
  • Mermaid 图表转图片:自动把 ```mermaid 代码块渲染为高清 PNG 图片并作为图片嵌入,效果与 VS Code Markdown 预览一致。渲染使用本机已安装的 Edge 或 Chrome,不捆绑浏览器;若渲染失败则回退为源码框。
  • 干净无来源尾巴:生成的 UTF-8 CF_HTML 不附带 SourceURL,粘贴到 OneNote 不会出现烦人的 来自: file:///...。

使用方式

  1. 编辑器右上角按钮:打开任意 .md 文件,点击右上角紫色的 OneNote 图标按钮。
  2. 局部选中或全文复制:在 .md 编辑器中框选任意段落/表格/代码(未选中时默认复制全文) -> 右键 -> 复制到 OneNote (富文本)。
  3. 快捷键:在 .md 文件中按 Ctrl + Alt + C(macOS 为 Cmd + Alt + C)。
  4. 资源管理器右键:在左侧文件树直接右键 .md 文件 -> 复制到 OneNote (富文本)。
  5. 转换剪贴板文本:按 Ctrl + Shift + P 执行 Markdown -> OneNote: 转换剪贴板中的 Markdown 为富文本。

完成后直接切到 OneNote 按 Ctrl + V 即可粘贴。

配置项

配置名 默认值 说明
md2onenote.maxImageWidth 760 粘贴到 OneNote 时的本地图片最大宽度(像素),超出将等比缩放以避免撑破页面。

安装与开发

  • 从扩展市场安装:打开 扩展 (Ctrl + Shift + X),搜索 Markdown to OneNote,点击 安装;或直接打开市场页面。
  • 从 VSIX 安装:前往 GitHub Releases 下载最新 .vsix 文件,打开 VS Code 扩展 (Ctrl + Shift + X) -> 右上角 ... -> 从 VSIX 安装... 即可。
  • 构建与打包:
    npm test          # 运行单元测试
    npm run package   # 编译并打包生成 .vsix
    
  • 自动发版(GitHub Actions):推送版本标签(例如 git tag v1.0.7 && git push --tags)或在 GitHub Actions 页面手动触发 Release VSIX 工作流,即可自动编译打包、发布 GitHub Release,并通过 Trusted Publishing (OIDC) 同步上架 VS Code 扩展市场。

↑ Back to English

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
  • Your Privacy Choices
  • Consumer Health Privacy
© 2026 Microsoft