![]() |
VOOZH | about |
dotnet add package magic.lambda.html --version 17.3.9
NuGet\Install-Package magic.lambda.html -Version 17.3.9
<PackageReference Include="magic.lambda.html" Version="17.3.9" />
<PackageVersion Include="magic.lambda.html" Version="17.3.9" />Directory.Packages.props
<PackageReference Include="magic.lambda.html" />Project file
paket add magic.lambda.html --version 17.3.9
#r "nuget: magic.lambda.html, 17.3.9"
#:package magic.lambda.html@17.3.9
#addin nuget:?package=magic.lambda.html&version=17.3.9Install as a Cake Addin
#tool nuget:?package=magic.lambda.html&version=17.3.9Install as a Cake Tool
This project provides HTML helper slots for Magic. More specifically, it provides the following slots.
.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
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>
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>
.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.
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 is 100% Open Source and you can find the primary project GitHub page here.
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.
The projects is copyright Thomas Hansen 2023 - 2024, and professionally maintained by AINIRO.IO.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 net5.0 was computed. net5.0-windows net5.0-windows was computed. net6.0 net6.0 was computed. net6.0-android net6.0-android was computed. net6.0-ios net6.0-ios was computed. net6.0-maccatalyst net6.0-maccatalyst was computed. net6.0-macos net6.0-macos was computed. net6.0-tvos net6.0-tvos was computed. net6.0-windows net6.0-windows was computed. net7.0 net7.0 was computed. net7.0-android net7.0-android was computed. net7.0-ios net7.0-ios was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-macos net7.0-macos was computed. net7.0-tvos net7.0-tvos was computed. net7.0-windows net7.0-windows was computed. net8.0 net8.0 was computed. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 was computed. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 netcoreapp2.0 was computed. netcoreapp2.1 netcoreapp2.1 was computed. netcoreapp2.2 netcoreapp2.2 was computed. netcoreapp3.0 netcoreapp3.0 was computed. netcoreapp3.1 netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 netstandard2.0 is compatible. netstandard2.1 netstandard2.1 was computed. |
| .NET Framework | net461 net461 was computed. net462 net462 was computed. net463 net463 was computed. net47 net47 was computed. net471 net471 was computed. net472 net472 was computed. net48 net48 was computed. net481 net481 was computed. |
| MonoAndroid | monoandroid monoandroid was computed. |
| MonoMac | monomac monomac was computed. |
| MonoTouch | monotouch monotouch was computed. |
| Tizen | tizen40 tizen40 was computed. tizen60 tizen60 was computed. |
| Xamarin.iOS | xamarinios xamarinios was computed. |
| Xamarin.Mac | xamarinmac xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos xamarinwatchos was computed. |
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 |
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 17.3.9 | 1,502 | 2/17/2024 |
| 17.3.7 | 332 | 2/12/2024 |
| 17.3.6 | 294 | 2/12/2024 |
| 17.3.4 | 326 | 2/9/2024 |
| 17.3.3 | 292 | 2/8/2024 |
| 17.3.2 | 295 | 2/2/2024 |
| 17.3.1 | 310 | 1/30/2024 |
| 17.2.1 | 295 | 1/30/2024 |
| 17.2.0 | 329 | 1/22/2024 |
| 17.1.7 | 366 | 1/12/2024 |
| 17.1.6 | 344 | 1/11/2024 |
| 17.1.5 | 348 | 1/5/2024 |
| 17.0.1 | 411 | 1/1/2024 |
| 17.0.0 | 529 | 12/14/2023 |
| 16.11.5 | 500 | 11/12/2023 |
| 16.9.0 | 446 | 10/9/2023 |
| 16.7.0 | 784 | 7/11/2023 |
| 16.4.1 | 603 | 7/2/2023 |
| 16.4.0 | 615 | 6/22/2023 |
| 16.3.1 | 524 | 6/7/2023 |