From a83e64e81de66ff40cc8a6293f0b5650d431689c Mon Sep 17 00:00:00 2001 From: Martin Fischer Date: Sat, 19 Aug 2023 11:28:31 +0200 Subject: fix(docs): fix broken relative link in rustdoc --- src/lib.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src') diff --git a/src/lib.rs b/src/lib.rs index cbaf94d..c2a1019 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,6 +1,7 @@ #![warn(missing_docs)] // This is an HTML parser. HTML can be untrusted input from the internet. #![forbid(unsafe_code)] +#![doc = concat!("[the LICENSE file]: ", file_url!("LICENSE"))] #![doc = include_str!("../README.md")] pub mod attr; @@ -19,3 +20,16 @@ pub use utils::State as InternalState; pub use emitter::{Comment, DefaultEmitter, Doctype, Emitter, EndTag, StartTag, Token}; pub use error::Error; pub use tokenizer::{State, Tokenizer}; + +/// Relative links in the README.md don't work in rustdoc, so we have to override them. +macro_rules! file_url { + ($path:literal) => { + concat!( + env!("CARGO_PKG_REPOSITORY"), + "/tree/", + $path, + "?h=v", + env!("CARGO_PKG_VERSION") + ) + }; +} -- cgit v1.2.3