Skip to content

Replacement for getStringContent method? #714

Answered by colinodell
gagahpangeran asked this question in Q&A
Discussion options

You must be logged in to vote

In 2.0 we no longer store the text contents directly on the parent Heading block node but rather inside of its children nodes. The easiest way to extract that text in 2.0 would be with the League\CommonMark\Node\StringContainerHelper class like this:

use League\CommonMark\Node\StringContainerHelper;

// ...

$text = StringContainerHelper::getChildText($this->node);

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@gagahpangeran
Comment options

Answer selected by gagahpangeran
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants