vmg / redcarpet

The safe Markdown parser, reloaded.
MIT License
4.99k stars 527 forks source link

Incorrectly processes content nested within `summary` and `details` elements #715

Open smusoke opened 3 years ago

smusoke commented 3 years ago

When upgrading from 3.3.4 there seems to be a regression with processing content nested within <details> and <summary> tags. Tested this up to version 3.5.1 and the results were all the same - leading me to believe the regression was introduced in version 3.4.0. With no changes other than version number, this code snippet resulted several bugs including bold text and tables. There very well could be more.

  <summary>**Teacher Packets and Agendas**</summary>
  <p>
  <br/>
Please look at the agendas for each academic year workshop - shared with facilitators at the following links.  Pay particular attention to the "Supplies" portion of the agenda that the facilitator will need from regional partners to run a successful workshop.

- **<a href=“https://drive.google.com/drive/u/0/folders/15hxKPVotCLTy7yzneEbDpWLIlaDf4aq4” target_blank>2020 Teacher Welcome Kits</a>**
- **<a href=“https://curriculum.code.org/plcsd/” target_blank>2019 CS Discoveries Agenda</a>**
- **<a href=“https://curriculum.code.org/plcsd/” target_blank>2019 CS Principles Agenda</a>**

</p>
</details>

<details>
  <summary>**Securing a Venue**</summary>
  <p>
These guidelines explain the type of space your facilitators need to run a successful workshop and provide important tips to consider for logistics and teacher experience.  <br/>

| |Requirements and Suggestions|
|:-----|:-----------|
|**Location**|**Ask yourself these questions when searching for the ideal location for your workshop.**<br/> - Central location: Is the location central to the spread of teachers attending? <br/>- Catering: Are there several options to order from within 20 miles? Is there an internal or preferred caterer for the venue?<br/> - Parking: Does parking cost anything? Will teachers need parking passes? Is the lot close to an entrance? *Tip: teachers are more likely to show up to the workshop when parking is free.* <br/> - Access: Will there be someone from the venue there to open the building, help with getting supplies to your room(s), and be available to help with technology as needed during the workshop?|
|**Rooms and <br/>Set Up**|Reservation time: <br/> Every workshop requires 6 hours of content. Add breakfast/registration, lunch and any additional things you want to do with teachers as time on top of that.<br/> <br/> Rooms Needed:<br/>- One room for entire group<br/>- Breakout room to set up catering and for eating. Hallway space also works. We want to avoid interrupting the session by setting up food in the room.<br/>- Wall space for hanging poster sized paper with Blue painter's tape<br/><br/>Seating<br/>- Pods of 4 people for the size of the group. We recommend 8 pods.|  
|**Technology <br/>Requirements**| - Projector and screen<br/> - Power outlets and extension cords<br/> - Wifi that can support access by all participants (4 MB/s minimum, 8 MB/s is ideal.)<br/> |
|**Logistical and Facilitator One Pager Information**|- Physical Address of Workshop<br/>- Address to ship supplies (If needed)<br/> - Map of the Campus and/or building to help teachers find the room. Driving instructions should be provded to teachers. This can be done via Google Maps or Bing Maps.<br/> - Wifi strength, name and password. All participants will need to be on the network at the same time with no lag.<br/> - Arrangments for Access: You should make arrangements with your venue contact to give you access to the building and help you locate supplies.|
<br/>
</p>
</details>

Using version 3.3.4 Screen Shot 2021-08-23 at 10 58 01 AM

Using version 3.4.0+ Screen Shot 2021-08-23 at 10 56 02 AM

lfdebrux commented 2 years ago

We've also run into this issue, https://github.com/alphagov/learn-to-code/issues/56, I think it is because Redcarpet doesn't treat HTML blocks in the same way the CommonMark spec does [1]... In CommonMark you can have Markdown between two HTML tags as long as there is an empty line between the tags and the Markdown, whereas in Redcarpet it looks like whenever it finds a valid HTML tag it immediately looks for the closing tag [2].

Would the maintainers of Redcarpet be interested in a PR that changed the behaviour of Redcarpet in HTML blocks to match the CommonMark spec?