Making WordPress.org

Changeset 7658


Ignore:
Timestamp:
09/11/2018 05:53:50 AM (6 years ago)
Author:
dd32
Message:

Gutenberg Docs Importer: Attempt to handle relative .md links with anchor tags.

See #3780.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/gutenberg/inc/docs-importer.php

    r7598 r7658  
    277277
    278278        // Remove the .md extension from relative links
    279         $markdown = preg_replace( '/(\[.*?\]\((\.\.\/)+.*?)(\.md)?\)/i', '$1)', $markdown );
     279        $markdown = preg_replace( '/(\[.*?\]\((\.\.\/)+.*?)(\.md)?(#.*)?\)/i', '$1$4)', $markdown );
    280280
    281281        // Remove the (../)*docs/ path from relative links, and replace it with an absolute URL
    282         $markdown = preg_replace( '/(\[.*?\])\((\.\.\/)+docs\/(.*?)\/?\)/i', '$1(https://wordpress.org/gutenberg/handbook/$3/)', $markdown );
     282        $markdown = preg_replace( '/(\[.*?\])\((\.\.\/)+docs\/(.*?)\/?(#.*)?\)/i', '$1(https://wordpress.org/gutenberg/handbook/$3/$4)', $markdown );
    283283
    284284        // Transform to HTML
Note: See TracChangeset for help on using the changeset viewer.