@@ -87,34 +87,27 @@ def generate_docs():
8787
8888
8989def clean_mdx_content (content : str ) -> str :
90- parts = re .split (r"(```[\s\S]*?```)" , content )
90+ parts = re .split (r"((?:```[\s\S]*?```|`[^`\n]+`))" , content )
91+
92+ # example: convert `fishjam._openapi_client.models.peer.Peer` into `Peer`
93+ internal_path_pattern = r"fishjam\.(?:[\w.]+\.)?_[\w.]+\."
9194
9295 cleaned_parts = []
9396 for part in parts :
94- if part .startswith ("``` " ):
97+ if part .startswith ("`" ):
9598 text = (
9699 part .replace ("<" , "<" )
97100 .replace (">" , ">" )
98101 .replace ("'" , "'" )
99102 .replace ("builtins." , "" )
100- .replace ("fishjam.api._client." , "" )
101- .replace ("fishjam.api._fishjam_client." , "" )
102- .replace ("fishjam.events._protos.fishjam." , "" )
103- .replace ("fishjam._openapi_client.models.peer." , "" )
104- .replace ("fishjam._openapi_client.models.peer_metadata." , "" )
105- .replace ("fishjam._openapi_client.models.peer_status." , "" )
106- .replace ("fishjam._openapi_client.models.peer_type." , "" )
107- .replace ("fishjam._openapi_client.models.room_config." , "" )
108- .replace ("fishjam._openapi_client.models.room_config_room_type." , "" )
109- .replace ("fishjam._openapi_client.models.room_config_video_codec." , "" )
110- .replace ("fishjam._openapi_client.models.subscriptions." , "" )
111- .replace ("fishjam._openapi_client.models.subscribe_mode." , "" )
112- .replace ("fishjam._openapi_client.models.track." , "" )
113- .replace ("fishjam._openapi_client.types." , "" )
114103 )
104+
105+ text = re .sub (internal_path_pattern , "" , text )
106+
115107 cleaned_parts .append (text )
116108 else :
117- text = part .replace ("{" , "\\ {" ).replace ("}" , "\\ }" )
109+ text = part .replace ("{" , "\\ {" ).replace ("}" , "\\ }" ).replace ("<" , "<" )
110+
118111 cleaned_parts .append (text )
119112
120113 return "" .join (cleaned_parts )
0 commit comments