import $ from "jquery";
import render_keyboard_shortcut from "../templates/keyboard_shortcuts.hbs";
import render_markdown_help from "../templates/markdown_help.hbs";
import render_search_operator from "../templates/search_operators.hbs";
import * as browser_history from "./browser_history";
import * as common from "./common";
import * as components from "./components";
import type {Toggle} from "./components";
import {$t, $t_html} from "./i18n";
import * as keydown_util from "./keydown_util";
import * as markdown from "./markdown";
import * as overlays from "./overlays";
import {page_params} from "./page_params";
import {postprocess_content} from "./postprocess_content";
import * as rendered_markdown from "./rendered_markdown";
import * as scroll_util from "./scroll_util";
import {current_user} from "./state_data";
import {user_settings} from "./user_settings";
// Make it explicit that our toggler is undefined until
// set_up_toggler is called.
export let toggler: Toggle | undefined;
function format_usage_html(...keys: string[]): string {
return $t_html(
{
defaultMessage: "(or )",
},
{
"key-html": () => keys.map((key) => `${key}`).join("+"),
},
);
}
const markdown_help_rows = [
{
markdown: "**bold**",
usage_html: format_usage_html("Ctrl", "B"),
},
{
markdown: "*italic*",
usage_html: format_usage_html("Ctrl", "I"),
},
{
markdown: "~~strikethrough~~",
},
{
markdown: ":heart:",
},
{
markdown: "[Zulip website](https://zulip.org)",
usage_html: format_usage_html("Ctrl", "Shift", "L"),
},
{
markdown: "#**channel name**",
output_html: "
',
effect_html: "(links to profile but doesn't notify Joe Smith)",
},
{
markdown: "@*support team*",
// Since there are no mentionable user groups that we can
// assume exist, we use a fake data-user-group-id of 0 in
// order to avoid upsetting the rendered_markdown.ts
// validation logic for user group elements.
//
// Similar hackery is not required for user mentions as very
// old mentions do not have data-user-id, so compatibility
// code for that case works ... but it might be better to just
// user your own name/user ID anyway.
output_html:
'
@support team
',
effect_html: "(notifies support team group)",
},
{
markdown: "@**all**",
effect_html: "(notifies all recipients)",
},
{
markdown: `\
* Milk
* Tea
* Green tea
* Black tea
* Coffee`,
},
{
markdown: `\
1. Milk
1. Tea
1. Coffee`,
},
{
markdown: "> Quoted",
},
{
markdown: `\
\`\`\`quote
Quoted block
\`\`\``,
},
{
markdown: `\
\`\`\`spoiler Always visible heading
This text won't be visible until the user clicks.
\`\`\``,
},
{
markdown: "Some inline `code`",
},
{
markdown: `\
\`\`\`
def zulip():
print "Zulip"
\`\`\``,
},
{
markdown: `\
\`\`\`python
def zulip():
print "Zulip"
\`\`\``,
output_html: `\