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

Override paragraph block in Parsedown

Started by Thomas Vantuycom 7 years ago · 3 replies · 641 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 Vladimir Novak, 2 weeks ago
3 291 2 weeks ago
Plugins · by Mathieu Lecouturier, 3 weeks ago
3 277 3 weeks ago
Plugins · by Slebeig, 2 months ago
1 403 2 months ago
Plugins · by Rene, 2 months ago
2 574 2 months ago
Plugins · by Xavier, 3 months ago
2 490 3 months ago