I would like it so that when a user selects the text of a list <ul>
on a page, it copies it as markdown list with - im a list item
hyphenated lines. Likewise, I would like for definition lists <dl>
to be copied as - term: definition
, while they might be styled like this:
ul {
list-style-type: none;
display: flex;
}
li {
padding: 10px;
}
<ul>
<li>a</li>
<li>b</li>
<li>c</li>
<li>d</li>
</ul>
<dl>
<dt>foo</dt>
<dd>bar</dd>
<dt>hello</dt>
<dd>world</dd>
</dl>
Wondering what needs to be done to get it to copy/paste as this:
- a
- b
- c
- d
- foo: bar
- hello: world
Without writing a whole bunch of JavaScript.