From 8037063746f8112675292b776ca45793e27dab07 Mon Sep 17 00:00:00 2001 From: Mohit Gupta Date: Tue, 30 Jun 2020 02:03:20 +0530 Subject: [PATCH] refactor: Rename bugdown to backend markdown in markdown.js. This commit is part of series of commits aimed at renaming bugdown to markdown. --- static/js/markdown.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/static/js/markdown.js b/static/js/markdown.js index 158a1854b9..b9348ff660 100644 --- a/static/js/markdown.js +++ b/static/js/markdown.js @@ -15,7 +15,7 @@ let helpers; const realm_filter_map = new Map(); let realm_filter_list = []; -// Regexes that match some of our common bugdown markup +// Regexes that match some of our common backend-only markdown syntax const backend_only_markdown_re = [ // Inline image previews, check for contiguous chars ending in image suffix // To keep the below regexes simple, split them out for the end-of-message case @@ -68,8 +68,9 @@ exports.translate_emoticons_to_names = (text) => { }; exports.contains_backend_only_syntax = function (content) { - // Try to guess whether or not a message has bugdown in it - // If it doesn't, we can immediately render it client-side + // Try to guess whether or not a message contains syntax that only the + // backend markdown processor can correctly handle. + // If it doesn't, we can immediately render it client-side for local echo. const markedup = backend_only_markdown_re.find(re => re.test(content)); // If a realm filter doesn't start with some specified characters @@ -292,8 +293,8 @@ function handleTimestamp(time) { let timeobject; if (isNaN(time)) { // Moment throws a large deprecation warning when it has to fallback - // to the Date() constructor. We needn't worry here and can let bugdown - // handle any dates that moment misses. + // to the Date() constructor. We needn't worry here and can let backend + // markdown handle any dates that moment misses. moment.suppressDeprecationWarnings = true; timeobject = moment(time); // not a Unix timestamp } else { @@ -460,7 +461,7 @@ exports.initialize = function (realm_filters, helper_config) { const old_link = r.link; r.link = (href, title, text) => old_link.call(r, href, title, text.trim() ? text : href); - // Put a newline after a
in the generated HTML to match bugdown + // Put a newline after a
in the generated HTML to match markdown r.br = function () { return '
\n'; };