mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-04 05:53:43 +00:00 
			
		
		
		
	markdown: Avoid blueslip dependency.
If katex throws an error that we can't deal with, we just re-throw it now.
This commit is contained in:
		@@ -6,7 +6,6 @@ const markdown_test_cases = require("../../zerver/tests/fixtures/markdown_test_c
 | 
			
		||||
const markdown_assert = require("../zjsunit/markdown_assert");
 | 
			
		||||
const {set_global, with_field_rewire, zrequire} = require("../zjsunit/namespace");
 | 
			
		||||
const {run_test} = require("../zjsunit/test");
 | 
			
		||||
const blueslip = require("../zjsunit/zblueslip");
 | 
			
		||||
const {page_params, user_settings} = require("../zjsunit/zpage_params");
 | 
			
		||||
 | 
			
		||||
const example_realm_linkifiers = [
 | 
			
		||||
@@ -850,7 +849,6 @@ test("missing unicode emojis", ({override_rewire}) => {
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
test("katex_throws_unexpected_exceptions", () => {
 | 
			
		||||
    blueslip.expect("error", "Error: some-exception");
 | 
			
		||||
    const message = {raw_content: "$$a$$"};
 | 
			
		||||
    with_field_rewire(
 | 
			
		||||
        markdown,
 | 
			
		||||
@@ -861,7 +859,10 @@ test("katex_throws_unexpected_exceptions", () => {
 | 
			
		||||
            },
 | 
			
		||||
        },
 | 
			
		||||
        () => {
 | 
			
		||||
            markdown.apply_markdown(message);
 | 
			
		||||
            assert.throws(() => markdown.apply_markdown(message), {
 | 
			
		||||
                name: "Error",
 | 
			
		||||
                message: "some-exception\nPlease report this to https://github.com/chjj/marked.",
 | 
			
		||||
            });
 | 
			
		||||
        },
 | 
			
		||||
    );
 | 
			
		||||
});
 | 
			
		||||
 
 | 
			
		||||
@@ -5,8 +5,6 @@ import _ from "lodash";
 | 
			
		||||
import * as fenced_code from "../shared/js/fenced_code";
 | 
			
		||||
import marked from "../third/marked/lib/marked";
 | 
			
		||||
 | 
			
		||||
import * as blueslip from "./blueslip";
 | 
			
		||||
 | 
			
		||||
// This contains zulip's frontend Markdown implementation; see
 | 
			
		||||
// docs/subsystems/markdown.md for docs on our Markdown syntax.  The other
 | 
			
		||||
// main piece in rendering Markdown client-side is
 | 
			
		||||
@@ -439,8 +437,7 @@ function handleTex(tex, fullmatch) {
 | 
			
		||||
            // TeX syntax error
 | 
			
		||||
            return `<span class="tex-error">${_.escape(fullmatch)}</span>`;
 | 
			
		||||
        }
 | 
			
		||||
        blueslip.error(error);
 | 
			
		||||
        return undefined;
 | 
			
		||||
        throw new Error(error.message);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user