Skip to content

Commit

Permalink
fix lint error
Browse files Browse the repository at this point in the history
  • Loading branch information
yuki-takei committed Feb 28, 2024
1 parent 2b7e0b4 commit f6a5ed5
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions apps/app/src/services/renderer/remark-plugins/xsv-to-table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import csvToMarkdownTable from 'csv-to-markdown-table';
import { fromMarkdown } from 'mdast-util-from-markdown';
import { gfmTableFromMarkdown } from 'mdast-util-gfm-table';
import { gfmTable } from 'micromark-extension-gfm-table';
import { Plugin } from 'unified';
import { Node } from 'unist';
import type { Plugin } from 'unified';
import type { Node } from 'unist';
import { visit } from 'unist-util-visit';

type Lang = 'csv' | 'csv-h' | 'tsv' | 'tsv-h';
Expand All @@ -12,13 +12,10 @@ function isXsv(lang: unknown): lang is Lang {
return /^(csv|csv-h|tsv|tsv-h)$/.test(lang as string);
}

// workaround for the broken type definition of csv-to-markdown-table -- 2022.09.15 Yuki Takei
const csvToMarkdown = csvToMarkdownTable.csvToMarkdown ?? csvToMarkdownTable;

function rewriteNode(node: Node, lang: Lang) {
const tableContents = node.value as string;

const tableDoc = csvToMarkdown(
const tableDoc = csvToMarkdownTable(
tableContents,
lang === 'csv' || lang === 'csv-h' ? ',' : '\t',
lang === 'csv-h' || lang === 'tsv-h',
Expand Down

0 comments on commit f6a5ed5

Please sign in to comment.