omnivore-app / omnivore

Omnivore is a complete, open source read-it-later solution for people who like reading.
https://omnivore.app
GNU Affero General Public License v3.0
14.03k stars 1.03k forks source link

Support CodeMirror blocks #2535

Open akrawchyk opened 1 year ago

akrawchyk commented 1 year ago

I'm creating this issue intending it as a feature request. I'm trying to save articles from Google Cloud Blog and there are code blocks that use CodeMirror for display. When I add this link with Omnivore, the code isn't included, see screenshots below. It would be nice to be able to save the code as a markdown code block.

Omnivore:

Pasted image 20230724184821

Google Cloud Blog:

Pasted image 20230724185035

tcoopman commented 1 year ago

Code blocks on the fly.io blog are also sometimes not visible, not sure if this needs an other issue? For example this blog: https://fly.io/phoenix-files/streaming-uploads-with-liveview/ the first <input type=file /> is not to be seen, but other code blocks are.

jacksonh commented 1 year ago

Thanks, looks like the have class="highlight " not sure if they are using highlightjs like us or something else.

Code that should display:

<pre class="highlight "><code><span class="n">consume_uploaded_entries</span><span class="p">(</span><span class="n">socket</span><span class="p">,</span> <span class="ss">:avatar</span><span class="p">,</span> <span class="k">fn</span> <span class="p">%{</span><span class="ss">path:</span> <span class="n">path</span><span class="p">},</span> <span class="n">_entry</span> <span class="o">-&gt;</span>
  <span class="n">dest</span> <span class="o">=</span> <span class="no">Path</span><span class="o">.</span><span class="n">join</span><span class="p">([</span><span class="ss">:code</span><span class="o">.</span><span class="n">priv_dir</span><span class="p">(</span><span class="ss">:my_app</span><span class="p">),</span> <span class="s2">"static"</span><span class="p">,</span> <span class="s2">"uploads"</span><span class="p">,</span> <span class="no">Path</span><span class="o">.</span><span class="n">basename</span><span class="p">(</span><span class="n">path</span><span class="p">)])</span>
  <span class="no">File</span><span class="o">.</span><span class="n">cp!</span><span class="p">(</span><span class="n">path</span><span class="p">,</span> <span class="n">dest</span><span class="p">)</span> <span class="p">{</span><span class="ss">:ok</span><span class="p">,</span> <span class="sx">~p"/uploads/{Path.basename(dest)}"</span><span class="p">}</span>
<span class="k">end</span><span class="p">)</span>
</code></pre>
tcoopman commented 1 year ago

@jacksonh I've looked into it a bit more, it's strange that only the first instance of the highlight is not visible in omnivore, but the others are. I don't see any reason for that immediately