solid-markdown
Advanced tools
Comparing version 1.2.1 to 1.2.2
import type { Element, ElementContent, Root } from "hast"; | ||
import type { Schema } from "property-information"; | ||
import type { NormalComponents, SolidMarkdownProps } from "./complex-types"; | ||
declare type Context = { | ||
type Context = { | ||
options: Options; | ||
@@ -9,14 +9,14 @@ schema: Schema; | ||
}; | ||
declare type TransformLink = (href: string, children: ElementContent[], title?: string) => string; | ||
declare type TransformImage = (src: string, alt: string, title?: string) => string; | ||
declare type TransformLinkTargetType = "_self" | "_blank" | "_parent" | "_top" | (string & {}); | ||
declare type TransformLinkTarget = (href: string, children: ElementContent[], title?: string) => TransformLinkTargetType | undefined; | ||
declare type SolidMarkdownNames = keyof JSX.IntrinsicElements; | ||
declare type CodeComponent = Component<JSX.IntrinsicElements["code"] & SolidMarkdownProps & { | ||
type TransformLink = (href: string, children: ElementContent[], title?: string) => string; | ||
type TransformImage = (src: string, alt: string, title?: string) => string; | ||
type TransformLinkTargetType = "_self" | "_blank" | "_parent" | "_top" | (string & {}); | ||
type TransformLinkTarget = (href: string, children: ElementContent[], title?: string) => TransformLinkTargetType | undefined; | ||
type SolidMarkdownNames = keyof JSX.IntrinsicElements; | ||
type CodeComponent = Component<JSX.IntrinsicElements["code"] & SolidMarkdownProps & { | ||
inline?: boolean; | ||
}>; | ||
declare type HeadingComponent = Component<JSX.IntrinsicElements["h1"] & SolidMarkdownProps & { | ||
type HeadingComponent = Component<JSX.IntrinsicElements["h1"] & SolidMarkdownProps & { | ||
level: number; | ||
}>; | ||
declare type LiComponent = Component<JSX.IntrinsicElements["li"] & SolidMarkdownProps & { | ||
type LiComponent = Component<JSX.IntrinsicElements["li"] & SolidMarkdownProps & { | ||
checked: boolean | null; | ||
@@ -26,18 +26,18 @@ index: number; | ||
}>; | ||
declare type OrderedListComponent = Component<JSX.IntrinsicElements["ol"] & SolidMarkdownProps & { | ||
type OrderedListComponent = Component<JSX.IntrinsicElements["ol"] & SolidMarkdownProps & { | ||
depth: number; | ||
ordered: true; | ||
}>; | ||
declare type TableCellComponent = Component<JSX.IntrinsicElements["table"] & SolidMarkdownProps & { | ||
type TableCellComponent = Component<JSX.IntrinsicElements["table"] & SolidMarkdownProps & { | ||
style?: Record<string, unknown>; | ||
isHeader: boolean; | ||
}>; | ||
declare type TableRowComponent = Component<JSX.IntrinsicElements["tr"] & SolidMarkdownProps & { | ||
type TableRowComponent = Component<JSX.IntrinsicElements["tr"] & SolidMarkdownProps & { | ||
isHeader: boolean; | ||
}>; | ||
declare type UnorderedListComponent = Component<JSX.IntrinsicElements["ul"] & SolidMarkdownProps & { | ||
type UnorderedListComponent = Component<JSX.IntrinsicElements["ul"] & SolidMarkdownProps & { | ||
depth: number; | ||
ordered: false; | ||
}>; | ||
declare type SpecialComponents = { | ||
type SpecialComponents = { | ||
code: CodeComponent | SolidMarkdownNames; | ||
@@ -57,4 +57,4 @@ h1: HeadingComponent | SolidMarkdownNames; | ||
}; | ||
declare type Components = Partial<Omit<NormalComponents, keyof SpecialComponents>> & Partial<SpecialComponents>; | ||
export declare type Options = { | ||
type Components = Partial<Omit<NormalComponents, keyof SpecialComponents>> & Partial<SpecialComponents>; | ||
export type Options = { | ||
sourcePos: boolean; | ||
@@ -61,0 +61,0 @@ rawSourcePos: boolean; |
import { Component, JSX } from "solid-js"; | ||
import type { Element } from "hast"; | ||
import type { Position } from "unist"; | ||
import type { Element } from "hast"; | ||
/** | ||
* @typedef {import('unist').Position} Position | ||
*/ | ||
export interface SolidMarkdownProps { | ||
@@ -10,3 +13,3 @@ node: Element; | ||
*/ | ||
sourcePosition?: Position; | ||
sourcePosition: Position; | ||
/** | ||
@@ -21,4 +24,4 @@ * Passed when `options.includeElementIndex` is given | ||
} | ||
export declare type NormalComponents = { | ||
export type NormalComponents = { | ||
[TagName in keyof JSX.IntrinsicElements]: keyof JSX.IntrinsicElements | Component<JSX.IntrinsicElements[TagName] & SolidMarkdownProps>; | ||
}; |
@@ -5,14 +5,14 @@ import { Component } from "solid-js"; | ||
import { Options as FilterOptions } from "./rehype-filter"; | ||
declare type CoreOptions = { | ||
type CoreOptions = { | ||
children: string; | ||
}; | ||
declare type PluginOptions = { | ||
type PluginOptions = { | ||
remarkPlugins: PluggableList; | ||
rehypePlugins: PluggableList; | ||
}; | ||
declare type LayoutOptions = { | ||
type LayoutOptions = { | ||
class: string; | ||
}; | ||
declare type SolidMarkdownOptions = CoreOptions & PluginOptions & LayoutOptions & FilterOptions & TransformOptions; | ||
type SolidMarkdownOptions = CoreOptions & PluginOptions & LayoutOptions & FilterOptions & TransformOptions; | ||
declare const SolidMarkdown: Component<Partial<SolidMarkdownOptions>>; | ||
export default SolidMarkdown; |
import type { Element as HElement, Root as HRoot } from "hast"; | ||
import type { Plugin } from "unified"; | ||
declare type AllowElement = (element: HElement, index: number, parent: HElement | HRoot) => boolean | undefined; | ||
export declare type Options = { | ||
type AllowElement = (element: HElement, index: number, parent: HElement | HRoot) => boolean | undefined; | ||
export type Options = { | ||
allowedElements?: string[]; | ||
@@ -6,0 +6,0 @@ disallowedElements?: string[]; |
{ | ||
"name": "solid-markdown", | ||
"version": "1.2.1", | ||
"version": "1.2.2", | ||
"private": false, | ||
"description": "Render Markdown as Solid JS components", | ||
@@ -17,3 +18,2 @@ "keywords": [ | ||
], | ||
"sideEffects": false, | ||
"homepage": "https://github.com/andi23rosca/solid-markdown", | ||
@@ -24,2 +24,8 @@ "bugs": { | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/andi23rosca/solid-markdown.git" | ||
}, | ||
"license": "MIT", | ||
"author": "Andi Rosca <andi23rosca@gmail.com> (https://godoffrontend.com)", | ||
"contributors": [ | ||
@@ -33,43 +39,76 @@ { | ||
"url": "https://github.com/high1" | ||
}, | ||
{ | ||
"name": "Patrick Heneise", | ||
"url": "https://github.com/patrickheneise" | ||
} | ||
], | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/andi23rosca/solid-markdown.git" | ||
}, | ||
"type": "module", | ||
"main": "dist/index.jsx", | ||
"source": "lib/index.tsx", | ||
"main": "dist/index.jsx", | ||
"browser": "dist/index.browser.jsx", | ||
"types": "dist/index.d.ts", | ||
"type": "module", | ||
"files": [ | ||
"dist" | ||
], | ||
"author": "Andi Rosca <andi23rosca@gmail.com> (https://godoffrontend.com)", | ||
"scripts": { | ||
"build": "esbuild lib/index.tsx --bundle --outfile=dist/index.browser.jsx --jsx=preserve --external:solid-js --format=esm && tsc", | ||
"build-node": "esbuild lib/index.tsx --bundle --platform=node --outfile=dist/index.jsx --jsx=preserve --external:solid-js --format=esm && tsc" | ||
"build": "run-s build:*", | ||
"build:client": "esbuild lib/index.tsx --bundle --outfile=dist/index.browser.jsx --jsx=preserve --external:solid-js --format=esm && tsc", | ||
"build:server": "esbuild lib/index.tsx --bundle --platform=node --outfile=dist/index.jsx --jsx=preserve --external:solid-js --format=esm && tsc", | ||
"lint": "eslint --fix . --ext .ts --ext .tsx", | ||
"prepare": "husky install" | ||
}, | ||
"license": "MIT", | ||
"private": false, | ||
"devDependencies": { | ||
"@types/hast": "^2.3.4", | ||
"esbuild": "^0.14.27", | ||
"typescript": "^4.6.2" | ||
"commitlint": { | ||
"extends": [ | ||
"@commitlint/config-conventional" | ||
] | ||
}, | ||
"peerDependencies": { | ||
"solid-js": "^1.2.0" | ||
"lint-staged": { | ||
"*.{js,ts,tsx,json,md,yaml}": [ | ||
"prettier --write" | ||
], | ||
"*.{js,ts,jsx,tsx}": [ | ||
"eslint --cache --fix" | ||
] | ||
}, | ||
"release": { | ||
"branches": [ | ||
"main" | ||
] | ||
}, | ||
"dependencies": { | ||
"comma-separated-tokens": "^2.0.2", | ||
"property-information": "^6.1.1", | ||
"@types/hast": "^2.3.4", | ||
"@types/prop-types": "^15.7.5", | ||
"@types/unist": "^2.0.6", | ||
"comma-separated-tokens": "^2.0.3", | ||
"property-information": "^6.2.0", | ||
"remark-gfm": "^3.0.1", | ||
"remark-parse": "^10.0.1", | ||
"remark-rehype": "^10.1.0", | ||
"space-separated-tokens": "^2.0.1", | ||
"style-to-object": "^0.3.0", | ||
"solid-js": "^1.7.3", | ||
"space-separated-tokens": "^2.0.2", | ||
"style-to-object": "^0.4.1", | ||
"unified": "^10.1.2", | ||
"unist-util-visit": "^4.1.0", | ||
"vfile": "^5.3.2" | ||
"unist-util-visit": "^4.1.2", | ||
"vfile": "^5.3.7" | ||
}, | ||
"devDependencies": { | ||
"@commitlint/cli": "^17.5.1", | ||
"@commitlint/config-conventional": "^17.4.4", | ||
"@types/hast": "^2.3.4", | ||
"@typescript-eslint/parser": "^5.57.1", | ||
"esbuild": "^0.17.16", | ||
"eslint": "^8.38.0", | ||
"eslint-config-prettier": "^8.8.0", | ||
"eslint-plugin-json": "^3.1.0", | ||
"eslint-plugin-solid": "^0.12.0", | ||
"husky": "^8.0.3", | ||
"lint-staged": "^13.2.1", | ||
"npm-run-all": "^4.1.5", | ||
"prettier": "^2.8.7", | ||
"typescript": "^5.0.4" | ||
}, | ||
"peerDependencies": { | ||
"solid-js": "^1.2.0" | ||
} | ||
} |
@@ -6,2 +6,3 @@ # SolidJS version of `react-markdown` | ||
Changes include: | ||
- Replacing React specific component creation with SolidJS components | ||
@@ -13,2 +14,3 @@ - Porting the implementation from javascript with JSDoc types to typescript | ||
## Installation | ||
``` | ||
@@ -29,9 +31,10 @@ npm install solid-markdown | ||
- list | ||
` | ||
`; | ||
const App = () => { | ||
return <SolidMarkdown children={markdown} /> | ||
} | ||
return <SolidMarkdown children={markdown} />; | ||
}; | ||
``` | ||
## TODO | ||
- [ ] Port unit tests from from original library |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
550516
9
19104
38
0
15
14
+ Added@types/hast@^2.3.4
+ Added@types/prop-types@^15.7.5
+ Added@types/unist@^2.0.6
+ Addedsolid-js@^1.7.3
+ Added@types/prop-types@15.7.13(transitive)
+ Addedstyle-to-object@0.4.4(transitive)
- Removedstyle-to-object@0.3.0(transitive)
Updatedproperty-information@^6.2.0
Updatedstyle-to-object@^0.4.1
Updatedunist-util-visit@^4.1.2
Updatedvfile@^5.3.7