magic.lambda.html 17.3.9

dotnet add package magic.lambda.html --version 17.3.9
NuGet\Install-Package magic.lambda.html -Version 17.3.9
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="magic.lambda.html" Version="17.3.9" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add magic.lambda.html --version 17.3.9
#r "nuget: magic.lambda.html, 17.3.9"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install magic.lambda.html as a Cake Addin
#addin nuget:?package=magic.lambda.html&version=17.3.9

// Install magic.lambda.html as a Cake Tool
#tool nuget:?package=magic.lambda.html&version=17.3.9

magic.lambda.html - HTML and Markdown support in Hyperlambda

This project provides HTML helper slots for Magic. More specifically, it provides the following slots.

  • [html2lambda] - Creates a lambda object out of an HTML input string.
  • [lambda2html] - Creates an HTML string out of the specified lambda object.
  • [markdown2html] - Creates HTML out of the specified Markdown input string.
  • [html2markdown] - Creates Markdown out of the specified HTML input string.

How to use [html2lambda]

.html:@"<html>
  <head>
    <title>Howdy</title>
  </head>
  <body>
    <p class=""foo"">Howdy <strong>world</strong> - This is cool!</p>
  </body>
</html>"

html2lambda:x:-

The above results in something resembling the following.

html2lambda
   html
      head
         title
            #text:Howdy
      body
         p
            @class:foo
            #text:"Howdy "
            strong
               #text:world
            #text:" - This is cool!"

Attributes starts out with the @ character, children nodes does not - While text content inside of elements will have the name of #text. This implies you'll need to use escaped expression iterators when traversing the resulting node lambda object. For instance, to retrieve the above title element's inner text, you could use something such as the following.

get-value:x:-/**/title/*\#text

How to use [lambda2html]

This is the reverse of [html2lambda] and returns HTML resulting from the specified lambda object. Below is example usage.

.html:@"<html>
  <head>
    <title>Howdy</title>
  </head>
  <body>
    <p class=""foo"">Howdy <strong>world</strong> - This is cool!</p>
  </body>
</html>"
html2lambda:x:-
lambda2html:x:-/*

The above will result in the following HTML, formatted for brevity.

<html>
  <head>
    <title>Howdy</title>
  </head>
  <body>
    <p class="foo">Howdy <strong>world</strong> - This is cool!</p>
  </body>
</html>

How to use [markdown2html]

This library can also handle Markdown, since Markdown is arguably just another representation of HTML. The [markdown2html] slot converts the specified Markdown content to HTML. Basic usage is as follows.

.yaml:@"
Howdy world

* Foo
* Bar
"
markdown2html:x:@.yaml

The above will produce the following result.

markdown2html:@"<p>Howdy world</p>
<ul>
<li>Foo</li>
<li>Bar</li>
</ul>

How to use [html2markdown]

.html:@"<html>
  <head>
    <title>Howdy</title>
  </head>
  <body>
    <h1>Header here</h1>
    <p class=""foo"">Howdy <strong>world</strong> - This is cool!</p>
  </body>
</html>"

html2markdown:x:-

The above results in something resembling the following.

# Header here

Howdy **world** - This is cool!

This slot will do its best to convert the specified HTML to Markdown. The process isn't perfect, since it is impossible to consistently turn HTML into Markdown, but it is very strong in comparison to other similar libraries out there.

You can optionally supply a [url] argument, which will be used to resolve relative URLs in your HTML. The process will also return meta information, such as title, description, etc, in addition to all URLs it finds in the document as a list of URLs in [urls].

You can also optionally supply the following arguments, which all defaults to boolean true.

  • [images] - If true imports images
  • [code] - If true imports code
  • [lists] - If true imports lists

Front matter and [markdown2html]

The [markdown2html] slot can also handle "front matter", which allows you to inject YAML at the front of your Markdown. Front matter again is just a YAML declaration injected at the front of your Markdown, separated by --- to separate your YAML from your Markdown. This allows you to add structured data to associate with your Markdown content.

.yaml:@"---
foo: bar
---
Howdy world

* Foo
* Bar
"
markdown2html:x:@.yaml

Internally, the library will invoke [yaml2lambda] for any front matter declarations to actually parse the specified YAML front matter parts, implying for details about how this part works, please refer to the "magic.lambda.json" project.

Magic's GitHub project page

Magic is 100% Open Source and you can find the primary project GitHub page here.

Project website for magic.lambda.html

The source code for this repository can be found at github.com/polterguy/magic.lambda.html, and you can provide feedback, provide bug reports, etc at the same place.

  • Build status
  • Quality Gate Status
  • Bugs
  • Code Smells
  • Coverage
  • Duplicated Lines (%)
  • Lines of Code
  • Maintainability Rating
  • Reliability Rating
  • Security Rating
  • Technical Debt
  • Vulnerabilities

The projects is copyright Thomas Hansen 2023 - 2024, and professionally maintained by AINIRO.IO.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on magic.lambda.html:

Package Downloads
magic.library

Helper project for Magic to wire up everything easily by simply adding one package, and invoking two simple methods. When using Magic, this is (probably) the only package you should actually add, since this package pulls in everything else you'll need automatically, and wires up everything sanely by default. To use package go to https://polterguy.github.io

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
17.3.9 100 2/17/2024
17.3.7 118 2/12/2024
17.3.6 89 2/12/2024
17.3.4 104 2/9/2024
17.3.3 89 2/8/2024
17.3.2 93 2/2/2024
17.3.1 94 1/30/2024
17.2.1 89 1/30/2024
17.2.0 119 1/22/2024
17.1.7 151 1/12/2024
17.1.6 131 1/11/2024
17.1.5 147 1/5/2024
17.0.1 184 1/1/2024
17.0.0 317 12/14/2023
16.11.5 296 11/12/2023
16.9.0 289 10/9/2023
16.7.0 483 7/11/2023
16.4.1 350 7/2/2023
16.4.0 371 6/22/2023
16.3.1 319 6/7/2023
16.3.0 316 5/28/2023
16.1.9 599 4/30/2023
15.10.11 454 4/13/2023
15.9.1 564 3/27/2023
15.9.0 429 3/24/2023
15.8.2 484 3/20/2023
15.7.0 367 3/6/2023
15.5.0 1,504 1/28/2023
15.2.0 639 1/18/2023
15.1.0 1,119 12/28/2022
14.5.7 680 12/13/2022
14.5.5 768 12/6/2022
14.5.1 641 11/23/2022
14.5.0 598 11/18/2022
14.4.5 682 10/22/2022
14.4.1 719 10/22/2022
14.4.0 632 10/17/2022
14.3.1 1,219 9/12/2022
14.3.0 622 9/10/2022
14.1.3 865 8/7/2022
14.1.2 638 8/7/2022
14.1.1 610 8/7/2022
14.0.14 657 7/26/2022
14.0.12 637 7/24/2022
14.0.11 634 7/23/2022
14.0.10 603 7/23/2022
14.0.9 637 7/23/2022
14.0.8 688 7/17/2022
14.0.5 775 7/11/2022
14.0.4 730 7/6/2022
14.0.3 664 7/2/2022
14.0.2 624 7/2/2022
14.0.0 829 6/25/2022
13.4.0 2,003 5/31/2022
13.3.4 1,399 5/9/2022
13.3.0 931 5/1/2022
13.2.0 1,118 4/21/2022
13.1.0 959 4/7/2022
13.0.0 687 4/5/2022
11.0.5 1,337 3/2/2022
11.0.4 744 2/22/2022
11.0.3 713 2/9/2022
11.0.2 755 2/6/2022
11.0.1 752 2/5/2022
10.0.21 734 1/28/2022
10.0.20 738 1/27/2022
10.0.19 715 1/23/2022
10.0.18 688 1/17/2022
10.0.15 886 12/31/2021
10.0.14 520 12/28/2021
10.0.7 1,413 12/22/2021
10.0.5 701 12/18/2021
9.9.9 1,605 11/29/2021
9.9.3 884 11/9/2021
9.9.2 608 11/4/2021
9.9.0 696 10/30/2021
9.8.9 660 10/29/2021
9.8.7 621 10/27/2021
9.8.6 589 10/27/2021
9.8.5 684 10/26/2021
9.8.0 1,292 10/20/2021
9.7.9 592 10/19/2021
9.7.5 1,441 10/14/2021
9.7.0 821 10/9/2021
9.6.6 1,154 8/14/2021
9.2.0 6,097 5/26/2021
9.1.4 1,215 4/21/2021
9.1.0 988 4/14/2021
9.0.0 809 4/5/2021
8.9.9 960 3/30/2021
8.9.3 1,481 3/19/2021