Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions extension.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,17 @@
"CodeEditorGetPageLanguage": "ProfessionalWiki\\NativeMarkdown\\EntryPoints\\NativeMarkdownHooks::onCodeEditorGetPageLanguage"
},

"ResourceFileModulePaths": {
"localBasePath": "resources",
"remoteExtPath": "NativeMarkdown"
},

"ResourceModules": {
"ext.nativeMarkdown.styles": {
"styles": [ "ext.nativeMarkdown.styles.css" ]
}
},

"config": {
"NativeMarkdownNamespaces": {
"description": "Namespaces (IDs) in which new pages default to the markdown content model.",
Expand Down
9 changes: 9 additions & 0 deletions resources/ext.nativeMarkdown.styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/* Skins style the bare `code` element for inline code (background, border,
padding). CommonMark nests `code` inside `pre` for fenced code blocks, a
combination wikitext never produces, so that inline styling paints a pill
per line there. Reset it; the `pre` container provides the block styling. */
.mw-parser-output pre > code {
background-color: transparent;
border: 0;
padding: 0;
}
1 change: 1 addition & 0 deletions src/EntryPoints/MarkdownContentHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ protected function fillParserOutput( Content $content, ContentParseParams $cpoPa
);

$output->setFromParserOptions( $cpoParams->getParserOptions() );
$output->addModuleStyles( [ 'ext.nativeMarkdown.styles' ] );

$this->registerLinks( $output, $rendered );
$this->registerCategories( $output, $rendered );
Expand Down
6 changes: 6 additions & 0 deletions tests/phpunit/EntryPoints/MarkdownContentHandlerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ public function testRendersMarkdownAsHtml(): void {
$this->assertStringContainsString( '<strong>bold</strong>', $output->getRawText() );
}

public function testAddsCodeBlockStyleModule(): void {
$output = $this->getParserOutput( "```python\nprint(42)\n```" );

$this->assertContains( 'ext.nativeMarkdown.styles', $output->getModuleStyles() );
}

public function testRegistersInternalLinks(): void {
$output = $this->getParserOutput( 'See [[Linked Page]] and [[Another One|label]]' );

Expand Down
Loading