mirror of
https://github.com/withastro/astro.git
synced 2024-12-16 21:46:22 -05:00
[ci] format
This commit is contained in:
parent
fb84622af0
commit
d4b00b541b
4 changed files with 9 additions and 8 deletions
|
@ -1,6 +1,6 @@
|
|||
import type { ConfigType as MarkdocConfig } from '@markdoc/markdoc';
|
||||
import { nodes as astroNodes } from './nodes/index.js';
|
||||
import _Markdoc from '@markdoc/markdoc';
|
||||
import { nodes as astroNodes } from './nodes/index.js';
|
||||
|
||||
export const Markdoc = _Markdoc;
|
||||
export const nodes = { ...Markdoc.nodes, ...astroNodes };
|
||||
|
|
|
@ -9,8 +9,8 @@ import { isValidUrl, MarkdocError, parseFrontmatter, prependForwardSlash } from
|
|||
import { emitESMImage } from 'astro/assets';
|
||||
import { bold, red, yellow } from 'kleur/colors';
|
||||
import type * as rollup from 'rollup';
|
||||
import { applyDefaultConfig } from './runtime.js';
|
||||
import { loadMarkdocConfig, type MarkdocConfigResult } from './load-config.js';
|
||||
import { applyDefaultConfig } from './runtime.js';
|
||||
|
||||
type SetupHookParams = HookParameters<'astro:config:setup'> & {
|
||||
// `contentEntryType` is not a public API
|
||||
|
@ -103,7 +103,9 @@ ${
|
|||
? `\nimport { experimentalAssetsConfig } from '@astrojs/markdoc/experimental-assets-config';\nuserConfig.nodes = { ...experimentalAssetsConfig.nodes, ...userConfig.nodes };`
|
||||
: ''
|
||||
}
|
||||
const stringifiedAst = ${JSON.stringify(/* Double stringify to encode *as* stringified JSON */ JSON.stringify(ast))};
|
||||
const stringifiedAst = ${JSON.stringify(
|
||||
/* Double stringify to encode *as* stringified JSON */ JSON.stringify(ast)
|
||||
)};
|
||||
export function getHeadings() {
|
||||
${
|
||||
/* Yes, we are transforming twice (once from `getHeadings()` and again from <Content /> in case of variables).
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import Markdoc, { type RenderableTreeNode, type Schema } from '@markdoc/markdoc';
|
||||
import { getTextContent } from '../runtime.js';
|
||||
import Slugger from 'github-slugger';
|
||||
import { getTextContent } from '../runtime.js';
|
||||
|
||||
export const headingSlugger = new Slugger();
|
||||
export const headingSlugger = new Slugger();
|
||||
|
||||
function getSlug(attributes: Record<string, any>, children: RenderableTreeNode[]): string {
|
||||
if (attributes.id && typeof attributes.id === 'string') {
|
||||
|
@ -25,7 +25,6 @@ export const heading: Schema = {
|
|||
const { level, ...attributes } = node.transformAttributes(config);
|
||||
const children = node.transformChildren(config);
|
||||
|
||||
|
||||
const slug = getSlug(attributes, children);
|
||||
|
||||
const render = config.nodes?.heading?.render ?? `h${level}`;
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
import type { MarkdownHeading } from '@astrojs/markdown-remark';
|
||||
import Markdoc, {
|
||||
type RenderableTreeNode,
|
||||
type ConfigType as MarkdocConfig,
|
||||
type RenderableTreeNode,
|
||||
} from '@markdoc/markdoc';
|
||||
import type { ContentEntryModule } from 'astro';
|
||||
import { nodes as astroNodes } from './nodes/index.js';
|
||||
|
||||
/** Used to reset Slugger cache on each build at runtime */
|
||||
export { headingSlugger } from './nodes/index.js';
|
||||
export { default as Markdoc } from '@markdoc/markdoc';
|
||||
export { headingSlugger } from './nodes/index.js';
|
||||
|
||||
export function applyDefaultConfig(
|
||||
config: MarkdocConfig,
|
||||
|
|
Loading…
Reference in a new issue