Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(markdown): Always render noteblock titles on its own line #11548

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
26 changes: 13 additions & 13 deletions markdown/m2h/handlers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,31 +122,31 @@ export function buildLocalizedHandlers(locale: Locale): Handlers {
node.children[0].children[0].value =
node.children[0].children[0].value.replace(/\[!\w+\]\n?/, "");

// Remove blank line if there is one
if (
node.children[0].children.length === 1 &&
node.children[0].children[0].value === ""
) {
node.children.splice(0, 1);
}

// If the type isn't a callout, add the magic keyword
if (!isCallout) {
node.children[0].children.unshift({
node.children.unshift({
type: "strong",
children: [
{
type: "text",
value: type.magicKeyword,
},
],
properties: {
className: ["notecard-title"],
},
});
node.children[0].children[1].value =
(["zh-CN", "zh-TW"].includes(locale) ? "" : " ") +
node.children[0].children[1].value;
}

// Remove blank line if there is one
if (
node.children[0].children.length === 1 &&
node.children[0].children[0].value === ""
) {
node.children.splice(0, 1);
}
} else {
// Remove "Callout:" text
// Remove "Callout:" text from non-GFM notecard
if (isCallout) {
if (node.children[0].children.length <= 1) {
node.children.splice(0, 1);
Expand Down