Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 19 additions & 8 deletions src/routes/_home/tags/home-community/home-community.marko
Original file line number Diff line number Diff line change
Expand Up @@ -16,33 +16,44 @@ section class=styles.section

div class=styles.cards
div class=styles.discord
a href="https://discord.gg/marko" class=styles.logo
a href="https://discord.gg/marko" target="_blank" class=styles.logo
fa-icon=faDiscord
span
-- Hang out in our${" "}
a href="https://discord.gg/marko" -- Discord server
a href="https://discord.gg/marko" target="_blank" -- Discord server
-- ${" "}to ask questions & discuss marko
div class=styles.twitter
a
,href="https://twitter.com/search?q=%23markojs%20OR%20%40markodevteam&f=live"
,class=styles.logo
,target="_blank"
fa-icon=faXTwitter
span
-- Tweet to${" "}
a href="https://twitter.com/MarkoDevTeam" -- @MarkoDevTeam
a href="https://twitter.com/MarkoDevTeam" target="_blank"
-- @MarkoDevTeam
-- ${" "}or use the${" "}
a href="https://twitter.com/search?q=%23markojs%20OR%20%40markodevteam&f=live"
a
,href="https://twitter.com/search?q=%23markojs%20OR%20%40markodevteam&f=live"
,target="_blank"
-- #markojs
-- ${" "}hashtag
div class=styles.bluesky
a href="https://bsky.app/profile/markojs.com" class=styles.logo
a
,href="https://bsky.app/profile/markojs.com"
,target="_blank"
,class=styles.logo
fa-icon=faBluesky
span
-- Keep up with the community on Bluesky at${" "}
a href="https://bsky.app/profile/markojs.com" -- @markojs.com
a href="https://bsky.app/profile/markojs.com" target="_blank"
-- @markojs.com
div class=styles.github
a href="https://github.com/marko-js/marko" class=styles.logo
a
,href="https://github.com/marko-js/marko"
,target="_blank"
,class=styles.logo
fa-icon=faGithub
span
-- Browse the code, open issues, & make pull requests on${" "}
a href="https://github.com/marko-js/marko" -- GitHub
a href="https://github.com/marko-js/marko" target="_blank" -- GitHub
9 changes: 6 additions & 3 deletions src/tags/app-footer/app-footer.marko
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
import * as styles from "./app-footer.style.module.scss";
footer id=styles.footer
a href="https://openjsf.org/" class=styles.openjsf
a href="https://openjsf.org/" class=styles.openjsf target="_blank"
img src="./openjsf.svg?no-inline" alt=""
-- ${" "}
span
span class=styles.bold -- OpenJS 
span class=styles.light -- Foundation
div class=styles.separator
a href="https://github.com/marko-js/marko/blob/main/LICENSE" class=styles.osi
a
,href="https://github.com/marko-js/marko/blob/main/LICENSE"
,class=styles.osi
,target="_blank"
img src="./osi.svg?no-inline" alt=""
-- ${" "}MIT License
div class=styles.separator
a href="https://github.com/eBay" class=styles.ebay
a href="https://github.com/eBay" class=styles.ebay target="_blank"
img src="./ebay.svg?no-inline" alt="eBay"
-- ${" "}open source
21 changes: 20 additions & 1 deletion src/util/markodown.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import fs from "fs/promises";
import path from "path";
import {
marked,
Marked,
type MarkedExtension,
type Tokens,
Expand Down Expand Up @@ -64,7 +65,12 @@ export default function markodownPlugin(): PluginOption {
async function mdToMarko(source: string) {
const headings: HeadingList = [];
const markoCode = await new Marked()
.use(semanticAdmonitions(), headingSections(headings), markoDocs())
.use(
semanticAdmonitions(),
headingSections(headings),
markoDocs(),
externalLinks(),
)
.parse(
// remove zero-width spaces (recommended from marked docs)
source.replace(/^[\u200B\u200C\u200D\u200E\u200F\uFEFF]/, ""),
Expand Down Expand Up @@ -315,6 +321,19 @@ function headingSections(headings: HeadingList): MarkedExtension {
};
}

function externalLinks(): MarkedExtension {
return {
renderer: {
link(link) {
var out = marked.Renderer.prototype.link.apply(this, [link]);
const isExternal = /^https?:\/\//.test(link.href);
if (isExternal) return out.replace(/^<a/, '<a target="_blank"');
return out;
},
},
};
}

let lock: Promise<void> | undefined;
async function acquireMutexLock() {
const currLock = lock;
Expand Down