markdown: Allow setting a default language for code blocks.

This adds a new realm setting: default_code_block_language.

This PR also adds a new widget to specify a language, which
behaves somewhat differently from other widgets of the same
kind; instead of exposing methods to the whole module, we
just create a single IIFE that handles all the interactions
with the DOM for the widget.

We also move the code for remapping languages to format_code
function since we want to preserve the original language to
decide if we override it using default_code_clock_language.

Fixes #14404.
This commit is contained in:
Rohitt Vashishtha
2020-03-31 13:21:27 +00:00
committed by Tim Abbott
parent 3f6541b306
commit f9caf522f0
17 changed files with 221 additions and 4 deletions

View File

@@ -16,6 +16,7 @@ const admin_settings_label = {
realm_message_content_allowed_in_email_notifications:
i18n.t("Allow message content in missed message emails"),
realm_digest_emails_enabled: i18n.t("Send weekly digest emails to inactive users"),
realm_default_code_language: i18n.t("Default language for code blocks:"),
// Organization permissions
realm_name_changes_disabled: i18n.t("Prevent users from changing their name"),