rushdown-link-attribute 0.9.1

Attributes for links and images for rushdown markdown parser
Documentation
  • Coverage
  • 100%
    2 out of 2 items documented1 out of 2 items with examples
  • Size
  • Source code size: 14.13 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.21 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 55s Average build duration of successful builds.
  • all releases: 50s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • yuin/rushdown-link-attribute
    1 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • yuin

rushdown-link-attribute

rushdown-link-attribute is an extension for the rushdown that allows you to add attributes to links and images in markdown.

Installation

Add dependency to your Cargo.toml:

[dependencies]
rushdown-link-attribute = "x.y.z"

rushdown-link-attribute can also be used in no_std environments. To enable this feature, add the following line to your Cargo.toml:

rushdown-link-attribute = { version = "x.y.z", default-features = false, features = ["no-std"] }

Syntax

[aaa](https://example.com/aaa){.myclass}

You can add attributes to links and images by using curly braces {} after the link or image. Inside the curly braces, you can specify classes, ids, and other attributes.

Attribute syntax is same as the one used in rushdown.

Usage

Example

use core::fmt::Write;
use rushdown::{
    new_markdown_to_html,
    parser::{self, ParserExtension},
    renderer::html::{self, RendererExtension},
    Result,
};
use rushdown_link_attribute::link_attribute_parser_extension;

let markdown_to_html = new_markdown_to_html(
    parser::Options::default(),
    html::Options::default(),
    link_attribute_parser_extension(),
    html::NO_EXTENSIONS,
);
let mut output = String::new();
let input = r#"
[aaa](https://example.com/aaa){.myclass}
"#;
match markdown_to_html(&mut output, input) {
    Ok(_) => {
        println!("HTML output:\n{}", output);
    }
    Err(e) => {
        println!("Error: {:?}", e);
    }
}

Donation

BTC: 1NEDSyUmo4SMTDP83JJQSWi1MvQUGGNMZB

Github sponsors also welcome.

License

MIT

Author

Yusuke Inuzuka