Skip to content

Commit

Permalink
Feliz.Markdown v2.4.0 fixes ICodeProperties and adds markdown.compone…
Browse files Browse the repository at this point in the history
…nts.pre
  • Loading branch information
Zaid-Ajaj committed Jan 14, 2023
1 parent 582f4fb commit 684c300
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
4 changes: 2 additions & 2 deletions Feliz.Markdown/Feliz.Markdown.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<PackageIconUrl></PackageIconUrl>
<PackageTags>fsharp;fable;react;html</PackageTags>
<Authors>Zaid Ajaj</Authors>
<Version>2.3.0</Version>
<Version>2.4.0</Version>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
<PropertyGroup>
Expand All @@ -20,6 +20,6 @@
</ItemGroup>
<ItemGroup>
<PackageReference Update="FSharp.Core" Version="4.7.2" />
<PackageReference Include="Feliz" Version="2.3.0" />
<PackageReference Include="Feliz" Version="2.4.0" />
</ItemGroup>
</Project>
19 changes: 16 additions & 3 deletions Feliz.Markdown/Markdown.fs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ open Feliz
type IMarkdownRenderer = interface end

type ICodeProperties =
abstract language : string

This comment has been minimized.

Copy link
@EverybodyKurts

EverybodyKurts Feb 5, 2024

Now that language and value have been removed from ICodeProperties, what should they be replaced with?

abstract value : string
abstract isInline : bool
abstract className : string
abstract children: ReactElement []

type ITextProperties =
abstract children: string
Expand Down Expand Up @@ -49,6 +50,9 @@ type IListItemProperties =
type IPluginsProperties =
abstract children: ReactElement []

type IPreProperties =
abstract children: ReactElement []

type IComponent = interface end

[<Erase>]
Expand Down Expand Up @@ -76,7 +80,16 @@ module markdown =
static member inline ol(render: IListProperties -> ReactElement) = unbox<IComponent> (Interop.mkAttr "ol" render)
static member inline ul(render: IListProperties -> ReactElement) = unbox<IComponent> (Interop.mkAttr "ul" render)
static member inline li(render: IListProperties -> ReactElement) = unbox<IComponent> (Interop.mkAttr "li" render)
static member inline code(render: ICodeProperties -> ReactElement) = unbox<IComponent> (Interop.mkAttr "code" render)
static member inline code(render: ICodeProperties -> ReactElement) =
let renderInternal (props: obj) =
let inputs = createObj [
"className" ==> emitJsExpr<string> props "$0.className || \"\""
"children" ==> emitJsExpr<ReactElement []> props "$0.children || []"
"isInline" ==> emitJsExpr<bool> props "$0.inline || false"
]
render (unbox<ICodeProperties> inputs)
unbox<IComponent> (Interop.mkAttr "code" renderInternal)
static member inline pre(render: ICodeProperties -> ReactElement) = unbox<IComponent> (Interop.mkAttr "pre" render)


type INodeType = interface end
Expand Down

0 comments on commit 684c300

Please sign in to comment.