Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
ota-meshi committed Jul 19, 2023
1 parent b50c49e commit b11572b
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/head.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export type HeadObject = Record<string, any>;
*/
export function preprocessHead(
frontmatter: any,
options: ResolvedOptions
options: ResolvedOptions,
): HeadObject | null {
if (!options.headEnabled) return frontmatter;

Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export default function (options: Options = {}): Plugin {

const filter = createFilter(
resolvedOptions.include || /\.md$/,
resolvedOptions.exclude
resolvedOptions.exclude,
);

return {
Expand Down
10 changes: 5 additions & 5 deletions src/markdown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ function parseHtml(html: string) {
});
newHtml = newHtml.replace(SVELTE_TAGS_RE, (_, startTag, inner) => {
const tagName = GET_SVELTE_TAG_NAME_RE.exec(
startTag.slice(1)
startTag.slice(1),
)![0].toLowerCase();
let svelteTag = svelteTags.find((tag) => tag.tagName === tagName);
if (!svelteTag) {
Expand All @@ -85,7 +85,7 @@ export type MarkdownProcessor = (id: string, text: string) => string;
* Creates md processor
*/
export function createMarkdownProcessor(
options: ResolvedOptions
options: ResolvedOptions,
): MarkdownProcessor {
const markdownIt = new MarkdownIt({
html: true,
Expand Down Expand Up @@ -127,14 +127,14 @@ export function createMarkdownProcessor(

const { head, frontmatter } = frontmatterPreprocess(
parsedFrontmatter?.data ?? {},
options
options,
);
parsedHtml.moduleContext.prepend(
`export const frontmatter = ${JSON.stringify(frontmatter)}`
`export const frontmatter = ${JSON.stringify(frontmatter)}`,
);
if (headEnabled && head) {
let svelteHead = parsedHtml.svelteTags.find(
(tag) => tag.tagName === "svelte:head"
(tag) => tag.tagName === "svelte:head",
);
if (!svelteHead) {
svelteHead = new TagContent("svelte:head");
Expand Down
4 changes: 2 additions & 2 deletions tests/highlight-tools/line-numbers-plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ export default (md: MarkdownIt): void => {
const rawCode = fence(...args);
const code = rawCode.slice(
rawCode.indexOf("<code>"),
rawCode.indexOf("</code>")
rawCode.indexOf("</code>"),
);

const lines = code.split("\n");
const lineNumbersCode = lines
.slice(0, -1)
.map(
(_line, index) => `<span class="line-number">${index + 1}</span><br>`
(_line, index) => `<span class="line-number">${index + 1}</span><br>`,
)
.join("");

Expand Down

0 comments on commit b11572b

Please sign in to comment.