Skip to content
Grav 2.0 is officially stable. Read the announcement →

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

Plugins

Override paragraph block in Parsedown

Started by Thomas Vantuycom 6 years ago · 3 replies · 532 views
6 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?

6 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.

6 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.

6 years ago

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

Suggested topics

Topic Participants Replies Views Activity
Plugins · by Rene, 1 week ago
2 49 1 week ago
Plugins · by Xavier, 4 weeks ago
2 57 4 weeks ago
Plugins · by Luka Prinčič, 7 years ago
3 1184 1 month ago
Plugins · by Sebastian van de Meer, 1 month ago
1 50 1 month ago
Plugins · by PIERROT Alain, 2 months ago
3 75 2 months ago