final class ExtensionDocMarker (View source)

An HTML comment that shows where the content of an extension doc starts in the markdown for a doc.

The index in the marker is the index of the extension doc in the list of extensions for the doc.

Constants

PATTERN

Matches a marker from getMarker()

Methods

public static 
string
getMarker(string|int $index)

Get the marker to put in the markdown before the content of an extension doc.

public static 
string|null
getIndex(Node $node)

Get the extension index if this node is only a marker.

public static 
void
warnAboutHiddenMarkers(DocumentParsedEvent $event, array $extensionData = [])

Log a warning for each marker that is part of other content, because then the content of that extension doc can't be found.

public static 
void
removeMarkers(DocumentParsedEvent $event)

Remove all markers from the parsed document, so they aren't rendered.

Details

static string getMarker(string|int $index)

Get the marker to put in the markdown before the content of an extension doc.

Parameters

string|int $index

Return Value

string

static string|null getIndex(Node $node)

Get the extension index if this node is only a marker.

Parameters

Node $node

Return Value

string|null

static void warnAboutHiddenMarkers(DocumentParsedEvent $event, array $extensionData = [])

Log a warning for each marker that is part of other content, because then the content of that extension doc can't be found.

Use this from a listener that runs before any listener that moves or removes content, so that every marker is checked.

Parameters

DocumentParsedEvent $event
array $extensionData

Metadata for each extension doc, keyed by the index in its marker

Return Value

void

static void removeMarkers(DocumentParsedEvent $event)

Remove all markers from the parsed document, so they aren't rendered.

Use this as a listener that runs after all listeners that use the markers.

Parameters

DocumentParsedEvent $event

Return Value

void