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

HTML tags being shown #1353

Closed
5 tasks done
kellianb opened this issue Dec 14, 2024 · 1 comment
Closed
5 tasks done

HTML tags being shown #1353

kellianb opened this issue Dec 14, 2024 · 1 comment
Labels
Bug Something isn't working

Comments

@kellianb
Copy link

Steps to reproduce

  • Open chapter of light novel, for example "The Beginning After The End" chapter 176 on LightNovelPub
  • Find visible html tags like <i></i> in the text

Expected behavior

The html should be rendered:

  • <i></i> tags should not be shown and the text inside them should be in italic
  • <b></b> tags should not be shown and the text inside them should be in bold
  • etc...

Actual behavior

The html tags are shown and have no effect on the text

LNReader version

v2.0.0-beta.3

Android version

Android 15

Device

Google Pixel 8a

Other details

I saw a "Render html" option in some screenshots of the app, but have not been able to find this option in the app.

Acknowledgements

  • I have searched the existing issues and this is a new ticket, NOT a duplicate or related to another open or closed issue.
  • I have written a short but informative title.
  • If this is an issue with a source, I should be opening an issue in the sources repository.
  • I have updated the app to version 2.0.0.
  • I will fill out all of the requested information in this form.
@kellianb kellianb added the Bug Something isn't working label Dec 14, 2024
@CD-Z
Copy link
Collaborator

CD-Z commented Dec 14, 2024

This is actually not an issue of LNReader, since it is also visible on the source. The reason for this is that LightNovelPub for some reason escapes < and >. You can fix this with custom JS.

This one fixes it for <i> and <b> tags.

const c = document.querySelector("#LNReader-chapter");
c.innerHTML = c.innerHTML.replace(/\&lt;(\/)?i\&gt;/g,(a,g)=>{return g ?"</i>":"<i>"}).replace(/\&lt;(\/)?b\&gt;/g,(a,g)=>{g? "</b>": "<b>"}

And this one fixes it for all tags. However all text that is between < and > also disappears.

const c = document.querySelector("#LNReader-chapter");
c.innerHTML = c.innerHTML.replace(/\&lt;(\/)?(.*?)\&gt;/g,(a,g,g2)=>{return g2 ?`</${g2}>`:`<${g}>`})

Furthermore this is actually a plugin issue. So it should be posted on https://github.com/LNReader/lnreader-plugins

@CD-Z CD-Z closed this as completed Dec 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants