| Crates.io | oak-powershell |
| lib.rs | oak-powershell |
| version | 0.0.1 |
| created_at | 2025-10-21 17:41:32.316359+00 |
| updated_at | 2026-01-23 04:43:45.816553+00 |
| description | PowerShell script parser with support for modern PowerShell syntax and cmdlets. |
| homepage | https://github.com/ygg-lang/oaks |
| repository | https://github.com/ygg-lang/oaks |
| max_upload_size | |
| id | 1894203 |
| size | 116,922 |
A comprehensive PowerShell parser supporting modern PowerShell syntax, built on oak-core for accurate parsing and AST generation.
Oak-powershell is a robust PowerShell parser designed to handle the complete PowerShell scripting language syntax including modern PowerShell constructs. Built on the solid foundation of oak-core, it provides accurate parsing of PowerShell scripts with detailed AST generation and comprehensive language support.
Basic example:
use oak_markdown::MarkdownParser;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let parser = MarkdownParser::new();
let markdown = r#"# Hello World
This is a **bold** statement and this is *italic* text.
## Features
- First item
- Second item
- Third item
[Link to documentation](https://docs.rs/oak-markdown)"#;
let document = parser.parse(markdown)?;
println!("Parsed {} blocks", document.blocks.len());
Ok(())
}
use oak_markdown::{MarkdownParser, ast::Block};
let parser = MarkdownParser::new();
let markdown = r#"# Main Title
## Section 1
This is the first paragraph with **bold** and *italic* text.
### Subsection
Here's a [link](https://example.com) and some `inline code`.
## Section 2
- List item 1
- List item 2
- List item 3"#;
let document = parser.parse(markdown)?;
for block in &document.blocks {
match block {
Block::Heading(heading) => {
println!("Heading level {}: {}", heading.level, heading.text);
}
Block::Paragraph(paragraph) => {
println!("Paragraph with {} inline elements", paragraph.inlines.len());
}
_ => {}
}
}
use oak_markdown::{MarkdownParser, ast::Block};
let parser = MarkdownParser::new();
let markdown = r#"| Name | Age | City |
|------|-----|------|
| Alice | 25 | New York |
| Bob | 30 | London |
| Carol | 28 | Tokyo |
## Code Block
```rust
fn main() {
println!("Hello, World!");
}
```"#;
let document = parser.parse(markdown)?;
for block in &document.blocks {
match block {
Block::Table(table) => {
println!("Table with {} rows and {} columns",
table.rows.len(), table.headers.len());
}
Block::CodeBlock(code) => {
println!("Code block ({}): {}", code.language.as_deref().unwrap_or("text"), code.content);
}
_ => {}
}
}
use oak_markdown::{MarkdownParser, ast::Block, extensions::Extensions};
let mut parser = MarkdownParser::new();
parser.enable_extensions(Extensions::all());
let markdown = r#"## Todo List
- [x] Complete the project
- [ ] Write documentation
- [ ] Add tests
- [x] Review code
### Strikethrough
This is ~~deleted~~ text and this is ==highlighted== text.
### Autolinks
Visit https://github.com for more information."#;
let document = parser.parse(markdown)?;
for block in &document.blocks {
match block {
Block::List(list) => {
println!("List with {} items:", list.items.len());
for item in &list.items {
if let Some(checked) = item.checked {
println!(" - [{}] {}",
if checked { "x" } else { " " },
item.text);
}
}
}
_ => {}
}
}
use oak_markdown::{MarkdownParser, extensions::Extension};
struct CustomEmojiExtension;
impl Extension for CustomEmojiExtension {
fn name(&self) -> &str { "custom_emoji" }
fn process_inline(&self, text: &str) -> Option<Vec<ast::Inline>> {
// Convert :smile: to emoji
if text.contains(":smile:") {
Some(vec![ast::Inline::Text("😊".to_string())])
} else {
None
}
}
}
let mut parser = MarkdownParser::new();
parser.add_extension(Box::new(CustomEmojiExtension));
let markdown = "Hello :smile: World!";
let document = parser.parse(markdown)?;
use oak_markdown::{MarkdownParser, ast::{Block, Document}};
let parser = MarkdownParser::new();
let markdown = "# Original Title\n\nOriginal content.";
let mut document = parser.parse(markdown)?;
// Add a new heading
document.blocks.push(Block::Heading(ast::Heading {
level: 2,
text: "Added Section".to_string(),
inlines: vec![ast::Inline::Text("Added Section".to_string())]
}));
// Serialize back to markdown
let new_markdown = document.to_markdown();
println!("Modified markdown:\n{}", new_markdown);
use oak_markdown::{MarkdownParser, html::HtmlRenderer};
let parser = MarkdownParser::new();
let markdown = r#"# Document Title
This is a paragraph with **bold** text.
- List item 1
- List item 2
[Link](https://example.com)"#;
let document = parser.parse(markdown)?;
let renderer = HtmlRenderer::new();
let html = renderer.render(&document)?;
println!("Generated HTML:\n{}", html);
The parser generates a comprehensive AST with the following main structures:
Oak of markdown integrates seamlessly with:
Check out the examples directory for comprehensive examples:
Contributions are welcome! Please feel free to submit issues or pull requests.
Pex Markdown Parser - Comprehensive Markdown parsing for Rust applications 🚀