Making WordPress.org

Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#2336 closed defect (bug) (fixed)

Markdown Parser for FAQ mis-parsing headers and code

Reported by: ipstenu's profile Ipstenu Owned by: dd32's profile dd32
Milestone: Plugin Directory v3.0 Priority: normal
Component: Plugin Directory Keywords: needs-patch has-screenshots
Cc:

Description

On https://wordpress.org/plugins-wp/wp-force-login/ under the FAQ item "2. How can I add exceptions for certain pages or posts?" has two 'sub FAQs' for Bypass Force Login and Whitelist URLs.

Both of those are using markdown BOLD, not headers, and should not be headers.

If you go from a header directly to code, without any normal text in between, it fails to mark the code as well, code.

Attachments (2)

Screen Shot 2016-12-19 at 8.47.10 AM.png (37.2 KB) - added by Ipstenu 8 years ago.
Example of code not parsing
Screen Shot 2016-12-19 at 8.47.16 AM.png (60.5 KB) - added by Ipstenu 8 years ago.
Example of code parsing

Download all attachments as: .zip

Change History (10)

@Ipstenu
8 years ago

Example of code not parsing

@Ipstenu
8 years ago

Example of code parsing

#1 @dd32
8 years ago

For reference as to why this happens, it's because many people use bold as question, and non-bold as answer.

What we could do here is detect if headings are present and if so, parse out the Q/A based on that, else, fall back to Bold Q/A

#2 follow-up: @Ipstenu
8 years ago

I don't see a problem with not supporting the bold for questions, though. I mean, if we tell people "Use headers properly" then it's less for us :)

#3 in reply to: ↑ 2 @dd32
8 years ago

Replying to Ipstenu:

I don't see a problem with not supporting the bold for questions, though. I mean, if we tell people "Use headers properly" then it's less for us :)

I can't easily query for it, but a significant amount use bold (and no headings), much fewer have questions like the example used here - I'd be just as happy telling people not to use bold sub-headings in Q&A :)

Matching either/or is easy though, we just do it based on which type of section is encountered first.
The code responsible here only parses the Update Notice and FAQ sections, so changing it affects little.

#4 @kevinvess
8 years ago

@dd32 makes a good point – we could just as easily not use bold sub-headings in Q&A, but it would be nice if we could.

I'm less concerned about the bold versus heading format as I am about the code example not parsing.

Thanks!

#5 @Ipstenu
8 years ago

Why do you have to be reasonable, @dd32 ?

Okay so if more people use bold for FAQ headers, leave that alone and figure out why the code example doesn't parse if it's the first line after a header?

#6 @dd32
8 years ago

  • Owner set to dd32
  • Resolution set to fixed
  • Status changed from new to closed

In 4562:

Plugin Directory: When parsing the FAQ and Update Notice sections, match sub-sections based on EITHER headings or full-line bolding, not both. This changes it to only match the first style it encounters, to avoid scenario's where a full-line bolding exists within an otherwise properly formatted heading block.

Fixes #2336

#7 @dd32
8 years ago

I'll note that correcting the matching, has also made the code blocks be recognised correctly.

I wasn't able to find an example of bolded questions, but i recall it being very common. If someone runs into another example of FAQs being mis-parsed, open a new ticket (unless it's directly related to this and seen in the next week or so)

#8 @dd32
8 years ago

In 4573:

Plugin Directory: When parsing sections such as FAQ, only use ** bolded lines ** as headings when standard headings (## heading, = Heading =) aren't present.

See https://wordpress.slack.com/archives/pluginreview/p1482436390000554
See #2336

Note: See TracTickets for help on using tickets.