Opened 8 years ago
Last modified 12 months ago
#2931 assigned defect (bug)
Plugin Directory: Incorrect parsing of code blocks
Reported by: | SergeyBiryukov | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Component: | Plugin Directory | Keywords: | needs-patch |
Cc: |
Description
The description for Theme Check plugin appears to be parsed incorrectly (see the screenshot).
The first code sample lacks the code formatting. In the readme.txt
both samples are formatted the same way:
Examples: `define( 'TC_PRE', 'Theme Review:[[br]] - Themes should be reviewed using "define(\'WP_DEBUG\', true);" in wp-config.php[[br]] - Themes should be reviewed using the test data from the Theme Checklists (TC) ----- ' );` `define( 'TC_POST', 'Feel free to make use of the contact details below if you have any questions, comments, or feedback:[[br]] [[br]] * Leave a comment on this ticket[[br]] * Send an email to the Theme Review email list[[br]] * Use the #wordpress-themes IRC channel on Freenode.' );`
Attachments (4)
Change History (11)
#4
@
7 years ago
@obenland This is most definitely an issue with the markdown parser, and as a result I don't expect this is easily fixable without side effects (unless the library we're using has been updated)
#5
@
7 years ago
- Keywords 2nd-opinion removed
- Owner set to dd32
- Status changed from new to accepted
Okay so after a lot of debugging, it looks like this is a combination of bugs both in our readme parser, but also in the markdown parser.
The markdown parser isn't correctly handling this example:
#wpwrap { testing; }
It seems that any code block (A line starting with 4 spaces, which we convert `...`
to) starting with #
is being interpreted as a markdown header instead of a code block start.
I've tested version 1.8 of the library (We're using 1.6) and it doesn't seem to fix it, but it doesn't make it worse.
It looks like we can work around it on our end by not relying upon the libraries code block functionality, and instead rolling out own for `...`
.
Got a fair bit more testing to do though.
#6
@
7 years ago
2931.diff is where I got up to a few days back, uploading here as a WIP patch for backup purposes..
- Not splitting content into headers when within code blocks (Not entirely sure if this is still working correctly, as it hasn't been fully tested after the following changes)
- Upgrading the Markdown parser from v 1.6 to 1.8
- Converting
```....```
code blocks to<pre><code>...</pre></code>
instead of indented blocks to workaround the previously mentioned markdown parser bug mentioned in Comment #5
These changes can be seen on https://wordpress.org/plugins/test-plugin-3/ which has FAQ entries which were previously parsing improperly and the code block from the original report.
Came across this. The first block is parsed incorrectly while the second variant with the CSS in reverse order just works. Weird.
This is parsed incorrectly:
This works: