Skip to content

Settings: Move the Markdown settings into the settings panel - #54891

Merged
CGastrell merged 4 commits into
trunkfrom
change/settings-markdown-panel
Nov 13, 2026
Merged

CGastrell merged 4 commits into
trunkfrom
change/settings-markdown-panel

Conversation

@CGastrell

@CGastrell CGastrell commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Fixes JETPACK-3721

Proposed changes

Behind the my-jetpack-settings-consolidation flag (off by default). With the flag off, nothing changes.

  • Panel: Configure on Markdown in My Jetpack › Features opens the settings panel (settings-panel/markdown.tsx). It shows a description, a support link, the module switch ("Enable Markdown"), and two switches: "Write posts and pages with Markdown" (wpcom_publish_posts_with_markdown) and "Let readers use Markdown in comments" (wpcom_publish_comments_with_markdown). Each option saves on change through jetpack/v4/settings.

  • URLs: markdown joins Initializer::SETTINGS_PANEL_MODULES, so its configure_url points at the panel while the flag is on.

  • Settings app: for users who can manage modules, the Composing card no longer shows the Markdown toggle, and the Comments card no longer shows "Enable Markdown use for comments". A Settings search for Markdown shows a card that links to the panel (writing/markdown-moved.jsx). Users who cannot manage modules have no Features, so they keep the old controls, as Composing does for its other modules.

  • Discussion: the Markdown gate is in discussion/index.jsx (its isModuleFound), so discussion/comments.jsx is not touched (Comments: update settings menu #53538 rewrites it). This also stops a Markdown search from printing an empty "Discussion" heading.

  • Writing tab: with the flag on, admins get no Writing tab, and #/writing sends them to admin.php?page=my-jetpack#/features (main.jsx, as Settings: Move the Reader Visibility card to Features #54817, Settings: Move the Sharing buttons and Like buttons cards to Features #54819 and Settings: Move the Site Accelerator card to Features #54820 do for their tabs). The tab rule in components/settings-nav-tabs/index.jsx used to keep the tab for markdown, post-by-email and infinite-scroll, which have all moved. With the flag on, nothing keeps it for admins:

    A Settings search still shows those pointers, because search runs on #/settings?term=. Users who cannot manage modules keep their Writing tab (Post by Email), as before; they never reach the route redirect.

  • Redirect map: markdown now points at the panel. /writing drops its D2 marker and gets the same default as /traffic, admin.php?page=my-jetpack#/features, because no Writing card is left for admins with the flag on; it is marked alreadyRedirects, since main.jsx does that redirect. D2 is decided, so it is gone, and /discussion, comments and gravatar-hovercards now wait on JETPACK-3720. /performance gets the D9 rule for users who cannot manage modules, as /writing and /reader have.

Coupling of the switch and the options

The panel switch owns activation, as in the Carousel panel. The two options stay visible but locked while the module is off.

Differences from the Settings controls:

Settings Panel
Turning the posts or comments option on also turns the module on Turn the module on with its switch, then turn on the options
Turning the last option off also turns the module off The module stays on until its switch is turned off
Turning the module on sets the posts option Same: turning the module on sets the posts option (a server hook on module activation). Only the comments option survives off and on
jetpack_wpa_module_toggle and the settings toggle events The module switch sends jetpack_wpa_module_toggle with origin: my-jetpack-settings-panel; the option switches send the panel's setting toggle event
Strings in the jetpack text domain jetpack-my-jetpack

So with the module on and both options off, Markdown does nothing until a user turns an option on.

Side effect with the flag on, for admins

The "Learn more about all Jetpack AI features" link was inside the Composing card. Markdown was the last module that kept that card, so the link goes with it.

Screenshots (flag on, admin)

Before After
Composing card
Composing card with the Markdown toggle and the AI link
Settings tabs: no Writing tab
Settings tabs: Security, Discussion, Traffic, Monetize
Search for "markdown"
Pointer card: The Markdown settings are now in Features, in My Jetpack
Panel fallback
Fallback panel with only Activate this feature and Manage in Settings
Markdown panel
Markdown panel with the module switch and both options
Comments card
Comments card with Enable Markdown use for comments
Comments card
Comments card without the Markdown option

Plan (as approved)

  1. Add markdown.tsx, copied from the Carousel panel pattern (PanelModuleToggle plus useModuleOption switches), register it, and add markdown to SETTINGS_PANEL_MODULES.
  2. Hide the Settings controls behind isSettingsConsolidationEnabled() for users who can manage modules, with a search pointer to the panel.
  3. Update the redirect map and add comment-only changelog entries.
  4. Unit tests with a mutation check for each, then a live check on a local Docker site.
  5. Follow-up: hide the emptied Writing tab for admins and send #/writing to Features.

Related product discussion/links

Does this pull request change what data or activity we track or use?

No new data. With the flag on, the panel's switches send the existing panel Tracks events (origin: my-jetpack-settings-panel), as the other panels do.

Testing instructions

Run:

  • cd projects/packages/my-jetpack && pnpm exec jest --config=tests/jest.config.js && pnpm run typecheck
  • cd projects/plugins/jetpack && NODE_PATH=tests:_inc/client pnpm exec jest --config=tests/jest.config.gui.js and --config=tests/jest.config.client.js
  • jetpack test php packages/my-jetpack

Manual checks, run by the author on a local Docker site with two mu-plugin filters: add_filter( 'jetpack_feature_flag_enabled_my-jetpack-settings-consolidation', '__return_true' ); and add_filter( 'jetpack_offline_mode', '__return_false' ); (the second because the site is on localhost; offline mode is JETPACK-3727).

  1. Open wp-admin/admin.php?page=my-jetpack#/features?configure=markdown. The Markdown panel opens. With the module off, both options are locked.
  2. Turn on "Enable Markdown". Reload. The switch stays on, and wp option get / the module state agree.
  3. Turn "Let readers use Markdown in comments" on, then "Write posts and pages with Markdown" off. Reload after each. The panel and the stored options keep the new values.
  4. In Features, search "markdown". With the module on, the row has Configure, which opens ?configure=markdown. (Configure shows only while a module is on, as for the other panels.)
  5. Jetpack › Settings › Writing: no Markdown toggle. Discussion: no "Enable Markdown use for comments".
  6. Settings search "markdown": a "Markdown" card with "Open the Markdown settings", which opens the panel. No empty "Discussion" heading.
  7. The Settings tabs have no Writing tab, and opening admin.php?page=jetpack-settings#/writing lands on My Jetpack › Features.
  8. With the flag filter removed, Writing and Discussion show the old Markdown controls.

Not run by the author: a user who cannot manage modules (they should keep the old controls and their Writing tab).

Coverage (Covered by non-unit tests): markdown-moved.jsx and the Discussion gate have no unit test. The Composing test mocks the pointer, as writing.test.jsx mocks the other pointers, and manual steps 5 and 6 cover both. There is no new row in Settings_Panel_Url_Test.php: its tests cover the mechanism with related-posts, and a row per list entry would catch no bug the list itself does not show (the Carousel and Infinite Scroll PRs added none).

Phan crashes on the host PHP 8.5 while parsing vendor/php-stubs/wordpress-stubs, before it reaches this code, so Phan is left to CI.

The 400 console errors on My Jetpack also show on trunk.

@github-actions

github-actions Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.

  • To test on WoA, go to the Plugins menu on a WoA dev site. Click on the "Upload" button and follow the upgrade flow to be able to upload, install, and activate the Jetpack Beta plugin. Once the plugin is active, go to Jetpack > Jetpack Beta, select your plugin (Jetpack), and enable the change/settings-markdown-panel branch.
  • To test on Simple, run the following command on your sandbox:
bin/jetpack-downloader test jetpack change/settings-markdown-panel

Interested in more tips and information?

  • In your local development environment, use the jetpack rsync command to sync your changes to a WoA dev blog.
  • Read more about our development workflow here: PCYsg-eg0-p2
  • Figure out when your changes will be shipped to customers here: PCYsg-eg5-p2

@github-actions github-actions Bot added [Package] My Jetpack [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Tests] Includes Tests Admin Page React-powered dashboard under the Jetpack menu labels Nov 12, 2026
@github-actions

github-actions Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Thank you for your PR!

When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:

  • ✅ Include a description of your PR changes.
  • 🔴 Add a "[Status]" label (In Progress, Needs Review, ...).
  • ✅ Add testing instructions.
  • ✅ Specify whether this PR includes any changes to data or privacy.
  • ✅ Add changelog entries to affected projects

This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖


Follow this PR Review Process:

  1. Ensure all required checks appearing at the bottom of this PR are passing.
  2. Make sure to test your changes on all platforms that it applies to. You're responsible for the quality of the code you ship.
  3. You can use GitHub's Reviewers functionality to request a review.
  4. When it's reviewed and merged, you will be pinged in Slack to deploy the changes to WordPress.com simple once the build is done.

If you have questions about anything, reach out in #jetpack-developers for guidance!


Jetpack plugin:

The Jetpack plugin has different release cadences depending on the platform:

  • WordPress.com Simple releases happen as soon as you deploy your changes after merging this PR (PCYsg-Jjm-p2).
  • WoA releases happen weekly.
  • Releases to self-hosted sites happen monthly:
    • Scheduled release: December 8, 2026
    • Code freeze: December 7, 2026

If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack.

@jp-launch-control

jp-launch-control Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

Code Coverage Summary

Coverage changed in 3 files.

File Coverage Δ% Δ Uncovered
projects/plugins/jetpack/_inc/client/main.jsx 62/99 (62.63%) 1.17% 0 💚
projects/plugins/jetpack/_inc/client/components/settings-nav-tabs/index.jsx 44/59 (74.58%) 0.81% -1 💚
projects/plugins/jetpack/_inc/client/writing/composing.jsx 35/40 (87.50%) 2.88% -1 💚

2 files are newly checked for coverage.

File Coverage
projects/plugins/jetpack/_inc/client/writing/markdown-moved.jsx 0/2 (0.00%) 💔
projects/packages/my-jetpack/_inc/components/settings-panel/markdown.tsx 5/5 (100.00%) 💚

Full summary · PHP report · JS report

If appropriate, add one of these labels to override the failing coverage check: Covered by non-unit tests Use to ignore the Code coverage requirement check when E2Es or other non-unit tests cover the code Coverage tests to be added later Use to ignore the Code coverage requirement check when tests will be added in a follow-up PR I don't care about code coverage for this PR Use this label to ignore the check for insufficient code coveage.

@CGastrell
CGastrell marked this pull request as ready for review November 12, 2026 19:53

@dhasilva dhasilva left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed at 5d39401. JS tests, typecheck, ESLint and coverage are green. The two red jobs are unrelated: PHP 8.4 WP trunk fails in Jetpack_Email_Design_Editor_Test on a core mysql2date() redeclare, and the other is a Boost e2e job.

Checked and fine:

  • Users who cannot manage modules keep their Writing tab and never reach the /writing redirect. settings-nav-tabs only changes the userCanManageModules branch, and Main sends everyone else to NonAdminView before the route switch.
  • With the flag on, nothing on Writing renders for admins without a search. Hiding the tab strands nothing.
  • On the /writing default you asked about: #/features looks right to me, since no single search covers the tab. Two links still point at #/writing and now land on unfiltered Features with the flag on: the fixUrl in Unavailable_Blocks::get_editor_data() (
    'fixUrl' => admin_url( $is_disconnected ? 'admin.php?page=jetpack' : 'admin.php?page=jetpack#/writing' ),
    ), which the map already says wants ?search=blocks, and the wpcomsh notice on Settings › Writing (
    $jetpack_settings_url = admin_url( 'admin.php?page=jetpack#/writing' );
    ), which still says "Jetpack Settings". Before this PR, the blocks link with the flag on reached a Writing tab with no Blocks toggle, so this is a step forward. Both are worth fixing where they are defined before the flag flips, not in this PR.

No blockers. Three suggestions inline.

Generated by Claude.

<Text variant="body-md" id={ labelId }>
{ __( 'Enable Markdown', 'jetpack-my-jetpack' ) }
</Text>
<PanelModuleToggle module={ $module } labelledby={ labelId } disabled={ disabled } />

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[suggestion] One row of the coupling table in the description doesn't match the server: "Turning the module on keeps the stored option values (they also survive off and on)". This switch POSTs jetpack/v4/module/markdown/active. register_endpoints() loads the module endpoints file on every REST request (

add_action( 'rest_api_init', array( 'Jetpack_Core_Json_Api_Endpoints', 'register_endpoints' ) );
,
require_once JETPACK__PLUGIN_DIR . '_inc/lib/core-api/class.jetpack-core-api-module-endpoints.php';
), and that file hooks jetpack_activate_module_markdown to set wpcom_publish_posts_with_markdown to true (
* Actions performed only when Markdown is activated through the endpoint call.
*
* @since 4.7.0
*/
function jetpack_do_after_markdown_activation() {
// When Markdown is activated, enable support for post editing automatically.
update_option( 'wpcom_publish_posts_with_markdown', true );
}
add_action( 'jetpack_activate_module_markdown', 'jetpack_do_after_markdown_activation' );
). So every activation turns the posts option on, as on the old screen. Only the comments option survives off and on. The modules store refetches after the switch, so the panel shows the new value. Only the table, and what testers expect, need fixing.

Related, and older than this PR: Jetpack::plugin_upgrade() turns the posts option back on at every Jetpack version change, whether or not the module is on (

// Make sure Markdown for posts gets turned back on.
if ( ! get_option( 'wpcom_publish_posts_with_markdown' ) ) {
update_option( 'wpcom_publish_posts_with_markdown', true );
}
). With this panel, "module on, posts off" becomes the normal way to stop Markdown in posts, so that choice reverts at the next update. Probably a follow-up issue rather than this PR.

Generated by Claude.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, thanks. I fixed the table row in the description: activation sets the posts option, and only the comments option survives off and on. Filed the plugin_upgrade() reset as a follow-up: JETPACK-3729.

Comment on lines +281 to +282
// The panel needs Features, which users who cannot manage modules lack.
isMarkdownMoved: isSettingsConsolidationEnabled() && userCanManageModules( state ),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[suggestion] This gate is written twice, here and in discussion/index.jsx (L73-L79). The comment repeats the reason already in the isSwitchedInFeatures() docblock (

* Users who cannot manage modules have no Features, so they keep the toggle.
*
* @param {object} state - Global state tree.
* @param {string} module - Module slug.
* @return {boolean} True when Features switches the module instead.
*/
export function isSwitchedInFeatures( state, module ) {
if ( ! isSettingsConsolidationEnabled() || ! userCanManageModules( state ) ) {
), and Post by Email does the same check inline (
( isSettingsConsolidationEnabled() && this.props.userCanManageModules ? (
). A helper next to isSwitchedInFeatures(), say isInSettingsPanel( state, module ), would hold the gate and its reason in one place. The Comments panel (JETPACK-3720) needs it next, so it can wait for that PR.

Generated by Claude.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in #54903 (d368df3): isInSettingsPanel( state ) next to isSwitchedInFeatures(), used by Composing, Discussion and Post by Email. It takes no module, so it needs no JS copy of SETTINGS_PANEL_MODULES.

"matching": "`everySource` runs before any route or term rule. A term matches its decoded value, case-insensitively, before its route; an unmatched term falls back to its route. On page=jetpack-settings, an empty hash (the bare menu link) or an unknown route gets the /settings rules, as main.jsx does. On page=jetpack, an unknown route never reaches these rules: the forwarder (Jetpack_React_Page::get_legacy_route_redirects()) sends it to My Jetpack for admins and to Settings for everyone else, as it does today, so #/my-plan, #/dashboard and #/stats keep landing on My Jetpack. In each list, the first rule whose `when` all hold wins, and a rule without `when` is the default. A rule with `pending` keeps the source on Settings until each marker clears: `D<n>` is an open decision, `JETPACK-<n>` an issue that must land, `flag:<name>` a feature flag that must retire, `error-notice-home` a new home for the Jetpack::state( 'error' ) notice, which only Settings shows today, and `monetize-page` a Monetize page that shows the Ads settings (its flag on and the `monetize` module active), without which the Ads settings stay on Settings. A `destination` next to `pending` is where the source goes once it clears. A settings panel destination (`configure=`) waits on the issue that gives the panel that module's settings, since until then the panel's fallback links back here through configure_url. Destinations are relative to wp-admin. My Jetpack `#/` links work on every My Jetpack version, since its router rewrites them to `?p=`.",
"decisions": {
"D2": "Whether Comments' settings (with Gravatar Hovercards and Markdown for comments) get one settings panel or become Features switches, and where the Markdown option goes.",
"D2": "Whether Comments' settings (with Gravatar Hovercards) get one settings panel or become Features switches.",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[suggestion] D2 is decided: JETPACK-3720 opens with "Decided on 2026-11-12 (D2)". The map's matching text uses D<n> for an open decision and JETPACK-<n> for an issue that must land, so this entry now lists a decided question as open. The comments, gravatar-hovercards and /discussion entries could become pending: [ "JETPACK-3720" ], and D2 could go now. 3720 plans to drop D2 once both issues are done, and this swap keeps the map accurate until then.

Generated by Claude.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 2610240: the three entries now wait on JETPACK-3720, and D2 is gone.

@CGastrell

Copy link
Copy Markdown
Contributor Author

The two #/writing links (Unavailable Blocks fixUrl, wpcomsh notice) are filed as JETPACK-3730, to fix before the flag retires.

CGastrell and others added 3 commits November 12, 2026 18:40
Behind the my-jetpack-settings-consolidation flag. Configure on Markdown
opens a panel with the module switch and the posts and comments options.
Settings hides the Markdown controls for users who can manage modules,
and a search for Markdown points to the panel.
With settings consolidation on, every Writing card has moved, so admins
get no Writing tab and #/writing opens Features.
D2 is decided, so the comments, gravatar-hovercards and /discussion
entries now wait on the issue that moves them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@CGastrell
CGastrell force-pushed the change/settings-markdown-panel branch from 2610240 to 256d554 Compare November 12, 2026 21:40
/writing gets alreadyRedirects, since main.jsx redirects it. Users who
cannot manage modules keep /performance until D9, as on /writing and
/reader.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@CGastrell CGastrell added Covered by non-unit tests Use to ignore the Code coverage requirement check when E2Es or other non-unit tests cover the code and removed [Status] In Progress labels Nov 13, 2026
@github-actions github-actions Bot added the [Status] Needs Author Reply We need more details from you. This label will be auto-added until the PR meets all requirements. label Nov 13, 2026
@CGastrell CGastrell added [Status] Needs Review This PR is ready for review. and removed [Status] Needs Author Reply We need more details from you. This label will be auto-added until the PR meets all requirements. labels Nov 13, 2026
@CGastrell
CGastrell merged commit 82de2a2 into trunk Nov 13, 2026
132 of 136 checks passed
@CGastrell
CGastrell deleted the change/settings-markdown-panel branch November 13, 2026 14:13
@github-actions github-actions Bot added this to the jetpack/16.5 milestone Nov 13, 2026
@github-actions github-actions Bot added [Status] UI Changes Add this to PRs that change the UI so documentation can be updated. and removed [Status] Needs Review This PR is ready for review. labels Nov 13, 2026
@simison

simison commented Nov 13, 2026

Copy link
Copy Markdown
Member
image

Does this work on block editor pages btw anymore? There's the markdown block now, so maybe this setting can be shown just for classic themes/classic block users?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Admin Page React-powered dashboard under the Jetpack menu Covered by non-unit tests Use to ignore the Code coverage requirement check when E2Es or other non-unit tests cover the code [Package] My Jetpack [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Status] UI Changes Add this to PRs that change the UI so documentation can be updated. [Tests] Includes Tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants