mirror of
https://github.com/zulip/zulip.git
synced 2025-11-06 15:03:34 +00:00
topic_link: Document get_fallback_markdown_link.
This commit is contained in:
@@ -98,6 +98,11 @@ export function get_fallback_markdown_link(
|
|||||||
topic_name?: string,
|
topic_name?: string,
|
||||||
message_id?: string,
|
message_id?: string,
|
||||||
): string {
|
): string {
|
||||||
|
// Helper that should only be called by other methods in this file.
|
||||||
|
|
||||||
|
// Generates the vanilla markdown link syntax for a stream/topic/message link, as
|
||||||
|
// a fallback for cases where the nicer Zulip link syntax would not
|
||||||
|
// render properly due to special characters in the channel or topic name.
|
||||||
const {text, url} = get_topic_link_content(stream_name, topic_name, message_id);
|
const {text, url} = get_topic_link_content(stream_name, topic_name, message_id);
|
||||||
return as_markdown_link_syntax(text, url);
|
return as_markdown_link_syntax(text, url);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,7 +48,11 @@ def get_fallback_markdown_link(
|
|||||||
stream_id: int, stream_name: str, topic_name: str | None = None, message_id: int | None = None
|
stream_id: int, stream_name: str, topic_name: str | None = None, message_id: int | None = None
|
||||||
) -> str:
|
) -> str:
|
||||||
"""
|
"""
|
||||||
Generates the markdown link syntax for a stream/topic/message link.
|
Helper that should only be called by other methods in this file.
|
||||||
|
|
||||||
|
Generates the vanilla markdown link syntax for a stream/topic/message link, as
|
||||||
|
a fallback for cases where the nicer Zulip link syntax would not
|
||||||
|
render properly due to special characters in the channel or topic name.
|
||||||
"""
|
"""
|
||||||
escape = escape_invalid_stream_topic_characters
|
escape = escape_invalid_stream_topic_characters
|
||||||
link = f"#narrow/channel/{stream_id}-{encode_hash_component(stream_name.replace(' ', '-'))}"
|
link = f"#narrow/channel/{stream_id}-{encode_hash_component(stream_name.replace(' ', '-'))}"
|
||||||
|
|||||||
Reference in New Issue
Block a user