API

DocumenterDescriptions.AbstractDescriberType
abstract type AbstractDescriber

Abstract supertype for all describer plugins.

Interface

  • (plugin::YourDescriber)(flattened_text::String)::String: Obtain the description of a page as a string, return it as a String.
  • (::Type{YourDescriber})(): There should be a no-argument constructor.

Optionally, you can hook into the more descriptive API by defining (plugin::YourDescriber)(page, doc)::String.

source
DocumenterDescriptions.FirstNCharsDescriberType
FirstNCharsDescriber(; nchars = 160, approx = true) <: AbstractDescriber

A describer that takes the first nchars characters of text.

Arguments

  • nchars::Int = 160: The target number of characters to include in the description
  • approx::Bool = true: If true, will try to break at word boundaries rather than exactly at nchars characters

Details

When approx=true, the describer will attempt to break at word boundaries to avoid cutting words in half. It will return slightly fewer characters than requested to ensure this. If approx=false, it will break exactly at nchars characters.

If the input text is shorter than nchars, the entire text is returned.

The text is preprocessed to collapse multiple whitespace characters into single spaces and trim leading/trailing whitespace.

source
DocumenterDescriptions.WriteToFileType
WriteToFile(describer) <: AbstractDescriber

Wraps another describer, and writes the generated description to the source file.

Useful if you're running an LLM to generate summaries and want to minimize cost!

Construct the object and pass it to the plugin kwarg of makedocs.

Warning

This will write to files - but if you're running this in a CI pipeline, then that won't propagate the changes to the branch or PR.

If you're running this locally, then it's fine - just remember to commit the changes.

Also, this won't work for generated files.

Arguments

  • describer: The describer to use to generate the description.
source