mirror of
https://github.com/zulip/zulip.git
synced 2025-11-19 14:08:23 +00:00
refactor: Rename bugdown to backend markdown in markdown.js.
This commit is part of series of commits aimed at renaming bugdown to markdown.
This commit is contained in:
@@ -15,7 +15,7 @@ let helpers;
|
|||||||
const realm_filter_map = new Map();
|
const realm_filter_map = new Map();
|
||||||
let realm_filter_list = [];
|
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 = [
|
const backend_only_markdown_re = [
|
||||||
// Inline image previews, check for contiguous chars ending in image suffix
|
// 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
|
// 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) {
|
exports.contains_backend_only_syntax = function (content) {
|
||||||
// Try to guess whether or not a message has bugdown in it
|
// Try to guess whether or not a message contains syntax that only the
|
||||||
// If it doesn't, we can immediately render it client-side
|
// 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));
|
const markedup = backend_only_markdown_re.find(re => re.test(content));
|
||||||
|
|
||||||
// If a realm filter doesn't start with some specified characters
|
// If a realm filter doesn't start with some specified characters
|
||||||
@@ -292,8 +293,8 @@ function handleTimestamp(time) {
|
|||||||
let timeobject;
|
let timeobject;
|
||||||
if (isNaN(time)) {
|
if (isNaN(time)) {
|
||||||
// Moment throws a large deprecation warning when it has to fallback
|
// Moment throws a large deprecation warning when it has to fallback
|
||||||
// to the Date() constructor. We needn't worry here and can let bugdown
|
// to the Date() constructor. We needn't worry here and can let backend
|
||||||
// handle any dates that moment misses.
|
// markdown handle any dates that moment misses.
|
||||||
moment.suppressDeprecationWarnings = true;
|
moment.suppressDeprecationWarnings = true;
|
||||||
timeobject = moment(time); // not a Unix timestamp
|
timeobject = moment(time); // not a Unix timestamp
|
||||||
} else {
|
} else {
|
||||||
@@ -460,7 +461,7 @@ exports.initialize = function (realm_filters, helper_config) {
|
|||||||
const old_link = r.link;
|
const old_link = r.link;
|
||||||
r.link = (href, title, text) => old_link.call(r, href, title, text.trim() ? text : href);
|
r.link = (href, title, text) => old_link.call(r, href, title, text.trim() ? text : href);
|
||||||
|
|
||||||
// Put a newline after a <br> in the generated HTML to match bugdown
|
// Put a newline after a <br> in the generated HTML to match markdown
|
||||||
r.br = function () {
|
r.br = function () {
|
||||||
return '<br>\n';
|
return '<br>\n';
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user