diff options
| author | Fuwn <[email protected]> | 2024-03-25 00:59:25 +0000 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2024-03-25 00:59:25 +0000 |
| commit | 40680a3648cc7d598d428d6fe1752a2be9bfd547 (patch) | |
| tree | c4ea43de3543995c0b81e1a982c8671479012fd5 /examples/markdown.rs | |
| parent | feat(crate): bump version (diff) | |
| download | germ-40680a3648cc7d598d428d6fe1752a2be9bfd547.tar.xz germ-40680a3648cc7d598d428d6fe1752a2be9bfd547.zip | |
docs(examples): comment examples
Diffstat (limited to 'examples/markdown.rs')
| -rw-r--r-- | examples/markdown.rs | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/examples/markdown.rs b/examples/markdown.rs index c14cdc5..f909894 100644 --- a/examples/markdown.rs +++ b/examples/markdown.rs @@ -16,6 +16,9 @@ // Copyright (C) 2022-2022 Fuwn <[email protected]> // SPDX-License-Identifier: GPL-3.0-only +//! This example demonstrates Germ's capabilities for converting Gemtext to +//! Markdown. + const EXAMPLE_GEMTEXT: &str = r#"```This is alt-text Here goes the pre-formatted text. @@ -46,12 +49,12 @@ This is more text after a blank line. That was a link without text."#; fn main() { - std::fs::write( - "examples/convert.md", - germ::convert::from_string( - EXAMPLE_GEMTEXT, - &germ::convert::Target::Markdown, - ), - ) - .expect("could not write to file"); + // Convert the Gemtext to Markdown + let html = germ::convert::from_string( + EXAMPLE_GEMTEXT, + &germ::convert::Target::Markdown, + ); + + // Write the Markdown to a file + std::fs::write("examples/convert.md", html).expect("could not write to file"); } |