EbookFoundation / EbookFoundation/free-programming-books-parser

Parser doesn't take into account bold format in notes

Open
#10 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
17
Forks
7
PR merge metrics
No merged PRs in 30d

Description

Having current code:

https://github.com/EbookFoundation/free-programming-books-parser/blob/dc53b8c803f96a7a0de6afabcab6949bfbb79b5a/index.js#L140-L172
![image](https://user-images.githubusercontent.com/3125580/190889780-dc7e9e91-5bb0-41a1-82ef-a37a63972509.png)

If a bold format is found, the `i.value` is undefined and then the program crash. It should check if `i.type == "strong"` or have `i.children`.

Resources affected:

- https://github.com/EbookFoundation/free-programming-books/blob/fc4b0c5c139b952de979aa54a4de5141ea280906/books/free-programming-books-fr.md?plain=1#L73 ![image](https://user-images.githubusercontent.com/3125580/190890056-8dac7f62-68e1-4844-9934-83fbfcfcc37e.png)

In general, we should extends the fix in depth to other inline formats like emphasis (already exists), bold, code, image...

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in index.js around lines 140-172 and reproduce the crash using the affected French resource linked in the issue. Trace how inline formats are handled, including strong and nested children, then verify that bold and the other named inline formats no longer cause parsing to fail.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.