mirror of
https://github.com/alrayyes/wiki.git
synced 2025-05-01 22:48:14 +00:00
feat(i18n): support parsing callouts (#834)
* feat(i18n): support parsing callouts Signed-off-by: Aaron <29749331+aarnphm@users.noreply.github.com> * chore: move callout into components Signed-off-by: Aaron <29749331+aarnphm@users.noreply.github.com> * chore: update arabic translation Signed-off-by: Aaron <29749331+aarnphm@users.noreply.github.com> * fix: make sure to use correct items Signed-off-by: Aaron <29749331+aarnphm@users.noreply.github.com> --------- Signed-off-by: Aaron <29749331+aarnphm@users.noreply.github.com>
This commit is contained in:
parent
a0d6daa3b4
commit
db5e701810
12 changed files with 164 additions and 4 deletions
quartz/plugins/transformers
|
@ -1,5 +1,5 @@
|
|||
import { QuartzTransformerPlugin } from "../types"
|
||||
import { Root, Html, BlockContent, DefinitionContent, Paragraph, Code } from "mdast"
|
||||
import { Blockquote, Root, Html, BlockContent, DefinitionContent, Paragraph, Code } from "mdast"
|
||||
import { Element, Literal, Root as HtmlRoot } from "hast"
|
||||
import { ReplaceFunction, findAndReplace as mdastFindReplace } from "mdast-util-find-and-replace"
|
||||
import { slug as slugAnchor } from "github-slugger"
|
||||
|
@ -17,6 +17,7 @@ import { toHtml } from "hast-util-to-html"
|
|||
import { PhrasingContent } from "mdast-util-find-and-replace/lib"
|
||||
import { capitalize } from "../../util/lang"
|
||||
import { PluggableList } from "unified"
|
||||
import { ValidCallout, i18n } from "../../i18n"
|
||||
|
||||
export interface Options {
|
||||
comments: boolean
|
||||
|
@ -185,8 +186,9 @@ export const ObsidianFlavoredMarkdown: QuartzTransformerPlugin<Partial<Options>
|
|||
|
||||
return src
|
||||
},
|
||||
markdownPlugins() {
|
||||
markdownPlugins(ctx) {
|
||||
const plugins: PluggableList = []
|
||||
const cfg = ctx.cfg.configuration
|
||||
|
||||
// regex replacements
|
||||
plugins.push(() => {
|
||||
|
@ -407,7 +409,12 @@ export const ObsidianFlavoredMarkdown: QuartzTransformerPlugin<Partial<Options>
|
|||
children: [
|
||||
{
|
||||
type: "text",
|
||||
value: useDefaultTitle ? capitalize(calloutType) : titleContent + " ",
|
||||
value: useDefaultTitle
|
||||
? capitalize(
|
||||
i18n(cfg.locale).components.callout[calloutType as ValidCallout] ??
|
||||
calloutType,
|
||||
)
|
||||
: titleContent + " ",
|
||||
},
|
||||
...restOfTitle,
|
||||
],
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue