Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Readers > Kobo Reader

Notices

Reply
 
Thread Tools Search this Thread
Old 02-04-2024, 06:03 AM   #1
clairvoyant
Junior Member
clairvoyant began at the beginning.
 
Posts: 5
Karma: 10
Join Date: Sep 2021
Device: Kindle Paperwhite
Can't highlight text that contains code syntax

I'm reading programming books on my Kobo Libra H2O and having issues with the highlighting. Whenever I highlight a sentence with a programming/code syntax, my highlight disappears when I click somewhere else on the page.

At first, I only noticed it on code blocks and thought it was related to <pre> blocks, although I'm not sure if ebooks contain those. Then I stumbled upon this sentence that had the same issue:

"However, while id and type should be familiar from native HTML, htmlFor might be new to you."

I can't tell if these keywords just have a different font or if they are using some other hidden markup. I played around with the reading font on the device and got it to show the whole sentence in the same font. It inhibits the reading experience a bit since I can't distinguish the keywords but solves the highlighting issue I had with that specific sentence.

Unfortunately, the code blocks still have the same issue.

Is there any workaround to this?
clairvoyant is offline   Reply With Quote
Old 02-04-2024, 07:15 AM   #2
Quoth
the rook, bossing Never.
Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.
 
Quoth's Avatar
 
Posts: 11,406
Karma: 87454321
Join Date: Jun 2017
Location: Ireland
Device: All 4 Kinds: epub eink, Kindle, android eink, NxtPaper11
Sometimes a Kobo doesn't display a highlight that goes to the end of a paragraph, but the highlight does exist in the highlights/annotations/bookmarks.
Is a note added if you annotate/edit?
Is it in the list?
Quoth is offline   Reply With Quote
Advert
Old 02-04-2024, 08:17 AM   #3
clairvoyant
Junior Member
clairvoyant began at the beginning.
 
Posts: 5
Karma: 10
Join Date: Sep 2021
Device: Kindle Paperwhite
Quote:
Originally Posted by Quoth View Post
Is a note added if you annotate/edit?
Is it in the list?
If I highlight parts of these code blocks, I get the regular popup confirmation with the option "Undo Highlight" but the highlight then disappears when I click somewhere else and doesn't show up in my list. Similarly, if I add a note with code selected, I get a popup saying "Note saved successfully" but it doesn't show up in my notes regardless of filter (All, Highlights, Notes).

There are no issues with highlights or notes of regular text, only code.

---

Clicking on "Edit" in Calibre tells me that the issues seem to be with this:

Code:
<figure class="code" dir="ltr">
  <figcaption>src/App.jsx</figcaption>
<div class="highlight"><pre><code></code><code class="uil">import * as React from 'react';
</code><code class="uil">
</code><code class="uil">function App() {
</code><code class="uil">  return (
</code><code class="uil">    &lt;div&gt;
</code><code class="uil">      &lt;h1&gt;Hello React&lt;/h1&gt;
</code><code class="uil">    &lt;/div&gt;
</code><code class="uil">  );
</code><code class="uil">}
</code><code class="uil">
</code><code class="uil">export default App;
</code></pre>
</div>
</figure>
as well as inline text like this:

Code:
In order to make it work, you have to execute <code>npm run build</code> before running <code>npm run preview</code>.
---

I noted now that these books were transferred using the Calibre plugin KoboTouchExtended. I tried disabling the plugin and transferred the books again. It results in code syntax showing up as regular inline text with regular font but it also seems to solve the issue.

So I would assume that Kobo can't highlight text using the <code> tag which standard Calibre solves by just stripping it, messing up the layout and style. But now, after fiddling around with the fonts, it suddenly seems to be able to highlight inline use of the <code>. But not anything in big code blocks.
clairvoyant is offline   Reply With Quote
Old 02-04-2024, 03:02 PM   #4
Quoth
the rook, bossing Never.
Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.
 
Quoth's Avatar
 
Posts: 11,406
Karma: 87454321
Join Date: Jun 2017
Location: Ireland
Device: All 4 Kinds: epub eink, Kindle, android eink, NxtPaper11
The "KoboTouchExtended" by default creates kepubs, not epubs. That uses different software to render and highlight on the kobo.
You can even force the kepub rendering by renaming somebook.epub to somebook.kepub.epub and then you have no highlighting at all!

You can turn off "on the transfer" conversion to kepub in the KoboTouchExtended driver settings.
Quoth is offline   Reply With Quote
Old 02-04-2024, 04:51 PM   #5
DNSB
Bibliophagist
DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.
 
DNSB's Avatar
 
Posts: 36,196
Karma: 145735388
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
Given that the kepub renderer using a mass of added spans for highlighting, it's entirely possible that the added code segments are confusing it.
DNSB is online now   Reply With Quote
Advert
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
dictionary/thesaurus design examples syntax code venturacottage ePub 4 02-26-2015 01:31 PM
Sigil: How to highlight text ? Frank's Sigil 65 12-27-2012 07:37 PM
Highlight text JhamishW Kobo Tablets 3 09-12-2012 10:33 PM
the text highlight Quantumer Calibre 0 05-26-2012 04:54 AM
How do I change the syntax colouring and increase the font size in the Code View? nicciglen Sigil 5 02-08-2012 09:34 AM


All times are GMT -4. The time now is 04:31 PM.


MobileRead.com is a privately owned, operated and funded community.