From f2e7c6b7a5aeed1d35303f752f5893093076b350 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Mon, 15 Apr 2024 07:47:53 -0700 Subject: [PATCH] Remove rust/WASI markdown parser example The documentation referring to this example was removed in #6994 and that forgot to remove this as well. This example is building without a lock file which is causing issues in #8368. --- .github/workflows/main.yml | 1 - docs/rust_wasi_markdown_parser/Cargo.toml | 10 ---- .../example_markdown.md | 3 -- docs/rust_wasi_markdown_parser/src/main.rs | 46 ------------------- 4 files changed, 60 deletions(-) delete mode 100644 docs/rust_wasi_markdown_parser/Cargo.toml delete mode 100644 docs/rust_wasi_markdown_parser/example_markdown.md delete mode 100644 docs/rust_wasi_markdown_parser/src/main.rs diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 2f30fbe67b49..48417841ff6b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -266,7 +266,6 @@ jobs: cargo install --root ${{ runner.tool_cache }}/mdbook --version ${{ env.CARGO_MDBOOK_VERSION }} mdbook --locked - run: (cd docs && mdbook build) - run: cargo build -p wasi-common --features wasmtime/wat,wasmtime/cranelift - - run: (cd docs/rust_wasi_markdown_parser && cargo build) - run: (cd docs && mdbook test -L ../target/debug/deps) # Build Rust API documentation. diff --git a/docs/rust_wasi_markdown_parser/Cargo.toml b/docs/rust_wasi_markdown_parser/Cargo.toml deleted file mode 100644 index a9562ff1a4e5..000000000000 --- a/docs/rust_wasi_markdown_parser/Cargo.toml +++ /dev/null @@ -1,10 +0,0 @@ -[package] -name = "rust_wasi_markdown_parser" -version = "0.1.0" -edition = "2021" - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - -[dependencies] -pulldown-cmark = "0.1.2" -structopt = "0.3.22" diff --git a/docs/rust_wasi_markdown_parser/example_markdown.md b/docs/rust_wasi_markdown_parser/example_markdown.md deleted file mode 100644 index c43cf286e056..000000000000 --- a/docs/rust_wasi_markdown_parser/example_markdown.md +++ /dev/null @@ -1,3 +0,0 @@ -# Hello! - -I am example markdown for this demo! diff --git a/docs/rust_wasi_markdown_parser/src/main.rs b/docs/rust_wasi_markdown_parser/src/main.rs deleted file mode 100644 index b588b6ad40b9..000000000000 --- a/docs/rust_wasi_markdown_parser/src/main.rs +++ /dev/null @@ -1,46 +0,0 @@ -// Import our CLI parsing libraries (And PathBuf for reading paths) -extern crate structopt; - -use structopt::StructOpt; -use std::path::PathBuf; - -// Import our markdown parser library, crate -extern crate pulldown_cmark; - -use pulldown_cmark::{html, Parser}; - -// Import from the standard library, to allow reading from the file system -use std::fs; - -// Define our CLI options using structopt -#[derive(StructOpt)] -#[structopt(name = "rust_wasi_markdown_parser", about = "Markdown to HTML renderer CLI, written with Rust & WASI")] -pub struct Options { - /// The markdown file to render - #[structopt(parse(from_os_str))] - filename: PathBuf, -} - -// Our entrypoint into our WASI module -fn main() { - - // Get the passed CLI options - let options = Options::from_args(); - - // Read the markdown file into a string - let contents = fs::read_to_string(options.filename) - .expect("Something went wrong reading the file"); - - // Run our parsing function to get back an HTML string - let result = render_markdown(contents); - - // Print out the resulting HTML to standard out - println!("{}", result); -} - -pub fn render_markdown(markdown: String) -> String { - let mut html_buf = String::new(); - let parser = Parser::new(&markdown[..]); - html::push_html(&mut html_buf, parser); - html_buf -}