internetarchive / internetarchive/openlibrary

Lone `**` in markdown creates italics evermore.

Open
#9,041 3 comments 0 reactions 0 assignees View on GitHub
Lead: @jimchamp Priority: 3 State: Blocked Type: Bug
Dominant language
Python
Stars
6.7k
Forks
2k
Avg merge
2d 19h
Merged PRs (30d)
138

Description

### Problem

Having a lone pair of asterisks (`**`) on a line in an Open Library field that supports markdown (such as the `description` field of an `Edition` or `Work`) causes the following text for _the rest of the page_ to be in italics.

Note: this does _not_ appear to happen with lone asterisks (`*`). Instead, it the Open Library implementation seems to accurately follow GitHub, insofar as nothing happens and there are no italics.

#### Evidence / Screenshot
```
italics start here**
and never end.
```
![image](https://github.com/internetarchive/openlibrary/assets/26524678/a9ba7b51-b87b-49c8-8410-6310fa133c9e)

#### Relevant URL(s)

### Reproducing the bug

1. Go to an edition description
2. Do enter `**` somewhere on a line and save.

* Expected behavior: The entire page following `**` _does not_ become italics (nor does anything become bold, following GitHub's lead).
* Actual behavior: The entire page following `**` _does_ become italics.

### Context

- Browser (Chrome, Safari, Firefox, etc):
- OS (Windows, Mac, etc):
- Logged in (Y/N): Y
- Environment (prod, dev, local): prod

### Notes from this Issue's Lead

#### Proposal & constraints

We appear to follow GitHub Flavored markdown, which doesn't appear to support italics or bold spanning lines. The latter case is one likely way people will run into the bug.

However, having unmatched `**` on a line in GitHub (e.g. here in this form) doesn't seem to cause an italicsfest. Instead, it merely does nothing. We should consider following GitHub's behavior.

#### Related files

#### Stakeholders

Contributor guide

Open the contributing guide

Research direction

The issue does not name related files. Start by locating the markdown renderer used for Edition and Work descriptions, then reproduce the problem with a line containing `**` followed by more text. Done means unmatched `**` does not italicize the rest of the page, with a regression test covering the behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
web-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.