API docs generation: For each type, list all referencing types in the overview information

This commit is contained in:
Dominik Jain 2025-10-07 19:50:36 +02:00
parent 011e4c66c0
commit 66df6d1d45
2 changed files with 176 additions and 4 deletions

View File

@ -885,6 +885,8 @@ ActiveUser:
* User * User
+ ActiveUser + ActiveUser
Referenced by: Context, Penpot
members: members:
Properties: Properties:
position: |- position: |-
@ -983,6 +985,8 @@ Blur:
hidden?: boolean; hidden?: boolean;
} }
``` ```
Referenced by: Board, Boolean, Ellipse, Group, Image, Path, Rectangle, ShapeBase, SvgRaw, Text
members: members:
Properties: Properties:
id: |- id: |-
@ -1133,6 +1137,8 @@ Board:
* ShapeBase * ShapeBase
+ Board + Board
Referenced by: CloseOverlay, CommentThread, Context, ContextTypesUtils, Flow, NavigateTo, OpenOverlay, OverlayAction, Page, Penpot, RulerGuide, Shape, ToggleOverlay
members: members:
Properties: Properties:
type: |- type: |-
@ -1986,6 +1992,8 @@ Boolean:
* ShapeBase * ShapeBase
+ Boolean + Boolean
Referenced by: Context, ContextTypesUtils, Penpot, Shape
members: members:
Properties: Properties:
type: |- type: |-
@ -2656,6 +2664,8 @@ CloseOverlay:
animation: Animation; animation: Animation;
} }
``` ```
Referenced by: Action
members: members:
Properties: Properties:
type: |- type: |-
@ -2698,6 +2708,8 @@ Color:
image?: ImageData; image?: ImageData;
} }
``` ```
Referenced by: Context, Penpot, Shadow
members: members:
Properties: Properties:
id: |- id: |-
@ -2781,6 +2793,8 @@ ColorShapeInfo:
shapesInfo: ColorShapeInfoEntry[]; shapesInfo: ColorShapeInfoEntry[];
} }
``` ```
Referenced by: Context, Penpot
members: members:
Properties: Properties:
shapesInfo: |- shapesInfo: |-
@ -2803,6 +2817,8 @@ ColorShapeInfoEntry:
shapeId: string; shapeId: string;
} }
``` ```
Referenced by: ColorShapeInfo
members: members:
Properties: Properties:
property: |- property: |-
@ -2840,6 +2856,8 @@ Comment:
remove(): void; remove(): void;
} }
``` ```
Referenced by: CommentThread
members: members:
Properties: Properties:
user: |- user: |-
@ -2890,6 +2908,8 @@ CommentThread:
remove(): void; remove(): void;
} }
``` ```
Referenced by: Page
members: members:
Properties: Properties:
seqNumber: |- seqNumber: |-
@ -3861,6 +3881,8 @@ ContextGeometryUtils:
}; };
} }
``` ```
Referenced by: ContextUtils
members: members:
Methods: Methods:
center: |- center: |-
@ -3912,6 +3934,8 @@ ContextTypesUtils:
isSVG(shape: Shape): shape is SvgRaw; isSVG(shape: Shape): shape is SvgRaw;
} }
``` ```
Referenced by: ContextUtils
members: members:
Methods: Methods:
isBoard: |- isBoard: |-
@ -4062,6 +4086,8 @@ ContextUtils:
types: ContextTypesUtils; types: ContextTypesUtils;
} }
``` ```
Referenced by: Penpot
members: members:
Properties: Properties:
geometry: |- geometry: |-
@ -4107,6 +4133,8 @@ Dissolve:
| "ease-in-out"; | "ease-in-out";
} }
``` ```
Referenced by: Animation
members: members:
Properties: Properties:
type: |- type: |-
@ -4240,6 +4268,8 @@ Ellipse:
* ShapeBase * ShapeBase
+ Ellipse + Ellipse
Referenced by: Context, ContextTypesUtils, Penpot, Shape
members: members:
Properties: Properties:
type: |- type: |-
@ -4857,6 +4887,8 @@ EventsMap:
contentsave: void; contentsave: void;
} }
``` ```
Referenced by: Context, Penpot
members: members:
Properties: Properties:
pagechange: |- pagechange: |-
@ -4923,6 +4955,8 @@ Export:
skipChildren?: boolean; skipChildren?: boolean;
} }
``` ```
Referenced by: Board, Boolean, Ellipse, Group, Image, Path, Rectangle, ShapeBase, SvgRaw, Text
members: members:
Properties: Properties:
type: |- type: |-
@ -4985,6 +5019,8 @@ File:
* PluginData * PluginData
+ File + File
Referenced by: Context, EventsMap, Penpot
members: members:
Properties: Properties:
id: |- id: |-
@ -5189,6 +5225,8 @@ FileVersion:
pin(): Promise<FileVersion>; pin(): Promise<FileVersion>;
} }
``` ```
Referenced by: File, FileVersion
members: members:
Properties: Properties:
label: |- label: |-
@ -5259,6 +5297,8 @@ Fill:
fillImage?: ImageData; fillImage?: ImageData;
} }
``` ```
Referenced by: Board, Boolean, Ellipse, Group, Image, LibraryColor, Path, Rectangle, ShapeBase, SvgRaw, Text, TextRange
members: members:
Properties: Properties:
fillColor: |- fillColor: |-
@ -5360,6 +5400,8 @@ FlexLayout:
* CommonLayout * CommonLayout
+ FlexLayout + FlexLayout
Referenced by: Board
members: members:
Properties: Properties:
alignItems: |- alignItems: |-
@ -5574,6 +5616,8 @@ Flow:
remove(): void; remove(): void;
} }
``` ```
Referenced by: Page
members: members:
Properties: Properties:
page: |- page: |-
@ -5624,6 +5668,8 @@ Font:
applyToRange(range: TextRange, variant?: FontVariant): void; applyToRange(range: TextRange, variant?: FontVariant): void;
} }
``` ```
Referenced by: FontsContext, LibraryTypography
members: members:
Properties: Properties:
name: |- name: |-
@ -5727,6 +5773,8 @@ FontVariant:
fontStyle: "normal" | "italic"; fontStyle: "normal" | "italic";
} }
``` ```
Referenced by: Font, LibraryTypography
members: members:
Properties: Properties:
name: |- name: |-
@ -5770,6 +5818,8 @@ FontsContext:
findAllByName(name: string): Font[]; findAllByName(name: string): Font[];
} }
``` ```
Referenced by: Context, Penpot
members: members:
Properties: Properties:
all: |- all: |-
@ -5925,6 +5975,8 @@ GridLayout:
* CommonLayout * CommonLayout
+ GridLayout + GridLayout
Referenced by: Board
members: members:
Properties: Properties:
alignItems: |- alignItems: |-
@ -6414,6 +6466,8 @@ Group:
* ShapeBase * ShapeBase
+ Group + Group
Referenced by: Context, ContextTypesUtils, Penpot, Shape
members: members:
Properties: Properties:
type: |- type: |-
@ -7092,6 +7146,8 @@ GuideColumn:
params: GuideColumnParams; params: GuideColumnParams;
} }
``` ```
Referenced by: Guide
members: members:
Properties: Properties:
type: |- type: |-
@ -7137,6 +7193,8 @@ GuideColumnParams:
gutter?: number; gutter?: number;
} }
``` ```
Referenced by: GuideColumn, GuideRow
members: members:
Properties: Properties:
color: |- color: |-
@ -7202,6 +7260,8 @@ GuideRow:
params: GuideColumnParams; params: GuideColumnParams;
} }
``` ```
Referenced by: Guide
members: members:
Properties: Properties:
type: |- type: |-
@ -7238,6 +7298,8 @@ GuideSquare:
params: GuideSquareParams; params: GuideSquareParams;
} }
``` ```
Referenced by: Guide
members: members:
Properties: Properties:
type: |- type: |-
@ -7275,6 +7337,8 @@ GuideSquareParams:
size?: number; size?: number;
} }
``` ```
Referenced by: GuideSquare
members: members:
Properties: Properties:
color: |- color: |-
@ -7305,6 +7369,8 @@ HistoryContext:
undoBlockFinish(blockId: Symbol): void; undoBlockFinish(blockId: Symbol): void;
} }
``` ```
Referenced by: Context, Penpot
members: members:
Methods: Methods:
undoBlockBegin: |- undoBlockBegin: |-
@ -7443,6 +7509,8 @@ Image:
* ShapeBase * ShapeBase
+ Image + Image
Referenced by: Shape
members: members:
Properties: Properties:
type: |- type: |-
@ -8052,6 +8120,8 @@ Interaction:
remove(): void; remove(): void;
} }
``` ```
Referenced by: Board, Boolean, Ellipse, Group, Image, Path, Rectangle, ShapeBase, SvgRaw, Text
members: members:
Properties: Properties:
shape: |- shape: |-
@ -8179,6 +8249,8 @@ LayoutChildProperties:
minHeight: null | number; minHeight: null | number;
} }
``` ```
Referenced by: Board, Boolean, Ellipse, Group, Image, Path, Rectangle, ShapeBase, SvgRaw, Text
members: members:
Properties: Properties:
absolute: |- absolute: |-
@ -8332,6 +8404,8 @@ Library:
* PluginData * PluginData
+ Library + Library
Referenced by: LibraryContext
members: members:
Properties: Properties:
id: |- id: |-
@ -8581,6 +8655,8 @@ LibraryColor:
* LibraryElement * LibraryElement
+ LibraryColor + LibraryColor
Referenced by: Library
members: members:
Properties: Properties:
color: |- color: |-
@ -8814,6 +8890,8 @@ LibraryComponent:
* LibraryElement * LibraryElement
+ LibraryComponent + LibraryComponent
Referenced by: Board, Boolean, Ellipse, Group, Image, Library, Path, Rectangle, ShapeBase, SvgRaw, Text
members: members:
Properties: Properties:
id: |- id: |-
@ -9184,6 +9262,8 @@ LibrarySummary:
numTypographies: number; numTypographies: number;
} }
``` ```
Referenced by: LibraryContext
members: members:
Properties: Properties:
id: |- id: |-
@ -9259,6 +9339,8 @@ LibraryTypography:
* LibraryElement * LibraryElement
+ LibraryTypography + LibraryTypography
Referenced by: Library, Text, TextRange
members: members:
Properties: Properties:
id: |- id: |-
@ -9542,6 +9624,8 @@ LocalStorage:
getKeys(): string[]; getKeys(): string[];
} }
``` ```
Referenced by: Context, Penpot
members: members:
Methods: Methods:
getItem: |- getItem: |-
@ -9606,6 +9690,8 @@ NavigateTo:
animation?: Animation; animation?: Animation;
} }
``` ```
Referenced by: Action
members: members:
Properties: Properties:
type: |- type: |-
@ -9664,6 +9750,8 @@ OpenOverlay:
* OverlayAction * OverlayAction
+ OpenOverlay + OpenOverlay
Referenced by: Action
members: members:
Properties: Properties:
type: |- type: |-
@ -9735,6 +9823,8 @@ OpenUrl:
url: string; url: string;
} }
``` ```
Referenced by: Action
members: members:
Properties: Properties:
type: |- type: |-
@ -9886,6 +9976,8 @@ Page:
* PluginData * PluginData
+ Page + Page
Referenced by: Context, EventsMap, File, Flow, Penpot
members: members:
Properties: Properties:
id: |- id: |-
@ -10310,6 +10402,8 @@ Path:
* ShapeBase * ShapeBase
+ Path + Path
Referenced by: Context, ContextTypesUtils, Penpot, Shape
members: members:
Properties: Properties:
type: |- type: |-
@ -10967,6 +11061,8 @@ PathCommand:
}; };
} }
``` ```
Referenced by: Boolean, Path
members: members:
Properties: Properties:
command: |- command: |-
@ -11229,6 +11325,8 @@ PreviousScreen:
type: "previous-screen"; type: "previous-screen";
} }
``` ```
Referenced by: Action
members: members:
Properties: Properties:
type: |- type: |-
@ -11261,6 +11359,8 @@ Push:
| "ease-in-out"; | "ease-in-out";
} }
``` ```
Referenced by: Animation
members: members:
Properties: Properties:
type: |- type: |-
@ -11404,6 +11504,8 @@ Rectangle:
* ShapeBase * ShapeBase
+ Rectangle + Rectangle
Referenced by: Context, ContextTypesUtils, Penpot, Shape
members: members:
Properties: Properties:
type: |- type: |-
@ -12014,6 +12116,8 @@ RulerGuide:
board?: Board; board?: Board;
} }
``` ```
Referenced by: Board, Page
members: members:
Properties: Properties:
orientation: |- orientation: |-
@ -12055,6 +12159,8 @@ Shadow:
color?: Color; color?: Color;
} }
``` ```
Referenced by: Board, Boolean, Ellipse, Group, Image, Path, Rectangle, ShapeBase, SvgRaw, Text
members: members:
Properties: Properties:
id: |- id: |-
@ -12837,6 +12943,8 @@ Slide:
| "ease-in-out"; | "ease-in-out";
} }
``` ```
Referenced by: Animation
members: members:
Properties: Properties:
type: |- type: |-
@ -12913,6 +13021,8 @@ Stroke:
strokeColorGradient?: Gradient; strokeColorGradient?: Gradient;
} }
``` ```
Referenced by: Board, Boolean, Ellipse, Group, Image, LibraryColor, Path, Rectangle, ShapeBase, SvgRaw, Text
members: members:
Properties: Properties:
strokeColor: |- strokeColor: |-
@ -13089,6 +13199,8 @@ SvgRaw:
* ShapeBase * ShapeBase
+ SvgRaw + SvgRaw
Referenced by: ContextTypesUtils, Shape
members: members:
Properties: Properties:
id: |- id: |-
@ -13831,6 +13943,8 @@ Text:
* ShapeBase * ShapeBase
+ Text + Text
Referenced by: Context, ContextTypesUtils, Font, Penpot, Shape, TextRange
members: members:
Properties: Properties:
id: |- id: |-
@ -14650,6 +14764,8 @@ TextRange:
applyTypography(typography: LibraryTypography): void; applyTypography(typography: LibraryTypography): void;
} }
``` ```
Referenced by: Font, LibraryTypography, Text
members: members:
Properties: Properties:
shape: |- shape: |-
@ -14830,6 +14946,8 @@ ToggleOverlay:
* OverlayAction * OverlayAction
+ ToggleOverlay + ToggleOverlay
Referenced by: Action
members: members:
Properties: Properties:
destination: |- destination: |-
@ -14902,6 +15020,8 @@ Track:
value: null | number; value: null | number;
} }
``` ```
Referenced by: GridLayout
members: members:
Properties: Properties:
type: |- type: |-
@ -14944,6 +15064,8 @@ User:
* User * User
+ ActiveUser + ActiveUser
Referenced by: Comment, CommentThread, Context, File, FileVersion, Penpot
members: members:
Properties: Properties:
id: |- id: |-
@ -15019,6 +15141,8 @@ Viewport:
zoomIntoView(shapes: Shape[]): void; zoomIntoView(shapes: Shape[]): void;
} }
``` ```
Referenced by: Context, Penpot
members: members:
Properties: Properties:
center: |- center: |-
@ -15085,6 +15209,8 @@ Action:
``` ```
Type for all the possible types of actions in an interaction. Type for all the possible types of actions in an interaction.
Referenced by: Board, Boolean, Ellipse, Group, Image, Interaction, Path, Rectangle, ShapeBase, SvgRaw, Text
members: {} members: {}
Animation: Animation:
overview: |- overview: |-
@ -15096,6 +15222,8 @@ Animation:
``` ```
Type of all the animations that can be added to an interaction. Type of all the animations that can be added to an interaction.
Referenced by: CloseOverlay, NavigateTo, OpenOverlay, OverlayAction, ToggleOverlay
members: {} members: {}
BooleanType: BooleanType:
overview: |- overview: |-
@ -15112,6 +15240,8 @@ BooleanType:
Represents the boolean operation types available in Penpot. Represents the boolean operation types available in Penpot.
These types define how shapes can be combined or modified using boolean operations. These types define how shapes can be combined or modified using boolean operations.
Referenced by: Context, Penpot
members: {} members: {}
Bounds: Bounds:
overview: |- overview: |-
@ -15149,6 +15279,8 @@ Bounds:
``` ```
const bounds = { x: 50, y: 50, width: 200, height: 100 };console.log(bounds); const bounds = { x: 50, y: 50, width: 200, height: 100 };console.log(bounds);
``` ```
Referenced by: Board, Boolean, Ellipse, Group, Image, Path, Rectangle, ShapeBase, SvgRaw, Text, Viewport
members: {} members: {}
Gradient: Gradient:
overview: |- overview: |-
@ -15205,6 +15337,8 @@ Gradient:
* stops: { color: string; opacity?: number; offset: number; }[] * stops: { color: string; opacity?: number; offset: number; }[]
An array of color stops that define the gradient. An array of color stops that define the gradient.
Referenced by: Color, Fill, LibraryColor, Stroke
members: {} members: {}
Guide: Guide:
overview: |- overview: |-
@ -15217,6 +15351,8 @@ Guide:
Represents a board guide in Penpot. Represents a board guide in Penpot.
This type can be one of several specific board guide types: column, row, or square. This type can be one of several specific board guide types: column, row, or square.
Referenced by: Board
members: {} members: {}
ImageData: ImageData:
overview: |- overview: |-
@ -15258,6 +15394,8 @@ ImageData:
Whether to keep the aspect ratio of the image when resizing. Whether to keep the aspect ratio of the image when resizing.
Defaults to false if omitted. Defaults to false if omitted.
Referenced by: Color, Context, Fill, LibraryColor, Penpot
members: {} members: {}
LibraryContext: LibraryContext:
overview: |- overview: |-
@ -15331,6 +15469,8 @@ LibraryContext:
``` ```
const connectedLibrary = await libraryContext.connectLibrary('library-id'); const connectedLibrary = await libraryContext.connectLibrary('library-id');
``` ```
Referenced by: Context, Penpot
members: {} members: {}
Point: Point:
overview: |- overview: |-
@ -15345,6 +15485,8 @@ Point:
``` ```
Point represents a point in 2D space, typically with x and y coordinates. Point represents a point in 2D space, typically with x and y coordinates.
Referenced by: Board, Boolean, CommentThread, Ellipse, Group, Image, OpenOverlay, OverlayAction, Page, Path, Rectangle, ShapeBase, SvgRaw, Text, ToggleOverlay, Viewport
members: {} members: {}
RulerGuideOrientation: RulerGuideOrientation:
overview: |- overview: |-
@ -15354,6 +15496,8 @@ RulerGuideOrientation:
``` ```
RulerGuideOrientation: "horizontal" | "vertical" RulerGuideOrientation: "horizontal" | "vertical"
``` ```
Referenced by: Board, Page, RulerGuide
members: {} members: {}
Shape: Shape:
overview: |- overview: |-
@ -15380,6 +15524,8 @@ Shape:
``` ```
let shape: Shape;if (penpot.utils.types.isRectangle(shape)) { console.log(shape.type);} let shape: Shape;if (penpot.utils.types.isRectangle(shape)) { console.log(shape.type);}
``` ```
Referenced by: Board, Boolean, Context, ContextGeometryUtils, ContextTypesUtils, Ellipse, EventsMap, FlexLayout, GridLayout, Group, Image, Interaction, Library, LibraryComponent, LibraryTypography, OpenOverlay, OverlayAction, Page, Path, Penpot, Rectangle, ShapeBase, SvgRaw, Text, ToggleOverlay, Viewport
members: {} members: {}
StrokeCap: StrokeCap:
overview: |- overview: |-
@ -15399,6 +15545,8 @@ StrokeCap:
Represents the cap style of a stroke in Penpot. Represents the cap style of a stroke in Penpot.
This type defines various styles for the ends of a stroke. This type defines various styles for the ends of a stroke.
Referenced by: Stroke
members: {} members: {}
Theme: Theme:
overview: |- overview: |-
@ -15410,6 +15558,8 @@ Theme:
``` ```
This type specifies the possible themes: 'light' or 'dark'. This type specifies the possible themes: 'light' or 'dark'.
Referenced by: Context, EventsMap, Penpot
members: {} members: {}
TrackType: TrackType:
overview: |- overview: |-
@ -15426,6 +15576,8 @@ TrackType:
Represents the type of track in Penpot. Represents the type of track in Penpot.
This type defines various track types that can be used in layout configurations. This type defines various track types that can be used in layout configurations.
Referenced by: GridLayout, Track
members: {} members: {}
Trigger: Trigger:
overview: |- overview: |-
@ -15446,4 +15598,6 @@ Trigger:
* `mouse-enter` triggers when the user moves the mouse inside the shape (even if no mouse button is pressed) * `mouse-enter` triggers when the user moves the mouse inside the shape (even if no mouse button is pressed)
* `mouse-leave` triggers when the user moves the mouse outside the shape. * `mouse-leave` triggers when the user moves the mouse outside the shape.
* `after-delay` triggers after the `delay` time has passed even if no interaction from the user happens. * `after-delay` triggers after the `delay` time has passed even if no interaction from the user happens.
Referenced by: Board, Boolean, Ellipse, Group, Image, Interaction, Path, Rectangle, ShapeBase, SvgRaw, Text
members: {} members: {}

View File

@ -1,3 +1,4 @@
import collections
import dataclasses import dataclasses
import os import os
from dataclasses import dataclass from dataclasses import dataclass
@ -17,6 +18,7 @@ log = logging.getLogger(__name__)
class PenpotAPIContentMarkdownConverter(MarkdownConverter): class PenpotAPIContentMarkdownConverter(MarkdownConverter):
""" """
Markdown converter for Penpot API docs, specifically for the .col-content element Markdown converter for Penpot API docs, specifically for the .col-content element
(and sub-elements thereof)
""" """
def process_tag(self, node, parent_tags=None): def process_tag(self, node, parent_tags=None):
soup = BeautifulSoup(str(node), "html.parser") soup = BeautifulSoup(str(node), "html.parser")
@ -82,9 +84,13 @@ class TypeInfo:
mapping from member type (e.g. "Properties", "Methods") to a mapping of member name to markdown description mapping from member type (e.g. "Properties", "Methods") to a mapping of member name to markdown description
""" """
def add_referencing_types(self, referencing_types: set[str]):
if referencing_types:
self.overview += "\n\nReferenced by: " + ", ".join(sorted(referencing_types))
class YamlConverter: class YamlConverter:
"""Convert dictionaries to YAML with all strings in block literal style""" """Converts dictionaries to YAML with all strings in block literal style"""
def __init__(self): def __init__(self):
self.yaml = YAML() self.yaml = YAML()
@ -118,11 +124,12 @@ class PenpotAPIDocsProcessor:
self.md_converter = PenpotAPIContentMarkdownConverter() self.md_converter = PenpotAPIContentMarkdownConverter()
self.base_url = "https://penpot-plugins-api-doc.pages.dev" self.base_url = "https://penpot-plugins-api-doc.pages.dev"
self.types: dict[str, TypeInfo] = {} self.types: dict[str, TypeInfo] = {}
self.type_referenced_by: dict[str, set[str]] = collections.defaultdict(set)
def run(self, target_dir: str): def run(self, target_dir: str):
os.makedirs(target_dir, exist_ok=True) os.makedirs(target_dir, exist_ok=True)
# find links # find links to all interfaces and types
modules_page = self._fetch("modules") modules_page = self._fetch("modules")
soup = BeautifulSoup(modules_page, "html.parser") soup = BeautifulSoup(modules_page, "html.parser")
content = soup.find(attrs={"class": "col-content"}) content = soup.find(attrs={"class": "col-content"})
@ -134,9 +141,14 @@ class PenpotAPIDocsProcessor:
if href.startswith("interfaces/") or href.startswith("types/"): if href.startswith("interfaces/") or href.startswith("types/"):
type_name = href.split("/")[-1].replace(".html", "") type_name = href.split("/")[-1].replace(".html", "")
log.info("Processing page: %s", type_name) log.info("Processing page: %s", type_name)
type_info = self._process_page(href) type_info = self._process_page(href, type_name)
self.types[type_name] = type_info self.types[type_name] = type_info
# add type reference information
for type_name, type_info in self.types.items():
referencing_types = self.type_referenced_by.get(type_name, set())
type_info.add_referencing_types(referencing_types)
# save to yaml # save to yaml
yaml_path = os.path.join(target_dir, "api_types.yml") yaml_path = os.path.join(target_dir, "api_types.yml")
log.info("Writing API type information to %s", yaml_path) log.info("Writing API type information to %s", yaml_path)
@ -155,7 +167,7 @@ class PenpotAPIDocsProcessor:
md = md.replace("\xa0", " ") # replace non-breaking spaces md = md.replace("\xa0", " ") # replace non-breaking spaces
return md.strip() return md.strip()
def _process_page(self, rel_url: str) -> TypeInfo: def _process_page(self, rel_url: str, type_name: str) -> TypeInfo:
html_content = self._fetch(rel_url) html_content = self._fetch(rel_url)
soup = BeautifulSoup(html_content, "html.parser") soup = BeautifulSoup(html_content, "html.parser")
@ -178,6 +190,12 @@ class PenpotAPIDocsProcessor:
member_tag.find("h3").decompose() # remove heading member_tag.find("h3").decompose() # remove heading
members_in_group[member_name] = self._html_to_markdown(str(member_tag)) members_in_group[member_name] = self._html_to_markdown(str(member_tag))
# record references to other types in signature
signature = content.find("div", attrs={"class": "tsd-signature"})
for link_to_type in signature.find_all("a", attrs={"class": "tsd-signature-type"}):
referenced_type_name = link_to_type.get_text().strip()
self.type_referenced_by[referenced_type_name].add(type_name)
# remove the member groups from the soup # remove the member groups from the soup
for tag in member_group_tags: for tag in member_group_tags:
tag.decompose() tag.decompose()