Updated Writing Extensions (markdown)

Emanuil Rusev 2015-01-17 20:44:40 +02:00
parent 63e6bce5f6
commit e72357441b

@ -1,5 +1,7 @@
### Disable Element
This example disables Header elements (both Atx and Setext).
``` php
class Extension extends Parsedown
{
@ -15,12 +17,14 @@ class Extension extends Parsedown
}
```
This would disable Header elements. That is, both Atx Header and Setext Header elements. You can use the same approach for other elements including inline ones (e.g. to disable Image elements override `inlineImage`.
You can use the same approach for other elements types. This includes inline elements types. For example, to disable Image elements you should override `inlineImage`.
Note that if you don't want headers you should also disable support for HTML. You can do that by setting the `MarkupEscaped` option to `true`.
Note that to disable all headers you should also disable support for HTML. You can do that by setting the `MarkupEscaped` option to `true`.
### Change Element Markup
This example prepends a base path to the `src` of Image elements.
``` php
class Extension extends Parsedown
{
@ -37,10 +41,12 @@ class Extension extends Parsedown
}
```
This would prepend a base path to the `src` of Image elements. You can use the same approach to change the markup of any type of element.
You can use the same approach for other element types.
### Add Inline Element
This example adds a ColoredText element. You can find a description of this element at https://github.com/erusev/parsedown/issues/262.
``` php
class Extension extends Parsedown
{
@ -70,4 +76,4 @@ class Extension extends Parsedown
}
```
This adds a ColoredText inline element. The element is described at https://github.com/erusev/parsedown/issues/262. You can use the same approach to add other inline elements.
You can use the same approach for other element types.