Support pasting more HTML elements

Open
#67 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
25/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
html, javascript, markdown
Domain
frontend

Research direction

Review the html-to-markdown spike and the linked Google Doc test cases first. Compare existing paste-markdown behavior with the listed HTML elements and define coverage for headings, code, emphasis, lists, and quotes; done means those clipboard inputs produce the intended Markdown without regressing existing special cases.

Written by the indexing model from the issue text.

Description

This was originally an issue by @imjohnbo in github/special-projects, a private repository:

Summary

Today, content is pasted into GitHub comments (issues, PRs, discussions, etc) as plaintext, except for a few special cases managed by @github/paste-markdown.

It's a laborious process to add formatting and links of the copy source back into the paste target. For example:

  • Copying/pasting part of a GitHub comment into a GitHub comment box – maybe in a different issue – in order to reply to it
  • Copying/pasting part of a Google Doc shared with a customer into a GitHub comment box in order to add context to it
  • ...

This issue would build on https://github.com/github/special-projects/issues/679 and investigate adding Slack-like paste functionality for the features GitHub developers care about, including:

name html markdown
headings <h1>, <h2>... #, ##, etc.
inline code <code> `code`
code block <pre><code> ```code```
bold <strong> **bold**
italics <em> *italics*
ordered lists <ol><li> 1. item
unordered lists <ul><li> - item
task lists ? - [x] completed item
quotes blockquote > a long quote

Example

This Google Doc:

is pasted as:

Big Heading
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris eleifend consectetur nisl, vel vestibulum odio mattis sit amet. Integer vehicula rhoncus augue, eu congue magna porttitor eget.
Medium Heading
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris eleifend consectetur nisl, vel vestibulum odio mattis sit amet. Integer vehicula rhoncus augue, eu congue magna porttitor eget.
Small Heading
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris eleifend consectetur nisl, vel vestibulum odio mattis sit amet. Integer vehicula rhoncus augue, eu congue magna porttitor eget.

when I would like it to be:

# Big Heading
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris eleifend consectetur nisl, vel vestibulum odio mattis sit amet. Integer vehicula rhoncus augue, eu congue magna porttitor eget.
## Medium Heading
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris eleifend consectetur nisl, vel vestibulum odio mattis sit amet. Integer vehicula rhoncus augue, eu congue magna porttitor eget.
### Small Heading
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris eleifend consectetur nisl, vel vestibulum odio mattis sit amet. Integer vehicula rhoncus augue, eu congue magna porttitor eget.

Spike

I started a spike over the weekend which allows for this:

paste

Other

Dominant language
JavaScript
Stars
234
Forks
47
Avg merge
1d 12h
Merged PRs (30d)
5

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from github/paste-markdown

All issues in github/paste-markdown

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.