PHPackages                             professional-wiki/external-content - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. professional-wiki/external-content

ActiveMediawiki-extension[Parsing &amp; Serialization](/categories/parsing)

professional-wiki/external-content
==================================

MediaWiki extension that allows embedding external content, specified by URL, into your wiki pages

3.0.1(1y ago)84.4k↓22.7%7[4 PRs](https://github.com/ProfessionalWiki/ExternalContent/pulls)GPL-2.0-or-laterPHPPHP &gt;=8.0CI passing

Since Sep 30Pushed 3mo ago6 watchersCompare

[ Source](https://github.com/ProfessionalWiki/ExternalContent)[ Packagist](https://packagist.org/packages/professional-wiki/external-content)[ Docs](https://professional.wiki/en/extension/external-content)[ GitHub Sponsors](https://github.com/JeroenDeDauw)[ RSS](/packages/professional-wiki-external-content/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (8)Dependencies (8)Versions (13)Used By (0)

External Content
================

[](#external-content)

[![GitHub Workflow Status](https://camo.githubusercontent.com/2e2a419f0766f241b29e3cf78080be477c0a625d7e39c2c3cfdb40d7e11a3d2f/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f50726f66657373696f6e616c57696b692f45787465726e616c436f6e74656e742f63692e796d6c3f6272616e63683d6d6173746572)](https://github.com/ProfessionalWiki/ExternalContent/actions?query=workflow%3ACI)[![codecov](https://camo.githubusercontent.com/e8866c3929877c950a1119d148b739d8368e678eaf20e956325971431abf3d0d/68747470733a2f2f636f6465636f762e696f2f67682f50726f66657373696f6e616c57696b692f45787465726e616c436f6e74656e742f6272616e63682f6d61737465722f67726170682f62616467652e7376673f746f6b656e3d476e4f4733464631365a)](https://codecov.io/gh/ProfessionalWiki/ExternalContent)[![Type Coverage](https://camo.githubusercontent.com/bed10d8aa3e6384ea274cfb39d77e9aed50ddd87293275cba803cc1bb83c8c46/68747470733a2f2f73686570686572642e6465762f6769746875622f50726f66657373696f6e616c57696b692f45787465726e616c436f6e74656e742f636f7665726167652e737667)](https://shepherd.dev/github/ProfessionalWiki/ExternalContent)[![Psalm level](https://camo.githubusercontent.com/e9b1582043870fdce3c571fa57b6eeb60531f3df5e8357e7d68b027701c26da3/68747470733a2f2f73686570686572642e6465762f6769746875622f50726f66657373696f6e616c57696b692f45787465726e616c436f6e74656e742f6c6576656c2e737667)](psalm.xml)[![Latest Stable Version](https://camo.githubusercontent.com/55fa3567426d6b389de3792e613ac0928111226751352a00ef85d0eea5bfa740/68747470733a2f2f706f7365722e707567782e6f72672f70726f66657373696f6e616c2d77696b692f65787465726e616c2d636f6e74656e742f762f737461626c65)](https://packagist.org/packages/professional-wiki/external-content)[![Download count](https://camo.githubusercontent.com/e8da0a4f46ea8631f855d4b1dd8b9d02bd255d705ab7df444218a48831ca31cf/68747470733a2f2f706f7365722e707567782e6f72672f70726f66657373696f6e616c2d77696b692f65787465726e616c2d636f6e74656e742f646f776e6c6f616473)](https://packagist.org/packages/professional-wiki/external-content)[![License](https://camo.githubusercontent.com/b97e55bd0d91b076c2c4765f76bfc5f9f3d5b296ec8a1be5157b2515cfdfa14f/68747470733a2f2f706f7365722e707567782e6f72672f70726f66657373696f6e616c2d77696b692f65787465726e616c2d636f6e74656e742f6c6963656e7365)](LICENSE)

[MediaWiki](https://www.mediawiki.org) extension that allows embedding external content, specified by URL, into your wiki pages.

External Content has been created and is maintained by [Professional Wiki](https://professional.wiki/en/mediawiki-development).

- [Usage](#usage)
- [Installation](#installation)
- [Configuration](#configuration)
- [Development](#development)
- [Release notes](#release-notes)

Usage
-----

[](#usage)

[![](.github/youtube.png "Play video")](https://www.youtube.com/watch?v=U65NhBwnCMU)

### Embedding external content

[](#embedding-external-content)

External content can be embedded via the `#embed` [parser function](https://www.mediawiki.org/wiki/Help:Magic_words). This function takes a URL. Markdown and code syntax highlighting are supported. No additional parameters are needed to render the markdown. To use code syntax highlighting, refer to the [parameters](#code-syntax-highlighting-parameters) below.

Example:

```
{{#embed:https://example.com/fluffy/kittens.md}}

```

There is special handling for GitHub URLs, removing the need to provide the raw file URL:

- github.com/org/repo/blob/master/hi.md =&gt; raw.githubusercontent.com/org/repo/master/hi.md
- github.com/org/repo/tree/master/src =&gt; defaults to README.md in the directory
- github.com/org/repo =&gt; defaults to the README.md in the repository root on the `master` branch

### Embedding Bitbucket content

[](#embedding-bitbucket-content)

Content from Bitbucket can be embedded via the `#bitbucket` [parser function](https://www.mediawiki.org/wiki/Help:Magic_words).

This function takes a URL and includes the following Bitbucket-specific behavior:

- Validation that the URL matches the Bitbucket repository structure
- `/browse` URLs are automatically turned into `/raw` URLs
- Pointing to the repository root will automatically retrieve `README.md`

Example:

```
{{#bitbucket:https://git.example.com/projects/HI/repos/cats/browse}}
{{#bitbucket:https://git.example.com/projects/HI/repos/cats/raw/README.md?at=refs%2Fheads%2Fmaster}}

```

### Display parameters

[](#display-parameters)

Both `#embed` and `#bitbucket` can be customized with these parameters:

- `lang`: (Optional) One of the [supported languages](https://prismjs.com/#supported-languages). Only necessary if the language is not detected from the file extension.
- `lineNumbers`: (Optional) Show line numbers.
- `showLines`: (Optional) Show only specific lines. It can be a single line number or a range separated with a hyphen (-). Multiple line numbers or ranges can be separated by commas.
- `render`: (Optional) render Markdown (this is the default behavior unless `$wgExternalContentRenderMarkdownByDefault` is changed)

Examples:

Show Markdown file contents in a code block:

```
{{#embed:https://example.com/fluffy/kittens.md|lang=markdown}}

```

Show code block with line numbers:

```
{{#embed:https://example.com/fluffy/kittens.php|lang=php|line}}

```

Show only specific lines in a code block:

```
{{#embed:https://example.com/fluffy/kittens.php|lang=php|showLines=1-3,8}}

```

Render file as Markdown:

```
{{#embed:https://example.com/fluffy/kittens.php|render}}

```

### Refreshing external content

[](#refreshing-external-content)

To refresh all the pages containing one of the parser functions added by this extension, run

```
php extensions/ExternalContent/maintenance/RefreshExternalContent.php

```

Parameters: none

Installation
------------

[](#installation)

Platform requirements:

- [PHP](https://www.php.net) 8.0 or later (tested up to 8.3)
- [MediaWiki](https://www.mediawiki.org) 1.39 or later (tested up to 1.43 and master)

The recommended way to install External Content is using [Composer](https://getcomposer.org) with [MediaWiki's built-in support for Composer](https://professional.wiki/en/articles/installing-mediawiki-extensions-with-composer).

On the commandline, go to your wikis root directory. Then run these two commands:

```
COMPOSER=composer.local.json composer require --no-update professional-wiki/external-content:~3.0
```

```
composer update professional-wiki/external-content --no-dev -o
```

Then enable the extension by adding the following to the bottom of your wikis [LocalSettings.php](https://www.mediawiki.org/wiki/Manual:LocalSettings.php) file:

```
wfLoadExtension( 'ExternalContent' );
```

You can verify the extension was enabled successfully by opening your wiki's Special:Version page in your browser.

Configuration
-------------

[](#configuration)

Configuration can be changed via [LocalSettings.php](https://www.mediawiki.org/wiki/Manual:LocalSettings.php).

### Rendering markdown

[](#rendering-markdown)

By default, markdown is rendered rather than shown in a code block.

Variable: `$wgExternalContentRenderMarkdownByDefault`

Default: `true` - markdown is rendered (unless otherwise specified by the user)

Example: `false` - markdown is shown as a code block (unless otherwise specified by the user)

### Domain whitelist

[](#domain-whitelist)

List of allowed domains to embed content from. Leave empty to have no restriction.

Variable: `$wgExternalContentDomainWhitelist`

Default: `[]`

Example: `[ 'git.example.com', 'another.example.com' ]`

### File extension whitelist

[](#file-extension-whitelist)

List of allowed file extensions. Leave empty to have no restriction.

Variable: `$wgExternalContentFileExtensionWhitelist`

Default: `[]`

Example: `[ 'md', 'txt' ]`

Caution: The extension currently only supports markdown: any retrieved file content will be rendered ask markdown.

### Enable embed function

[](#enable-embed-function)

If the `#embed` parser function should be enabled.

Variable: `$wgExternalContentEnableEmbedFunction`

Default: `true`

Example: `false` - disables the `#embed` parser function

### Enable bitbucket function

[](#enable-bitbucket-function)

If the `#bitbucket` parser function should be enabled.

Variable: `$wgExternalContentEnableBitbucketFunction`

Default: `true`

Example: `false` - disables the `#bitbucket` parser function

### Basic Auth credentials

[](#basic-auth-credentials)

Per-domain Basic Auth credentials.

Variable: `$wgExternalContentBasicAuthCredentials`

Default: `[]`

Example:

```
$wgExternalContentBasicAuthCredentials = [
	'git.example.com' => [ 'ExampleUser', 'ExamplePassword' ],
	'another.example.com' => [ getenv( 'BITBUCKET_USER' ), getenv( 'BITBUCKET_PASSWORD' ) ]
];
```

The above example shows how you can get credentials from ENV vars, which might be preferred over storing them as plaintext in [LocalSettings.php](https://www.mediawiki.org/wiki/Manual:LocalSettings.php).

### Connection details

[](#connection-details)

The content of files is fetched via MediaWiki's native HTTP client. This process is affected by various [HTTP client variables](https://www.mediawiki.org/wiki/Category:HTTP_client_variables).

### Search

[](#search)

In stock MediaWiki with no extensions, embedded content is not searchable. To make embedded content show up in search results, install Elasticseach and the [CirrusSearch extension](https://www.mediawiki.org/wiki/Extension:CirrusSearch).

Development
-----------

[](#development)

To ensure the dev dependencies get installed, have this in your `composer.local.json`:

```
{
	"require": {
		"vimeo/psalm": "^4.10",
		"phpstan/phpstan": "^0.12.99"
	},
	"extra": {
		"merge-plugin": {
			"include": [
				"extensions/ExternalContent/composer.json"
			]
		}
	}
}
```

### Running tests and CI checks

[](#running-tests-and-ci-checks)

You can use the `Makefile` by running make commands in the `ExternalContent` directory.

- `make ci`: Run everything
- `make test`: Run all tests
- `make cs`: Run all style checks and static analysis

Alternatively, you can execute commands from the MediaWiki root directory:

- PHPUnit: `php tests/phpunit/phpunit.php -c extensions/ExternalContent/`
- Style checks: `vendor/bin/phpcs -p -s --standard=extensions/ExternalContent/phpcs.xml`
- PHPStan: `vendor/bin/phpstan analyse --configuration=extensions/ExternalContent/phpstan.neon --memory-limit=2G`
- Psalm: `php vendor/bin/psalm --config=extensions/ExternalContent/psalm.xml`

Release notes
-------------

[](#release-notes)

### Version 3.0.1 - 2025-04-06

[](#version-301---2025-04-06)

- Fixed compatibility with MediaWiki 1.43 and above (IDatabase TypeError)

### Version 3.0.0 - 2025-04-04

[](#version-300---2025-04-04)

- Raised minimum MediaWiki version from 1.35 to 1.39
- Added support for MediaWiki 1.40, 1.41, 1.42, and 1.43
- Translation updates

### Version 2.0.1 - 2023-11-02

[](#version-201---2023-11-02)

- Fixed behavior of the copy button for code blocks with line numbers and/or only specific lines shown
- Improved display of long lines in code blocks by adding line wrapping

### Version 2.0.0 - 2023-10-30

[](#version-200---2023-10-30)

- Raised minimum PHP version from 7.4 to 8.0
- Added code syntax highlighting
    - Added `lang` parameter
    - Added `lineNumbers` parameter
    - Added `showLines` parameter
    - Added `render` parameter
    - Added copy button to code blocks
    - Added edit link to Bitbucket code blocks

### Version 1.3.0 - 2022-01-08

[](#version-130---2022-01-08)

- Improved handling of relative links. They now point to the "browse" version when embedding using a "browse" URL, rather than using the "raw" version.

### Version 1.2.0 - 2021-12-02

[](#version-120---2021-12-02)

- Added support for [extended syntax markdown](https://www.markdownguide.org/extended-syntax/)

### Version 1.1.0 - 2021-11-01

[](#version-110---2021-11-01)

- Added normalization for github.com URLs to the `#embed` parser function

### Version 1.0.0 - 2021-09-30

[](#version-100---2021-09-30)

Initial release for MediaWiki 1.35+ with these features:

- Embedding of markdown files via `#embed` parser function
- Special support for Bitbucket URLs via the` #bitbucket` parser function
- Restricting of source domains via the `$wgExternalContentDomainWhitelist` setting
- Restricting of file extensions via the `$wgExternalContentDomainWhitelist` setting
- Support for Basic Auth via the `$wgExternalContentBasicAuthCredentials` setting
- Ability to turn off `#embed` via the `$wgExternalContentEnableEmbedFunction` setting
- Ability to turn off `#bitbucket` via the `$wgExternalContentEnableBitbucketFunction` setting
- Ability to refresh all embedded content via the `RefreshExternalContent.php` maintenance script
- Ability to view pages with embedded content via the `Pages with external content` category
- Ability to view pages with broken embedded content via the `Pages with broken external content` category

###  Health Score

47

—

FairBetter than 94% of packages

Maintenance65

Regular maintenance activity

Popularity31

Limited adoption so far

Community22

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 54% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~183 days

Recently: every ~296 days

Total

8

Last Release

407d ago

Major Versions

1.3.0 → 2.0.02023-10-30

2.0.1 → 3.0.02025-04-04

PHP version history (2 changes)1.0.0PHP &gt;=7.4

2.0.0PHP &gt;=8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/451bd4039d530fed8f9c3da91bfa519233a397d2182cdfdcad700f6cfea19b7f?d=identicon)[Jeroen De Dauw](/maintainers/Jeroen%20De%20Dauw)

![](https://avatars.githubusercontent.com/u/1104078?v=4)[Karsten Hoffmeyer](/maintainers/kghbln)[@kghbln](https://github.com/kghbln)

---

Top Contributors

[![JeroenDeDauw](https://avatars.githubusercontent.com/u/146040?v=4)](https://github.com/JeroenDeDauw "JeroenDeDauw (102 commits)")[![translatewiki](https://avatars.githubusercontent.com/u/24829418?v=4)](https://github.com/translatewiki "translatewiki (48 commits)")[![malberts](https://avatars.githubusercontent.com/u/1428594?v=4)](https://github.com/malberts "malberts (16 commits)")[![myousuffazal](https://avatars.githubusercontent.com/u/5208120?v=4)](https://github.com/myousuffazal "myousuffazal (11 commits)")[![alistair3149](https://avatars.githubusercontent.com/u/9260542?v=4)](https://github.com/alistair3149 "alistair3149 (5 commits)")[![kghbln](https://avatars.githubusercontent.com/u/1104078?v=4)](https://github.com/kghbln "kghbln (4 commits)")[![freephile](https://avatars.githubusercontent.com/u/38368?v=4)](https://github.com/freephile "freephile (1 commits)")[![cscott](https://avatars.githubusercontent.com/u/156080?v=4)](https://github.com/cscott "cscott (1 commits)")[![Universal-Omega](https://avatars.githubusercontent.com/u/54654040?v=4)](https://github.com/Universal-Omega "Universal-Omega (1 commits)")

---

Tags

mediawikimediawiki-extensionmediawikimarkdownbitbucketgithubgitembedparser function

###  Code Quality

Static AnalysisPHPStan, Psalm

Type Coverage Yes

### Embed Badge

![Health badge](/badges/professional-wiki-external-content/health.svg)

```
[![Health](https://phpackages.com/badges/professional-wiki-external-content/health.svg)](https://phpackages.com/packages/professional-wiki-external-content)
```

###  Alternatives

[league/commonmark

Highly-extensible PHP Markdown parser which fully supports the CommonMark spec and GitHub-Flavored Markdown (GFM)

3.0k404.0M702](/packages/league-commonmark)[jeroen/mediawiki-github

Simple MediaWiki extension for embedding GitHub hosted content in wiki pages. Supports markdown rendering and syntax highlighting.

334.4k](/packages/jeroen-mediawiki-github)[ion-bazan/composer-diff

Compares composer.lock changes and generates Markdown report so you can use it in PR description.

1861.8M3](/packages/ion-bazan-composer-diff)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
