Making WordPress.org

Opened 20 months ago

Closed 20 months ago

Last modified 20 months ago

#6538 closed defect (bug) (fixed)

wporg-markdown importer - Support GitHub branches not named `master`

Reported by: netweb's profile netweb Owned by: dd32's profile dd32
Milestone: Priority: normal
Component: Handbooks Keywords:
Cc:

Description

Currently the get_markdown_edit_link() function hard codes the GitHub edit link to master: (Source)

		if ( 'github.com' !== parse_url( $markdown_source, PHP_URL_HOST )
			|| false !== stripos( $markdown_source, '/edit/master/' ) ) {
			return $markdown_source;
		}
		$markdown_source = str_replace( '/blob/master/', '/edit/master/', $markdown_source );

Discovered after merging https://github.com/WordPress/WordPress-Documentation-Style-Guide/pull/20 where the default branch is main, prior to merging the above PR the GitHub "edit" URL on pages were in the form:

The above URL format 404s as the master branch no longer exists on GitHub

The new "edit" URL on pages is:

And as such the URL doesn't include /edit/main, just /main, so the URL opens correctly just not in the previous "edit" mode.

My suggestion would be to update the above function to account for common dotorg repo branch names used: trunk, main, and master

Change History (3)

This ticket was mentioned in Slack in #docs by netweb. View the logs.


20 months ago

#2 @dd32
20 months ago

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

In 12118:

Markdown Importer: Support any branch in the imported content, not just master.

Fixes #6538.

#3 @dd32
20 months ago

  • Component changed from WordPress.org Site to Handbooks
Note: See TracTickets for help on using tickets.