[Feature] Add 'Copy as' (Markdown / HTML / Rich Text) to the block menu · Issue #5808 · marktext/marktext · GitHub
Skip to content

[Feature] Add 'Copy as' (Markdown / HTML / Rich Text) to the block menu #5808

Open

Description

@guidona

Summary

Add a Copy as ▸ submenu to the block handle (⋮⋮) menu, offering Markdown, HTML and Rich Text, so any block (table, code block, math, quote, list, paragraph…) can be copied in one click.

Problem it solves

The block menu can already Duplicate and Delete a block, but it can't copy one. Copying a whole block today means selecting it by hand first and then using Ctrl+C or Edit → Copy As …. For a table, that means dragging across the cells and pressing Ctrl+A to extend the selection to the whole table, which is hard to discover. For other blocks you have to drag precisely from the first character to the last.

Proposed solution

⋮⋮  ┌──────────────────────────┐
    │ Turn into            ▸   │
    │ ──────────────────────── │
    │ Duplicate                │
    │ Copy as              ▸   │ → Markdown / HTML / Rich Text
    │ New Paragraph            │
    │ Delete                   │
    └──────────────────────────┘

Choosing a format selects the block and runs the existing copy path:

  • Markdown: clipboard.copyAsMarkdown(), which puts the block's Markdown on the clipboard.
  • HTML: clipboard.copyAsHtml(), the same as Edit → Copy As HTML.
  • Rich Text: clipboard.copyAsRich(), the same as Edit → Copy As Rich Text, which pastes formatted into Word, email or Sheets.

No new serialization is needed. Tables already copy as a full GFM table once they're fully selected (selection.table.selectTable(table), then getTableSelectionClipboardData). The submenu can reuse the existing "Turn into ▸" submenu rendering in paragraphFrontMenu. The "Copy As HTML" and "Copy As Rich Text" labels already exist in the locales, so only "Copy as" and "Markdown" are new.

Front matter can be excluded or included. I'm happy to follow your preference.

I'm happy to implement this. Does this placement and scope work for you?

Alternatives considered

  • A Copy button on the table toolbar only. That's narrower, would add an extra button to the table UI, and doesn't help other block types.
  • Doing nothing. Select + Ctrl+A + Ctrl+C / Edit → Copy As … works, but it's hard to discover, especially for tables.

Activity

  1. changed the title [-][Feature] Copy table and delete table actions on the table toolbar[/-] [+][Feature] Copy whole table to clipboard as Markdown[/+] on Oct 20, 2026
  2. changed the title [-][Feature] Copy whole table to clipboard as Markdown[/-] [+][Feature] Add 'Copy as' (Markdown / HTML / Rich Text) to the block menu[/+] on Oct 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions