Skip to content
Grav 2.1 is out: every page speaks Markdown. Read the announcement →

Override paragraph block in Parsedown

Started by Thomas Vantuycom 7 years ago · 3 replies · 678 views
7 years ago

How can I change the way paragraph blocks are handled by Parsedown?

I know I can use the addBlockType method with the onMarkdownInitialized event hook, but that method seems reserved for blocks that have an associated syntax, like blockquotes or lists. How can I access and extend the paragraph handler?

7 years ago

Since no one else has offered an answer, have you checked the Parsedown docs? It seems very specific to that library's API.

7 years ago

The Parsedown wiki recommends extending the Parsedown class and overriding the functions you want to change. Something like this:

TXT
class CustomParsedown extends Parsedown
{
    protected function paragraph($Line)
    {
        // Do something
    }
}

I believe Grav has its own helper methods, at least when it comes to adding or overriding inline types or block types. There's some examples here, but I can't seem to access the paragraph tag, as it has no syntax or symbol associated with it.

7 years ago

Interesting to know but I see your point and what a shame!

Suggested topics

Topic Participants Replies Views Activity
Plugins · by complanar, 2 weeks ago
2 250 4 days ago
Plugins · by Vladimir Novak, 1 month ago
3 594 1 month ago
Plugins · by Mathieu Lecouturier, 2 months ago
3 416 2 months ago
Plugins · by Slebeig, 2 months ago
1 530 2 months ago
Plugins · by Rene, 3 months ago
2 731 3 months ago