Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/Nodsoft/MoltenObsidian
Obsidian-flavoured Markdown parsing library for .NET 6+, with support for Obsidian Vaults navigation.
https://github.com/Nodsoft/MoltenObsidian
aspnetcore blazor dotnet extensions html library markdig markdown moltenobsidian obsidian obsidian-md obsidian-vault ssg
Last synced: about 1 month ago
JSON representation
Obsidian-flavoured Markdown parsing library for .NET 6+, with support for Obsidian Vaults navigation.
- Host: GitHub
- URL: https://github.com/Nodsoft/MoltenObsidian
- Owner: Nodsoft
- License: mit
- Created: 2022-11-17T01:18:39.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-08-25T19:02:30.000Z (4 months ago)
- Last Synced: 2024-08-26T17:41:24.633Z (4 months ago)
- Topics: aspnetcore, blazor, dotnet, extensions, html, library, markdig, markdown, moltenobsidian, obsidian, obsidian-md, obsidian-vault, ssg
- Language: C#
- Homepage: https://moltenobsidian.dev
- Size: 3 MB
- Stars: 61
- Watchers: 4
- Forks: 2
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- project-awesome - Nodsoft/MoltenObsidian - Obsidian-flavoured Markdown parsing library for .NET 6+, with support for Obsidian Vaults navigation. (C# #)
README
MoltenObsidian
.NET 6+ Library for Obsidian-flavoured Markdown parsing, with support for vault mapping and Blazor.
## Premise
Molten Obsidian is a high-performance library designed as an easily integrated and lightweight FOSS alternative to [Obsidian Publish](https://publish.obsidian.md).
With extensibility and integration-oriented conception, this library makes it perfect for integrating Obsidian-flavoured markdown notes on your Blazor App, but also importing entire vaults as a navigation-ready area, with full routing support.Furthermore, Molten Obisidian extends past the original [Obsidian specifications](https://help.obsidian.md/), aiming to supercharge your documentation/wiki applications and websites needs, using a customizable data source interface, and supercharged YAML frontmatter capabilities.
### Example
**Converting an Obsidian-flavoured Markdown note to HTML** is as simple as this :
```csharp
using Nodsoft.MoltenObsidian;// Create a new ObsidianText instance with the content to convert
ObsidianText obsidianMarkdown = new(@"
# Hello, world!This is a sample Markdown document.
And a paragraph with **bold** and *italic* text.
");// This is the HTML string you can then call in Blazor components as `@htmlText`.
MarkupString htmlText = obsidianMarkdown.ToHtml();
```
But that's just the basics. Under the hood, [Markdig](https://github.com/xoofx/markdig) is what makes it happen. Easy!**Now let's open an Obsidian vault on the Filesystem, and wire it to a routable Blazor component :**
*`Startup.cs`*
```csharp
using Nodsoft.MoltenObsidian.Blazor;
using Nodsoft.MoltenObsidian.Vault;
using Nodsoft.MoltenObsidian.Vaults.FileSystem;// First deal with the DI, by adding a Filesystem vault and the Blazor integration:
public void ConfigureServices(IServiceCollection services)
{
services.AddMoltenObsidianFileSystemVault(new DirectoryInfo("/path/to/vault"));
services.AddMoltenObsidianBlazorIntegration();
}
```
*`_Imports.razor`*
```razor
@using Nodsoft.MoltenObsidian.Blazor
@using Nodsoft.MoltenObsidian.Blazor.Helpers;
@using Nodsoft.MoltenObsidian.Vault;
```
*`VaultPage.razor`*
```razor
@page "/vault/{*VaultPath}"
@inject IVault Vault
@code {
[Parameter]
public string VaultPath { get; set; }
}
```In a matter of minutes, you've just created a web app integration for your own Obsidian Vault, for all to see. Congratulations!
Now, let's take it further.
## Customizations
### Vault sources (see: [Vaults](/Vaults))
Molten Obsidian is designed with extensibility at its core, and allows you to implement your own Vault source. Should the [**existing reference Vault providers**](/Vaults) not be suitable for your Vault storage needs, you can provide your own implementation.**A few examples of additional stores you can implement:**
- Database store (xSQL, MongoDB, etc...)
- Over-the-wire/Network-based (NFS, etc...)
- VCS-based (Git repo)If you're finding yourself implementing any of these, feel free to PR! We'll be more than happy to support new vault providers.
### Layouts
Molten Obsidian is meant to tailor itself to your app. As such, you can provide within the Blazor Component a series of `RenderFragment` delegates responsible for organizing the Vault display.You can provide them in cascade, as such :
```razor
Vault note: @file.NoteName
Return to @(file.Parent?.Name ?? "Root")
@(new MarkupString(file.ReadDocument().ToHtml()))
Sorry, there is nothing here.
```
Alternatively, you can provide delegates, like so :
```razor
@code {
public static RenderFragment OnFoundFile(IVaultNote file) => __builder =>
{
Vault note: @file.NoteName
Return to @(file.Parent?.Name ?? "Root")
@(new MarkupString(file.ReadDocument().ToHtml()))
};
public static RenderFragment OnNotFound(string _) => static __builder =>
{
Sorry, there's nothing here.
};
}
```## CLI Tool
Our CLI tool aims at cutting down the menial tasks associated with implementing more advanced features of Molten Obsidian, allowing you to better focus on what matters, but also automating any of those integration tasks within you workflow.### ***See: [Nodsoft.MoltenObsidian.Tool](/Nodsoft.MoltenObsidian.Tool)***