mirror of
https://github.com/zulip/zulip.git
synced 2025-11-14 10:57:58 +00:00
committed by
Tim Abbott
parent
cc40352541
commit
392676d4da
@@ -260,7 +260,7 @@ function retain_unique_language_aliases(matches) {
|
|||||||
for (const lang of matches) {
|
for (const lang of matches) {
|
||||||
// The matched list is already sorted based on popularity and has exact matches
|
// The matched list is already sorted based on popularity and has exact matches
|
||||||
// at the top, so we don't need to worry about sorting again.
|
// at the top, so we don't need to worry about sorting again.
|
||||||
const canonical_name = _.get(pygments_data.langs, [lang, "pretty_name"], lang);
|
const canonical_name = pygments_data.langs[lang]?.pretty_name ?? lang;
|
||||||
if (!seen_aliases.has(canonical_name)) {
|
if (!seen_aliases.has(canonical_name)) {
|
||||||
seen_aliases.add(canonical_name);
|
seen_aliases.add(canonical_name);
|
||||||
unique_aliases.push(lang);
|
unique_aliases.push(lang);
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ export function wrap_code(code, lang) {
|
|||||||
// the `/shared` folder. To handle such a case we check if pygments data is empty and fallback to
|
// the `/shared` folder. To handle such a case we check if pygments data is empty and fallback to
|
||||||
// using the default header if it is.
|
// using the default header if it is.
|
||||||
if (lang !== undefined && lang !== "" && Object.keys(pygments_data).length > 0) {
|
if (lang !== undefined && lang !== "" && Object.keys(pygments_data).length > 0) {
|
||||||
const code_language = _.get(pygments_data, [lang, "pretty_name"], lang);
|
const code_language = pygments_data[lang]?.pretty_name ?? lang;
|
||||||
header = `<div class="codehilite" data-code-language="${_.escape(
|
header = `<div class="codehilite" data-code-language="${_.escape(
|
||||||
code_language,
|
code_language,
|
||||||
)}"><pre><span></span><code>`;
|
)}"><pre><span></span><code>`;
|
||||||
|
|||||||
Reference in New Issue
Block a user