Author: Derick Rethans (derickr)
Date: 2024-11-11T11:53:33Z
Commit: Fixed bug in Commonmark plugin · php/web-wiki@01f680a · GitHub
Raw diff: https://github.com/php/web-wiki/commit/01f680a0c6b3b6c2689803d7fd16c992f7647ea0.diff
Fixed bug in Commonmark plugin
Changed paths:
M Dockerfile
M dokuwiki/lib/plugins/commonmark/src/Dokuwiki/Plugin/Commonmark/DWRenderer.php
M dokuwiki/lib/plugins/commonmark/src/Dokuwiki/Plugin/Commonmark/Extension/CommonmarkToDokuwikiExtension.php
Diff:
diff --git a/Dockerfile b/Dockerfile
index d6ff30c4..f41dd9be 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,3 +1,10 @@
FROM php:8.2-apache
+RUN pecl install xdebug
+RUN echo "zend_extension=xdebug" > /usr/local/etc/php/conf.d/99-xdebug.ini
+RUN echo "xdebug.mode=debug" >> /usr/local/etc/php/conf.d/99-xdebug.ini
+RUN echo "xdebug.client_host=xdebug://gateway" >> /usr/local/etc/php/conf.d/99-xdebug.ini
+#RUN echo "xdebug.log=xdebug.log" >> /usr/local/etc/php/conf.d/99-xdebug.ini
+#RUN echo "xdebug.log_level=11" >> /usr/local/etc/php/conf.d/99-xdebug.ini
+
RUN a2enmod rewrite
diff --git a/dokuwiki/lib/plugins/commonmark/src/Dokuwiki/Plugin/Commonmark/DWRenderer.php b/dokuwiki/lib/plugins/commonmark/src/Dokuwiki/Plugin/Commonmark/DWRenderer.php
index cce7d06f..a02984bd 100644
--- a/dokuwiki/lib/plugins/commonmark/src/Dokuwiki/Plugin/Commonmark/DWRenderer.php
+++ b/dokuwiki/lib/plugins/commonmark/src/Dokuwiki/Plugin/Commonmark/DWRenderer.php
@@ -91,7 +91,7 @@ public function renderNode(Node $node)
return $result;
}
}
-return "";
+
throw new \RuntimeException('Unable to find corresponding renderer for node type ' . \get_class($node));
}
diff --git a/dokuwiki/lib/plugins/commonmark/src/Dokuwiki/Plugin/Commonmark/Extension/CommonmarkToDokuwikiExtension.php b/dokuwiki/lib/plugins/commonmark/src/Dokuwiki/Plugin/Commonmark/Extension/CommonmarkToDokuwikiExtension.php
index 7324698e..3b9a8a2b 100644
--- a/dokuwiki/lib/plugins/commonmark/src/Dokuwiki/Plugin/Commonmark/Extension/CommonmarkToDokuwikiExtension.php
+++ b/dokuwiki/lib/plugins/commonmark/src/Dokuwiki/Plugin/Commonmark/Extension/CommonmarkToDokuwikiExtension.php
@@ -1,4 +1,4 @@
-<?php
+<?php
/*
* This file is part of the clockoon/dokuwiki-commonmark-plugin package.
*
@@ -79,7 +79,7 @@ public function register(EnvironmentBuilderInterface $environment): void {
->addRenderer(InlineElement\HtmlInline::class, new InlineRenderer\HtmlInlineRenderer(), 0)
->addRenderer(InlineElement\Image::class, new InlineRenderer\ImageRenderer(), 0)
->addRenderer(InlineElement\Link::class, new InlineRenderer\LinkRenderer(), 0)
- ->addRenderer(InlineElement\Newline::class, new InlineRenderer\NewlineRenderer(), 0)
+ ->addRenderer(CoreInlineElement\Newline::class, new InlineRenderer\NewlineRenderer(), 0)
->addRenderer(InlineElement\Strong::class, new InlineRenderer\StrongRenderer(), 0)
->addRenderer(CoreInlineElement\Text::class, new InlineRenderer\TextRenderer(), 0)
;
@@ -91,5 +91,5 @@ public function register(EnvironmentBuilderInterface $environment): void {
if ($environment->getConfiguration()->get('commonmark/use_underscore')) {
$environment->addDelimiterProcessor(new EmphasisDelimiterProcessor('_'));
}
- }
+ }
}