diff --git a/README.md b/README.md
index 0475f0a..414d63f 100644
--- a/README.md
+++ b/README.md
@@ -12,16 +12,12 @@ For Symfony 2.0.x, you need to use the 1.* version of the bundle.
## Installation ##
-This bundle uses
-[KnpMarkdownBundle](https://github.com/KnpLabs/KnpMarkdownBundle).
-
Register the namespace in `app/autoload.php`:
// app/autoload.php
$loader->registerNamespaces(array(
// ...
'Nelmio' => __DIR__.'/../vendor/bundles',
- 'Knp' => __DIR__.'/../vendor/bundles',
));
Register the bundles in `app/AppKernel.php`:
@@ -32,7 +28,6 @@ Register the bundles in `app/AppKernel.php`:
return array(
// ...
new Nelmio\ApiDocBundle\NelmioApiDocBundle(),
- new Knp\Bundle\MarkdownBundle\KnpMarkdownBundle(),
);
}
diff --git a/Resources/config/services.xml b/Resources/config/services.xml
index c0d83fe..ca40bdd 100644
--- a/Resources/config/services.xml
+++ b/Resources/config/services.xml
@@ -6,6 +6,7 @@
Nelmio\ApiDocBundle\Extractor\ApiDocExtractor
Nelmio\ApiDocBundle\Form\Extension\DescriptionFormTypeExtension
+ Nelmio\ApiDocBundle\Twig\Extension\MarkdownExtension
@@ -15,9 +16,14 @@
+
+
+
+
+
diff --git a/Tests/Fixtures/app/AppKernel.php b/Tests/Fixtures/app/AppKernel.php
index 1673326..b8c28b7 100644
--- a/Tests/Fixtures/app/AppKernel.php
+++ b/Tests/Fixtures/app/AppKernel.php
@@ -50,7 +50,6 @@ class AppKernel extends Kernel
new \Symfony\Bundle\TwigBundle\TwigBundle(),
new \Nelmio\ApiDocBundle\NelmioApiDocBundle(),
new \Nelmio\ApiDocBundle\Tests\Fixtures\NelmioApiDocTestBundle(),
- new \Knp\Bundle\MarkdownBundle\KnpMarkdownBundle(),
);
}
diff --git a/Twig/Extension/MarkdownExtension.php b/Twig/Extension/MarkdownExtension.php
new file mode 100644
index 0000000..1eec51a
--- /dev/null
+++ b/Twig/Extension/MarkdownExtension.php
@@ -0,0 +1,38 @@
+markdownParser = new MarkdownExtraParser();
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getFilters()
+ {
+ return array(
+ 'markdown' => new \Twig_Filter_Method($this, 'markdown', array('is_safe' => array('html'))),
+ );
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getName()
+ {
+ return 'nelmio_api_doc';
+ }
+
+ public function markdown($text)
+ {
+ return $this->markdownParser->transformMarkdown($text);
+ }
+}
diff --git a/composer.json b/composer.json
index 0e5b08a..9a188ce 100644
--- a/composer.json
+++ b/composer.json
@@ -18,7 +18,7 @@
"symfony/framework-bundle": "2.1.*",
"symfony/twig-bundle": "2.1.*",
"symfony/form": "2.1.*",
- "knplabs/knp-markdown-bundle": "dev-master"
+ "dflydev/markdown": "1.0.*"
},
"require-dev": {
"symfony/css-selector": "2.1.*",