Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Miniflux reader removes certain spans from code blocks #2698

Open
JohnnyJayJay opened this issue Jun 19, 2024 · 2 comments
Open

Miniflux reader removes certain spans from code blocks #2698

JohnnyJayJay opened this issue Jun 19, 2024 · 2 comments
Labels

Comments

@JohnnyJayJay
Copy link
Contributor

Miniflux removes certain elements from pre blocks, for some reason.

For example, in one of my posts, I have the following HTML:

<pre><code class="bash hljs language-bash">$ ( <span class="hljs-built_in">set</span> -e; <span class="hljs-literal">false</span>; <span class="hljs-built_in">echo</span> hello ) <span class="hljs-comment"># exit 1</span>
$ <span class="hljs-keyword">if</span> ( <span class="hljs-built_in">set</span> -e; <span class="hljs-literal">false</span>; <span class="hljs-built_in">echo</span> hello ) ; <span class="hljs-keyword">then</span> <span class="hljs-built_in">echo</span> world ; <span class="hljs-keyword">fi</span> <span class="hljs-comment"># exit 0</span>
hello
world
</code></pre>

(This is the highlight.js output for this code block):

$ ( set -e; false; echo hello ) # exit 1
$ if ( set -e; false; echo hello ) ; then echo world ; fi # exit 0
hello
world

I would expect Miniflux to display all text from that pre in its reader. But it doesn't, it removes the spans that use the hljs-comment class, so it ends up looking like this in the reader:

$ ( set -e; false; echo hello ) 
$ if ( set -e; false; echo hello ) ; then echo world ; fi 
hello
world

Is this intended behaviour? If not, why could this be? What part of the code filters out spans with that class?

I'm running Miniflux via docker-compose, latest image tag (I pulled the latest version right before writing this).

@fguillot
Copy link
Member

The sanitizer doesn't preserve the <div> and <span> elements. However, the # exit 1 should not have been removed. That needs to be investigated.

@JohnnyJayJay
Copy link
Contributor Author

JohnnyJayJay commented Jun 23, 2024

The sanitiser is not responsible - I tested it when creating my recent PR. Something else removes the text in those spans (either before, or after calling Sanitize)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants