-
-
Notifications
You must be signed in to change notification settings - Fork 193
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
1.5: HeadingPermalinkProcessor::getChildText() strips out AbstractStringContainer from link #615
Comments
Upon poking around, it seems like this issue can be worked around with a custom text normalizer: class YourNormalizer implements TextNormalizerInterface {
/**
* {@inheritdoc}
*/
public function normalize(string $text, $context = null): string {
if (
\is_object($context) &&
\method_exists($context, 'getStringContent') &&
!empty($context->getStringContent())
) {
$text = $context->getStringContent();
}
// Rest of normalizer processing goes here.
}
} |
I honestly can't recall why the other node types were excluded. Given that 2.0 allows other types including Would you be okay if we changed this behavior in 1.6.1? Or do you really need this in 1.5? |
Given the workaround I posted, it's no rush and fine in 1.6.1. Thanks! 🤓 |
Description
I know that
HeadingPermalinkProcessor::getChildText()
is going to be removed in 2.0, but I'm stuck with 1.5 for the foreseeable future. I assumed any class that extendsAbstractStringContainer
would have its text contents included in the permalink, but it seems thatinstanceof Text
andinstanceof Code
are hard coded. Is there a reason for this, or can it be expanded toinstanceof AbstractStringContainer
?Example
I'm helping bring 8fold/commonmark-abbreviations closer in line with CommonMark core (see 8fold/commonmark-abbreviations#8), and when an
Abbreviation
is present in the heading text, even with the pull request to extendAbstractStringContainer
, the text content is completely ignored by the heading permalink.The text was updated successfully, but these errors were encountered: