Forum Replies Created

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter ingax

    (@ingax)

    I changed the problem page to a default code block for now. I’ll continue to dig through the code to see what’s going on. Thanks for your help!

    Thread Starter ingax

    (@ingax)

    The images started showing for me as well. It might have been a cache issue.

    After having escaping enabled for some time, I noticed another problem. All of my previous posts written prior to enabling escaping all have improperly encoded text.

    I turned escaping off because all of my posts display the code properly, except for this one: https://ingax.com/decoding-a-secret-message/

    Some cases are worse than others. In most cases, only the “->” are encoded improperly. In one case, it’s really bad.

    https://ingax.com/daily-coding-problem-61-asked-by-google/

    
    <span class="token keyword">func</span> <span class="token function">pow</span><span class="token punctuation">(</span><span class="token number">_</span> x <span class="token punctuation">:</span> <span class="token builtin">Int</span><span class="token punctuation">,</span> <span class="token number">_</span> y <span class="token punctuation">:</span> <span class="token builtin">Int</span><span class="token punctuation">)</span> <span class="token operator">-</span><span class="token operator">></span> <span class="token builtin">Int</span> <span class="token punctuation">{</span>
      <span class="token keyword">if</span> y <span class="token operator">==</span> <span class="token number">0</span> <span class="token punctuation">{</span> <span class="token keyword">return</span> <span class="token number">1</span> <span class="token punctuation">}</span>
      <span class="token keyword">let</span> power<span class="token punctuation">:</span> <span class="token builtin">Int</span> <span class="token operator">=</span> <span class="token function">pow</span><span class="token punctuation">(</span>x<span class="token punctuation">,</span> y<span class="token operator">/</span><span class="token number">2</span><span class="token punctuation">)</span>
      <span class="token keyword">return</span> y <span class="token operator">%</span> <span class="token number">2</span> <span class="token operator">!=</span> <span class="token number">0</span> <span class="token operator">?</span> <span class="token punctuation">(</span>x <span class="token operator">*</span> power <span class="token operator">*</span> power<span class="token punctuation">)</span> <span class="token punctuation">:</span> <span class="token punctuation">(</span>power <span class="token operator">*</span> power<span class="token punctuation">)</span>
    <span class="token punctuation">}</span>
    

    So back to my initial question. Why is this one snippet of code causing problems? Is it the closures I wrote?

    Thank you!
    David

    Thread Starter ingax

    (@ingax)

    Yes. The example page I posted in my first post.

    Thread Starter ingax

    (@ingax)

    I spoke too soon. After clearing the cache, the author images do not display. 🙁

    Thread Starter ingax

    (@ingax)

    Correct.

    The main problems I noticed when turning on code escaping was that the author images on the “Recommended For You” posts where not displaying.

    However, I just tested it again. After updating to the latest WordPress, the author images display properly.

    So yay! It looks to be fixed.

    So why did I need to enable code escaping only for this code snippet? And what are the downsides to having code escaping for posts turned on? Will I have to turn on the code escaping for Content, Excerpts, and Comments? Because, if someone posted this same code in the comments, wouldn’t it cause the same issue? Thanks!

    Thread Starter ingax

    (@ingax)

    First of all, thanks for making this plug-in! It’s super useful. 🙂

    I’m using the Gutenberg Editor on all my posts. And I’m using the Block Editor.

    I just updated to the latest version of WordPress. Still getting the problem.

    Troubleshooting:

        Posting several other snippets of code in the same code block displays correctly. The problem is specifically with this code snippet.
        Posting the same code on a new post yields the same problem.
        Turning on Code Escaping, for posts, in the Prsimatic preferences fixes the problem. However, author images and other elements no longer display correctly.
        I’m using the latest versions of Autoptimize and W3 Total Cache. Clearing the cache yields the same results.
        I have dozens of pages with code, posted in the same way. This is the only code/page causing issues.
Viewing 6 replies - 1 through 6 (of 6 total)