Automattic / Automattic/jetpack
Markdown: manually inserted p tags are removed when wpautop is disabled
- Dominant language
- PHP
- Stars
- 1.8k
- Forks
- 898
- Avg merge
- 1d 18h
- Merged PRs (30d)
- 774
Description
When the Markdown module is _enabled_ and the `wpautop` function is _disabled_, manually inserted `
` tags are removed. This is not what is expected. After all, when _both_ the Markdown module and the `wpautop` function are _disabled_, manually inserted `
` tags remain intact (as it should).
That is when using the Classic Editor. I did not make any tests with the Block Editor.
### Steps to reproduce the issue
1. Disable the `wpautop` function.
2. Enable the Jetpack Markdown module.
3. Using the Classic Editor, create a post or page with manually inserted `
` tags.
4. Publish the post or page.
5. Check the source code. The manually inserted `
` tags will be gone.
### What I expected
Manually inserted `
` tags intact in the source code.
### What happened instead
Manually inserted `
` tags removed.
### More details
When I create a page with the text below in the Classic Editor:
```
This is a paragraph with manually inserted p tags.
This is a paragraph without p tags.
```
These are the results I get depending on the ON/OFF status of the Markdown module and `wpautop`:
- **wpautop ON, Markdown OFF**
```
This is a paragraph with manually inserted p tags.
This is a paragraph without p tags.
```
(Works as expected.)
- **wpautop ON, Markdown ON**
```
This is a paragraph with manually inserted p tags.
This is a paragraph without p tags.
```
(Works as expected.)
- **wpautop OFF, Markdown OFF**
```
This is a paragraph with manually inserted p tags.
This is a paragraph without p tags.
```
(Works as expected.)
- **wpautop OFF, Markdown ON**
```
This is a paragraph with manually inserted p tags.
This is a paragraph without p tags.
```
(Does **not** work as expected. ~~The result should be the same as when both `wpautop` and Markdown are disabled – `
` tags around the first sentence only.~~ I had second thoughts about it, read below.)
#### Edit:
On second thoughts, I am not really sure what is the expected result with **wpautop OFF, Markdown ON**. Since Markdown would still be enabled, maybe the expected result for most people would be `
` tags around each sentence.
In any case, I strongly believe the expected result is **not** to have the manually inserted `
` tags removed, and that is what happens now.
Contributor guide
Research direction
Reproduce the Classic Editor cases using the wpautop and Jetpack Markdown settings, then trace the Markdown module's post-processing of manually inserted p tags. Done means the tags are not silently removed when wpautop is disabled, with coverage for the reported settings combination and an agreed expected output.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- markdown, php, wordpress
- Domain
- backend, content
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100