0x6b / copy-selection-as-markdown

Firefox add-on to copy selection as Markdown
https://addons.mozilla.org/en-US/firefox/addon/copy-selection-as-markdown/
MIT License
190 stars 14 forks source link

<pre> is not converted to ``` #77

Open alexanderadam opened 4 years ago

alexanderadam commented 4 years ago

Actual Result

  1. Go to https://atom.io/packages/markdown-table-calc
  2. Copy the description
  3. Paste it somewhere
| Column A | Column B | Column C |

|:---------|:---------|:---------|

| 123      | 456      | 789      |

| 0        | 0        | 0        |

&lt;!--TBLFM C2=A1+A2; C1=56*78/4 --&gt;

Copying with copy selection as markdown

Expected Result

```
| Column A | Column B | Column C |
|:---------|:---------|:---------|
| 123      | 456      | 789      |
| 0        | 0        | 0        |
<!--TBLFM C2=A1+A2; C1=56*78/4 -->
```

PS: I'm not sure but is the < vs &lt; thingy also a bug or expected? Because I have the option Replace angle brackets (<>) with HTML entities disabled and it still shows up as HTML entities.

PPS:

This is the underlying HTML in case the page is removed someday (Click to show code) ```html
| Column A | Column B | Column C |
|:---------|:---------|:---------|
| 123      | 456      | 789      |
| 0        | 0        | 0        |
<!--TBLFM C2=A1+A2; C1=56*78/4 -->
```
0x6b commented 4 years ago

@alexanderadam: appreciate your efforts to report this. It's interesting. At this moment Turndown treats only <pre><code>...</code></pre> as code block. Let me see how I can address your use case, but due to my recent situation it'll take some time. Thanks!

alexanderadam commented 4 years ago

due to my recent situation it'll take some time

that's absolutely no problem! Always keep in mind that time outside of FOSS projects and your health are most important, too! So really no pressure on that.

lamyergeier commented 3 years ago

@0x6b I observed same behaviour in Managing Logging in Systemd - Selectel Blog. pre tag is not getting parsed!

This Chome extension: https://chrome.google.com/webstore/detail/copy-as-markdown/dgoenpnkphkichnohepecnmpmihnabdg, successfully is able to parse it. Github: JohnnyFee/CopyAsMarkdown: This is a Chrome Extension used to copy the element in current page as markdown format.

Just wanted to let you know if you wanted to see how they have implemented it.