internetarchive / openlibrary

One webpage for every book ever published!
https://openlibrary.org
GNU Affero General Public License v3.0
5.1k stars 1.33k forks source link

Markdown processor seems confused when using links #3714

Open bitnapper opened 4 years ago

bitnapper commented 4 years ago

When mixing links and other bold or italic text in the Work Description, the interpreter seems to omit some of the formatters as you can see in the following links.

Evidence / Screenshot

Details

xayhewalo commented 4 years ago

@bitnapper please post a screenshot of the exact markdown used and the result of it's rendering.

bitnapper commented 4 years ago

4837D872-A1C1-4469-9780-6B894BF735CD Here‘s the Markdown

61E22CA0-01F7-4D73-8F26-2876871D2037 Here‘s the result.

bitnapper commented 4 years ago

4D12C25D-43D6-4503-9DBD-806BF1A076D6 Here in widescreen with the complete Markdown.

miphilomath commented 4 years ago

I would like to work on this issue if someone can guide me a little. I looked up the code base to understand which files are handling the markdown.

Found out, openlibrary/core/olmarkdown.py was importing following modules

import re
from infogami.utils.markdown import markdown
from openlibrary.core import helpers as h
... 
...
class OLMarkdown(markdown.Markdown):
  ...
  def convert(self):
          html = markdown.Markdown.convert(self)
          return h.sanitize(html)

But the module markdown was missing which were imported, that could be the root of the issue. Update: NVM. Found that the infogami is a submodule within the repository.

seabelis commented 2 years ago

There's also a problem with formatting in the edition description and TOC. All formatting is ignored (indentation, etc.).

mekarpeles commented 2 years ago

@miphilomath yes please! Your help would be appreciated and @jimchamp and I can help as you have questions

cdrini commented 2 years ago

Based on the comment I think this might've been meant to be assigned to you @jimchamp :)

mekarpeles commented 1 year ago

It seems the problem is that previews work irrespective of where * are however the renderer only works when the * is outside (I think) the []'s. In any case, it either doesn't work when inside or when outside.

The resolutions are either to make this work at the render level or to disable the preview for the not-working case.

@miphilomath does either approach seems easier / more reasonable to you and do you have any further questions which @jimchamp can help with?