MediaWiki extension that allows embedding external content

Related tags

CMS ExternalContent
Overview

External Content

GitHub Workflow Status codecov Type Coverage Psalm level Latest Stable Version Download count License

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

External Content has been created and is maintained by Professional.Wiki.

Usage

Embedding external content

External content can be embedded via the #embed parser function. This function takes a URL. Currently only markdown is supported.

Example:

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

Embedding Bitbucket content

Content from Bitbucket can be embedded via the #bitbucket parser function.

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

  • Validation that the URL matches has 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/kittens/browse}}
{{#bitbucket:https://git.example.com/projects/HI/repos/kittens/raw/README.md?at=refs%2Fheads%2Fmaster}}

RefreshExternalContent.php script

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

Platform requirements:

The recommended way to install Wikibase EDTF is using Composer with MediaWiki's built-in support for 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:~1.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 file:

wfLoadExtension( 'ExternalContent' );

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

Configuration

Configuration can be changed via LocalSettings.php.

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

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

Variable: $wgExternalContentFileExtensionWhitelist

Default: [ 'md' ]

Example: [ 'md', 'txt' ]

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

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

If the #bitbucket parser function should be enabled.

Variable: $wgExternalContentEnableBitbucketFunction

Default: true

Example: false - disables the #bitbucket parser function

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.

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

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

Version 1.0.0 - 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
Comments
  • Embedding source external content

    Embedding source external content

    Exist any way how embed source external content (not only markdown). For example, how embed source file(s) from GitHub

    https://github.com/ProfessionalWiki/ExternalContent/blob/master/tests/TestEnvironment.php
    

    to wiki with ExternalContent extension ?

    opened by musinsky 3
  • Make rendered content searchable

    Make rendered content searchable

    Requirements

    Search should include embedded content. Preferably it also does not include the parser function wikitext itself.

    Needs to work with on wikis that have this search:

    And preferably also:

    • Standard MediaWiki (ie MySQL search)
    opened by JeroenDeDauw 3
  • Create absolute links having 'browse' as the default in the parsed document.

    Create absolute links having 'browse' as the default in the parsed document.

    I created a KH page from bitbucket using the following URL: https://git.pega.io/projects/PS/repos/rulebase-service/browse/README.md Notice browse in the URL.

    When importing, all relative links on the page have been replaced with links to bitbucket, but to their raw instead of browse format. So the import created links like this: https://git.pega.io/projects/PS/repos/rulebase-service/raw/README.md Notice raw in the URL.

    As a consequence, while the imported .md file renders nicely, following any link leads to raw, unformatted pages. Would it be possible to convert relative links to absolute using the same prefix as in the imported URL (or default to 'browse')?

    enhancement 
    opened by freephile 2
  • About

    About "whitelist" → "allowlist"

    I know that sooner or later someone will talk about how we name things and "whitelist" and "blacklist" etc. :D

    If interested, here you can read more about why some people may like to migrate from "whitelist" to "allowlist" or something like that:

    https://phabricator.wikimedia.org/T254646

    (P.S. No one will accuse you of supporting slavery or being a fascist if you mark this as wontfix. Honestly, I've made this issue just because I know about this topic, and nothing more. Thank you for your work! I'm sorry this this polemic exists in the software world.)

    opened by valerio-bozzolan 0
  • feature: add Cache expiry settings

    feature: add Cache expiry settings

    Jeroen, this is my first attempt.

    I know I can't call updateCacheExpiry() on a null parser object (see error) but I'm not sure what to do... I was going to check hooks and see if it needs to be implemented in a different hook function besides onParserFirstCallInit()

    Error from line 23 of /var/www/html/extensions/ExternalContent/src/EntryPoints/MediaWikiHooks.php: Call to a member function updateCacheExpiry() on null

    Can you look at my efforts and give me any feedback?

    Aside: I would normally do this in a feature branch, but had some trouble getting VSCode in a container to work with GitHub, and the terminal was constrained (no prompts) so I had to do some docker file copies back to my host machine and then still ended up pushing to 'master' in my forked repo :-(

    opened by freephile 0
Releases(1.3.0)
Owner
Professional Wiki
Professional.Wiki provides holistic wiki consulting and services for companies.
Professional Wiki
NukeViet 132 Nov 27, 2022
A Concrete CMS package to add interfaces to translate multilingual content. You can translate content manually, or use cloud API.

Concrete CMS add-on: Macareux Content Translator Concrete CMS has powerful features to manage multilingual content by its default. You can add languag

株式会社マカルーデジタル 3 Nov 28, 2022
The repository for Coaster CMS (coastercms.org), a full featured, Laravel based Content Management System

The repository for Coaster CMS (coastercms.org) a Laravel based Content Management System with advanced features and Physical Web integration. Table o

Coaster CMS 392 Dec 23, 2022
A Joomla 4 system plugin to make editing content distraction free.

Clean Edit for Joomla 4 A system plugin to make editing content in the front end of your Joomla 4 website distraction free. Why? On a complex site or

Brian Teeman 5 Dec 30, 2022
phpReel is a free, MIT open-source subscription-based video streaming service that lets you create your platform for distributing video content in the form of movies or series.

phpReel is a free, MIT open-source subscription-based video streaming service that lets you create your platform for distributing video content in the form of movies or series.

null 118 Dec 14, 2022
Core framework that implements the functionality of the Sulu content management system

Sulu is a highly extensible open-source PHP content management system based on the Symfony framework. Sulu is developed to deliver robust multi-lingua

Sulu CMS 921 Dec 28, 2022
Fully CMS - Multi Language Content Management System - Laravel

Fully CMS Laravel 5.1 Content Managment System not stable! Features Laravel 5.1 Bootstrap Authentication Sentinel Ckeditor Bootstrap Code Prettify Fil

Sefa Karagöz 479 Dec 22, 2022
Flextype is an open-source Hybrid Content Management System with the freedom of a headless CMS and with the full functionality of a traditional CMS

Flextype is an open-source Hybrid Content Management System with the freedom of a headless CMS and with the full functionality of a traditional CMS. Building this Content Management System, we focused on simplicity. To achieve this, we implemented a simple but powerful API's.

Flextype 524 Dec 30, 2022
Soosyze CMS is a minimalist content management system in PHP, without database to create and manage your website easily

Soosyze CMS is a content management system without a database. It's easy to create and manage you

Soosyze 41 Jan 6, 2023
wallabag is a self-hostable PHP application allowing you to not miss any content anymore

What is wallabag? wallabag is a self-hostable PHP application allowing you to not miss any content anymore. Click, save and read it when you can. It e

wallabag 7.7k Jan 4, 2023
ExpressionEngine is a flexible, feature-rich, free open-source content management platform that empowers hundreds of thousands of individuals and organizations around the world to easily manage their web site.

ExpressionEngine CMS ExpressionEngine is a mature, flexible, secure, free open-source content management system. It is beloved by designers for giving

ExpressionEngine 412 Dec 27, 2022
A small CMS for SaaS - A tiny content management system

Fervoare CMS A tiny content management system Project created in 2012 and ported to GitHub in 2021. Getting started Assuming you have installed a LAMP

Mark Jivko 3 Oct 1, 2022
Edit richt text content in Craft CMS using Article by Imperavi.

Article Editor About the plugin This plugin brings the powerful Article Editor from Imperavi to Craft CMS, allowing you to make create beautiful rich

Creativeorange 6 Mar 30, 2022
Baicloud CMS is a lightweight content management system (CMS) based on PHP and MySQL and running on Linux, windows and other platforms

BaiCloud-cms About BaiCloud-cms is a powerful open source CMS that allows you to create professional websites and scalable web applications. Visit the

null 5 Aug 15, 2022
Simple Content Management System (CMS) Blog Using Codeigniter with Hierarchical Model View Controller (HMVC) Architectural

Simple Content Management System (CMS) Blog Using Codeigniter with Hierarchical Model View Controller (HMVC) Architectural This is my source code trai

Simon Montaño 1 Oct 28, 2021
Simple, modular content management system adapted for launch pages and one-page websites

Segmint Segmint is an easy-to-use flat-file landing page framework, allowing quick and efficient prototyping and deployment - perfect for freelancers

null 2 Jul 19, 2022
Monstra is a modern and lightweight Content Management System.

Monstra is a modern and lightweight Content Management System.

Monstra Content Management 398 Dec 11, 2022
Coaster CMS a full featured, Laravel based Content Management System

The repository for Coaster CMS (coastercms.org) a Laravel based Content Management System with advanced features and Physical Web integration. Table o

Coaster CMS 392 Dec 23, 2022
ExpressionEngine is a mature, flexible, secure, free open-source content management system.

ExpressionEngine is a flexible, feature-rich, free open-source content management platform that empowers hundreds of thousands of individuals and organizations around the world to easily manage their web site.

ExpressionEngine 366 Mar 29, 2022