diff --git a/docs/book/post_build.py b/docs/book/post_build.py index 1abc3a2..fc9fc3a 100644 --- a/docs/book/post_build.py +++ b/docs/book/post_build.py @@ -14,6 +14,7 @@ def main(): for file in os.listdir(category_dir): if file.endswith(".md") and (len(sys.argv) == 1 or (sys.argv[1] in file)): build_and_copy_demo(category, file) + rewrite_links(category, file) def build_and_copy_demo(category, md_name): @@ -24,7 +25,8 @@ def build_and_copy_demo(category, md_name): code = p.wait() if code != 0: - sys.exit(code, f"failed to build example '{name}'") + sys.stderr.write(f"failed to build example '{name}'\n") + sys.exit(code) example_output_path = os.path.join(example_dir, "dist") target_path = os.path.join("book", category, name, "demo") @@ -61,5 +63,27 @@ def build_and_copy_demo(category, md_name): {body_split[1]}""") +def rewrite_links(category, md_name): + """Rewrite links in generated documentation to make them + compatible between rustdoc and the book. + """ + html_name = f"{md_name[:-3]}.html" + target_path = os.path.join("book", category, html_name) + + with open(target_path, "r") as f: + html = f.read() + + html = html.replace( + "fn@crate::", "", + ).replace( + "crate::", "", + ).replace( + "fn@", "", + ) + + with open(target_path, "w") as f: + f.write(html) + + if __name__ == '__main__': main() diff --git a/src/core/element_maybe_signal.rs b/src/core/element_maybe_signal.rs index 26c1216..6d25d41 100644 --- a/src/core/element_maybe_signal.rs +++ b/src/core/element_maybe_signal.rs @@ -11,7 +11,7 @@ use std::ops::Deref; /// * a `Signal` where `T` is the web_sys element, /// * a `Signal>` where `T` is the web_sys element, /// * a `NodeRef` -/// into a function. Used for example in [`use_event_listener`]. +/// into a function. Used for example in [`fn@crate::use_event_listener`]. pub enum ElementMaybeSignal where T: Into + Clone + 'static, diff --git a/src/core/elements_maybe_signal.rs b/src/core/elements_maybe_signal.rs index e1f7f7b..c8446d9 100644 --- a/src/core/elements_maybe_signal.rs +++ b/src/core/elements_maybe_signal.rs @@ -12,7 +12,7 @@ use std::ops::Deref; /// * a `Signal` where `T` is the web_sys element, /// * a `Signal>` where `T` is the web_sys element, /// * a `NodeRef` -/// into a function. Used for example in [`use_event_listener`]. +/// into a function. Used for example in [`fn@crate::use_event_listener`]. pub enum ElementsMaybeSignal where T: Into + Clone + 'static, diff --git a/src/storage/use_local_storage.rs b/src/storage/use_local_storage.rs index 41811e6..c542a17 100644 --- a/src/storage/use_local_storage.rs +++ b/src/storage/use_local_storage.rs @@ -2,14 +2,19 @@ use super::{use_storage_with_options, StorageType, UseStorageOptions}; use codee::{Decoder, Encoder}; use leptos::signal_prelude::*; +#[allow(rustdoc::bare_urls)] /// Reactive [LocalStorage](https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage). /// -/// LocalStorage stores data in the browser with no expiration time. Access is given to all pages from the same origin (e.g., all pages from "https://example.com" share the same origin). While data doesn't expire the user can view, modify and delete all data stored. Browsers allow 5MB of data to be stored. +/// LocalStorage stores data in the browser with no expiration time. Access is given to all pages +/// from the same origin (e.g., all pages from "https://example.com" share the same origin). +/// While data doesn't expire the user can view, modify and delete all data stored. +/// Browsers allow 5MB of data to be stored. /// -/// This is contrast to [`use_session_storage`] which clears data when the page session ends and is not shared. +/// This is contrast to [`fn@crate::storage::use_session_storage`] which clears data when the page session ends and is not shared. /// /// ## Usage -/// See [`use_storage`] for more details on how to use. +/// +/// See [`fn@crate::storage::use_storage`] for more details on how to use. pub fn use_local_storage( key: impl AsRef, ) -> (Signal, WriteSignal, impl Fn() + Clone) diff --git a/src/storage/use_session_storage.rs b/src/storage/use_session_storage.rs index b377edf..c7fff9d 100644 --- a/src/storage/use_session_storage.rs +++ b/src/storage/use_session_storage.rs @@ -6,10 +6,10 @@ use leptos::signal_prelude::*; /// /// SessionStorages stores data in the browser that is deleted when the page session ends. A page session ends when the browser closes the tab. Data is not shared between pages. While data doesn't expire the user can view, modify and delete all data stored. Browsers allow 5MB of data to be stored. /// -/// Use [`use_local_storage`] to store data that is shared amongst all pages with the same origin and persists between page sessions. +/// Use [`fn@crate::storage::use_local_storage`] to store data that is shared amongst all pages with the same origin and persists between page sessions. /// /// ## Usage -/// See [`use_storage`] for more details on how to use. +/// See [`fn@crate::storage::use_storage`] for more details on how to use. pub fn use_session_storage( key: impl AsRef, ) -> (Signal, WriteSignal, impl Fn() + Clone) diff --git a/src/storage/use_storage.rs b/src/storage/use_storage.rs index 73eaa35..4f9c2af 100644 --- a/src/storage/use_storage.rs +++ b/src/storage/use_storage.rs @@ -23,12 +23,12 @@ const INTERNAL_STORAGE_EVENT: &str = "leptos-use-storage"; /// /// Pass a [`StorageType`] to determine the kind of key-value browser storage to use. /// The specified key is where data is stored. All values are stored as UTF-16 strings which -/// is then encoded and decoded via the given [`Codec`]. This value is synced with other calls using -/// the same key on the smae page and across tabs for local storage. +/// is then encoded and decoded via the given `*Codec`. This value is synced with other calls using +/// the same key on the same page and across tabs for local storage. /// See [`UseStorageOptions`] to see how behavior can be further customised. /// /// Values are (en)decoded via the given codec. You can use any of the string codecs or a -/// binary codec wrapped in [`Base64`]. +/// binary codec wrapped in `Base64`. /// /// > Please check [the codec chapter](https://leptos-use.rs/codecs.html) to see what codecs are /// available and what feature flags they require. @@ -395,7 +395,7 @@ pub enum UseStorageError { ItemCodecError(CodecError), } -/// Options for use with [`use_local_storage_with_options`], [`use_session_storage_with_options`] and [`use_storage_with_options`]. +/// Options for use with [`fn@crate::storage::use_local_storage_with_options`], [`fn@crate::storage::use_session_storage_with_options`] and [`use_storage_with_options`]. #[derive(DefaultBuilder)] pub struct UseStorageOptions where diff --git a/src/use_breakpoints.rs b/src/use_breakpoints.rs index 548da84..c8b3ae6 100644 --- a/src/use_breakpoints.rs +++ b/src/use_breakpoints.rs @@ -37,6 +37,7 @@ use std::hash::Hash; /// ## Breakpoints /// /// There are many predefined breakpoints for major UI frameworks. The following are provided. +/// /// * [`breakpoints_tailwind`] /// * [`breakpoints_bootstrap_v5`] /// * [`breakpoints_material`] @@ -107,7 +108,7 @@ use std::hash::Hash; /// /// ## Server-Side Rendering /// -/// Since internally this uses [`use_media_query`], which returns always `false` on the server, +/// Since internally this uses [`fn@crate::use_media_query`], which returns always `false` on the server, /// the returned methods also will return `false`. pub fn use_breakpoints( breakpoints: HashMap, @@ -276,7 +277,7 @@ impl UseBreakpointsReturn { /// Breakpoint keys for Tailwind V2 /// -/// See [https://tailwindcss.com/docs/breakpoints] +/// See #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] pub enum BreakpointsTailwind { Sm, @@ -288,7 +289,7 @@ pub enum BreakpointsTailwind { /// Breakpoint definitions for Tailwind V2 /// -/// See [https://tailwindcss.com/docs/breakpoints] +/// See pub fn breakpoints_tailwind() -> HashMap { HashMap::from([ (BreakpointsTailwind::Sm, 640), @@ -301,7 +302,7 @@ pub fn breakpoints_tailwind() -> HashMap { /// Breakpoint keys for Bootstrap V5 /// -/// See [https://getbootstrap.com/docs/5.0/layout/breakpoints] +/// See #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] pub enum BreakpointsBootstrapV5 { Sm, @@ -313,7 +314,7 @@ pub enum BreakpointsBootstrapV5 { /// Breakpoint definitions for Bootstrap V5 /// -/// See [https://getbootstrap.com/docs/5.0/layout/breakpoints] +/// pub fn breakpoints_bootstrap_v5() -> HashMap { HashMap::from([ (BreakpointsBootstrapV5::Sm, 576), @@ -326,7 +327,7 @@ pub fn breakpoints_bootstrap_v5() -> HashMap { /// Breakpoint keys for Material UI V5 /// -/// See [https://mui.com/material-ui/customization/breakpoints/] +/// See #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] pub enum BreakpointsMaterial { Xs, @@ -338,7 +339,7 @@ pub enum BreakpointsMaterial { /// Breakpoint definitions for Material UI V5 /// -/// See [https://mui.com/material-ui/customization/breakpoints/] +/// See pub fn breakpoints_material() -> HashMap { HashMap::from([ (BreakpointsMaterial::Xs, 1), @@ -351,7 +352,7 @@ pub fn breakpoints_material() -> HashMap { /// Breakpoint keys for Ant Design /// -/// See [https://ant.design/components/layout/#breakpoint-width] +/// See #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] pub enum BreakpointsAntDesign { Xs, @@ -364,7 +365,7 @@ pub enum BreakpointsAntDesign { /// Breakpoint definitions for Ant Design /// -/// See [https://ant.design/components/layout/#breakpoint-width] +/// See pub fn breakpoints_ant_design() -> HashMap { HashMap::from([ (BreakpointsAntDesign::Xs, 480), @@ -378,7 +379,7 @@ pub fn breakpoints_ant_design() -> HashMap { /// Breakpoint keys for Quasar V2 /// -/// See [https://quasar.dev/style/breakpoints] +/// See #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] pub enum BreakpointsQuasar { Xs, @@ -390,7 +391,7 @@ pub enum BreakpointsQuasar { /// Breakpoint definitions for Quasar V2 /// -/// See [https://quasar.dev/style/breakpoints] +/// See pub fn breakpoints_quasar() -> HashMap { HashMap::from([ (BreakpointsQuasar::Xs, 1), @@ -401,32 +402,32 @@ pub fn breakpoints_quasar() -> HashMap { ]) } -/// Breakpoint keys for Sematic UI +/// Breakpoint keys for Semantic UI /// -/// See [https://semantic-ui.com/elements/container.html] +/// See #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] -pub enum BreakpointsSematic { +pub enum BreakpointsSemantic { Mobile, Tablet, SmallMonitor, LargeMonitor, } -/// Breakpoint definitions for Sematic UI +/// Breakpoint definitions for Semantic UI /// -/// See [https://semantic-ui.com/elements/container.html] -pub fn breakpoints_sematic() -> HashMap { +/// See +pub fn breakpoints_semantic() -> HashMap { HashMap::from([ - (BreakpointsSematic::Mobile, 1), - (BreakpointsSematic::Tablet, 768), - (BreakpointsSematic::SmallMonitor, 992), - (BreakpointsSematic::LargeMonitor, 1200), + (BreakpointsSemantic::Mobile, 1), + (BreakpointsSemantic::Tablet, 768), + (BreakpointsSemantic::SmallMonitor, 992), + (BreakpointsSemantic::LargeMonitor, 1200), ]) } /// Breakpoint keys for Master CSS /// -/// See [https://docs.master.co/css/breakpoints] +/// See #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] pub enum BreakpointsMasterCss { Xxxs, @@ -443,7 +444,7 @@ pub enum BreakpointsMasterCss { /// Breakpoint definitions for Master CSS /// -/// See [https://docs.master.co/css/breakpoints] +/// See pub fn breakpoints_master_css() -> HashMap { HashMap::from([ (BreakpointsMasterCss::Xxxs, 360), diff --git a/src/use_broadcast_channel.rs b/src/use_broadcast_channel.rs index fe9d823..37cc0c5 100644 --- a/src/use_broadcast_channel.rs +++ b/src/use_broadcast_channel.rs @@ -45,7 +45,7 @@ use wasm_bindgen::JsValue; /// ``` /// /// Values are (en)decoded via the given codec. You can use any of the string codecs or a -/// binary codec wrapped in [`Base64`]. +/// binary codec wrapped in `Base64`. /// /// > Please check [the codec chapter](https://leptos-use.rs/codecs.html) to see what codecs are /// available and what feature flags they require. diff --git a/src/use_color_mode.rs b/src/use_color_mode.rs index 5e0ba98..66cdd39 100644 --- a/src/use_color_mode.rs +++ b/src/use_color_mode.rs @@ -36,7 +36,7 @@ use wasm_bindgen::JsCast; /// # } /// ``` /// -/// By default, it will match with users' browser preference using [`use_preferred_dark`] (a.k.a. `ColorMode::Auto`). +/// By default, it will match with users' browser preference using [`fn@crate::use_preferred_dark`] (a.k.a. `ColorMode::Auto`). /// When reading the signal, it will by default return the current color mode (`ColorMode::Dark`, `ColorMode::Light` or /// your custom modes `ColorMode::Custom("some-custom")`). The `ColorMode::Auto` variant can /// be included in the returned modes by enabling the `emit_auto` option and using [`use_color_mode_with_options`]. @@ -87,7 +87,7 @@ use wasm_bindgen::JsCast; /// /// To persist color mode in a cookie, use `use_cookie_with_options` and specify `.cookie_enabled(true)`. /// -/// > Note: To work with SSR you have to add the `axum` or `actix` feature as described in [`use_cookie`]. +/// > Note: To work with SSR you have to add the `axum` or `actix` feature as described in [`fn@crate::use_cookie`]. /// /// ```rust /// # use leptos::*; @@ -116,13 +116,13 @@ use wasm_bindgen::JsCast; /// /// If `cookie_enabled` is set to `true`, cookies will be used and if present this value will be used /// on the server as well as on the client. Please note that you have to add the `axum` or `actix` -/// feature as described in [`use_cookie`]. +/// feature as described in [`fn@crate::use_cookie`]. /// /// ## See also /// -/// * [`use_preferred_dark`] -/// * [`use_storage`] -/// * [`use_cookie`] +/// * [`fn@crate::use_preferred_dark`] +/// * [`fn@crate::storage::use_storage`] +/// * [`fn@crate::use_cookie`] pub fn use_color_mode() -> UseColorModeReturn { use_color_mode_with_options(UseColorModeOptions::default()) } @@ -508,9 +508,9 @@ pub struct UseColorModeReturn { /// Main value setter signal of the color mode pub set_mode: WriteSignal, - /// Direct access to the returned signal of [`use_storage`] if enabled or [`UseColorModeOptions::storage_signal`] if provided + /// Direct access to the returned signal of [`fn@crate::storage::use_storage`] if enabled or [`UseColorModeOptions::storage_signal`] if provided pub store: Signal, - /// Direct write access to the returned signal of [`use_storage`] if enabled or [`UseColorModeOptions::storage_signal`] if provided + /// Direct write access to the returned signal of [`fn@crate::storage::use_storage`] if enabled or [`UseColorModeOptions::storage_signal`] if provided pub set_store: WriteSignal, /// Signal of the system's preferred color mode that you would get from a media query diff --git a/src/use_cookie.rs b/src/use_cookie.rs index 67336f8..4ac3811 100644 --- a/src/use_cookie.rs +++ b/src/use_cookie.rs @@ -57,7 +57,7 @@ use std::rc::Rc; /// ``` /// /// Values are (en)decoded via the given codec. You can use any of the string codecs or a -/// binary codec wrapped in [`Base64`]. +/// binary codec wrapped in `Base64`. /// /// > Please check [the codec chapter](https://leptos-use.rs/codecs.html) to see what codecs are /// available and what feature flags they require. @@ -136,10 +136,6 @@ use std::rc::Rc; /// # view! {} /// # } /// ``` -/// -/// ## Create Your Own Custom Codec -/// -/// All you need to do is to implement the [`StringCodec`] trait together with `Default` and `Clone`. pub fn use_cookie(cookie_name: &str) -> (Signal>, WriteSignal>) where C: Encoder + Decoder, diff --git a/src/use_element_size.rs b/src/use_element_size.rs index 8b178bc..648e6a5 100644 --- a/src/use_element_size.rs +++ b/src/use_element_size.rs @@ -45,7 +45,7 @@ cfg_if! { if #[cfg(not(feature = "ssr"))] { /// /// ## See also /// -/// - [`use_resize_observer`] +/// - [`fn@crate::use_resize_observer`] pub fn use_element_size(target: El) -> UseElementSizeReturn where El: Into> + Clone, diff --git a/src/use_element_visibility.rs b/src/use_element_visibility.rs index 23a9543..2199788 100644 --- a/src/use_element_visibility.rs +++ b/src/use_element_visibility.rs @@ -40,7 +40,7 @@ use crate::{use_intersection_observer_with_options, UseIntersectionObserverOptio /// /// ## See also /// -/// * [`use_intersection_observer`] +/// * [`fn@crate::use_intersection_observer`] pub fn use_element_visibility(target: El) -> Signal where El: Into>, diff --git a/src/use_event_source.rs b/src/use_event_source.rs index e158324..c3fd25d 100644 --- a/src/use_event_source.rs +++ b/src/use_event_source.rs @@ -19,7 +19,7 @@ use thiserror::Error; /// ## Usage /// /// Values are decoded via the given decoder. You can use any of the string codecs or a -/// binary codec wrapped in [`Base64`]. +/// binary codec wrapped in `Base64`. /// /// > Please check [the codec chapter](https://leptos-use.rs/codecs.html) to see what codecs are /// available and what feature flags they require. @@ -47,10 +47,6 @@ use thiserror::Error; /// # } /// ``` /// -/// ### Create Your Own Custom Codec -/// -/// All you need to do is to implement the [`StringCodec`] trait together with `Default` and `Clone`. -/// /// ### Named Events /// /// You can define named events when using `use_event_source_with_options`. diff --git a/src/use_intersection_observer.rs b/src/use_intersection_observer.rs index 6cc3849..cca3343 100644 --- a/src/use_intersection_observer.rs +++ b/src/use_intersection_observer.rs @@ -52,7 +52,7 @@ cfg_if! { if #[cfg(not(feature = "ssr"))] { /// /// ## See also /// -/// * [`use_element_visibility`] +/// * [`fn@crate::use_element_visibility`] pub fn use_intersection_observer( target: El, callback: F, diff --git a/src/use_intl_number_format.rs b/src/use_intl_number_format.rs index d7ad291..694ba76 100644 --- a/src/use_intl_number_format.rs +++ b/src/use_intl_number_format.rs @@ -484,7 +484,7 @@ pub struct UseIntlNumberFormatOptions { /// The currency to use in currency formatting. /// Possible values are the ISO 4217 currency codes, such as "USD" for the US dollar, "EUR" for the euro, - /// or "CNY" for the Chinese RMB — see the [Current currency & funds code list](https://www.six-group.com/en/products-services/financial-information/data-standards.html#scrollTo=currency-codes. + /// or "CNY" for the Chinese RMB — see the [Current currency & funds code list](https://www.six-group.com/en/products-services/financial-information/data-standards.html#scrollTo=currency-codes). /// There is no default value; if the style is `Currency`, the currency property must be provided. #[builder(into)] currency: Option, diff --git a/src/use_media_query.rs b/src/use_media_query.rs index b9c5be8..61e423c 100644 --- a/src/use_media_query.rs +++ b/src/use_media_query.rs @@ -36,8 +36,8 @@ use std::rc::Rc; /// /// ## See also /// -/// * [`use_preferred_dark`] -/// * [`use_preferred_contrast`] +/// * [`fn@crate::use_preferred_dark`] +/// * [`fn@crate::use_preferred_contrast`] pub fn use_media_query(query: impl Into>) -> Signal { let query = query.into(); diff --git a/src/use_preferred_contrast.rs b/src/use_preferred_contrast.rs index 86c3ebe..85fc679 100644 --- a/src/use_preferred_contrast.rs +++ b/src/use_preferred_contrast.rs @@ -25,8 +25,8 @@ use std::fmt::Display; /// /// ## See also /// -/// * [`use_media_query`] -/// * [`use_preferred_dark`] +/// * [`fn@crate::use_media_query`] +/// * [`fn@crate::use_preferred_dark`] pub fn use_preferred_contrast() -> Signal { let is_more = use_media_query("(prefers-contrast: more)"); let is_less = use_media_query("(prefers-contrast: less)"); diff --git a/src/use_preferred_dark.rs b/src/use_preferred_dark.rs index 0f44831..18d8043 100644 --- a/src/use_preferred_dark.rs +++ b/src/use_preferred_dark.rs @@ -24,8 +24,8 @@ use leptos::*; /// /// ## See also /// -/// * [`use_media_query`] -/// * [`use_preferred_contrast`] +/// * [`fn@crate::use_media_query`] +/// * [`fn@crate::use_preferred_contrast`] pub fn use_preferred_dark() -> Signal { use_media_query("(prefers-color-scheme: dark)") } diff --git a/src/use_raf_fn.rs b/src/use_raf_fn.rs index d390cd1..eb61261 100644 --- a/src/use_raf_fn.rs +++ b/src/use_raf_fn.rs @@ -165,6 +165,6 @@ pub struct UseRafFnCallbackArgs { /// Time elapsed between this and the last frame. pub delta: f64, - /// Time elapsed since the creation of the web page. See [MDN Docs](https://developer.mozilla.org/en-US/docs/Web/API/DOMHighResTimeStamp#the_time_origin Time origin). + /// Time elapsed since the creation of the web page. See [MDN Docs](https://developer.mozilla.org/en-US/docs/Web/API/DOMHighResTimeStamp#the_time_origin) Time origin. pub timestamp: f64, } diff --git a/src/use_resize_observer.rs b/src/use_resize_observer.rs index 11aafe7..3a631ca 100644 --- a/src/use_resize_observer.rs +++ b/src/use_resize_observer.rs @@ -50,7 +50,7 @@ cfg_if! { if #[cfg(not(feature = "ssr"))] { /// /// ## See also /// -/// - [`use_element_size`] +/// * [`fn@crate::use_element_size`] pub fn use_resize_observer( target: El, // TODO : multiple elements? callback: F, diff --git a/src/use_timestamp.rs b/src/use_timestamp.rs index d09ec01..9cbcdae 100644 --- a/src/use_timestamp.rs +++ b/src/use_timestamp.rs @@ -155,10 +155,10 @@ pub struct UseTimestampOptions { /// Interval type for [`UseTimestampOptions`]. #[derive(Copy, Clone, Eq, PartialEq, Debug)] pub enum TimestampInterval { - /// use [`use_raf_fn`] for updating the timestamp + /// use [`fn@crate::use_raf_fn`] for updating the timestamp RequestAnimationFrame, - /// use [`use_interval_fn`] for updating the timestamp + /// use [`fn@crate::use_interval_fn`] for updating the timestamp Interval(u64), } diff --git a/src/use_websocket.rs b/src/use_websocket.rs index d7c41e4..8654832 100644 --- a/src/use_websocket.rs +++ b/src/use_websocket.rs @@ -16,6 +16,7 @@ use js_sys::Array; use wasm_bindgen::prelude::*; use web_sys::{BinaryType, CloseEvent, Event, MessageEvent, WebSocket}; +#[allow(rustdoc::bare_urls)] /// Creating and managing a [Websocket](https://developer.mozilla.org/en-US/docs/Web/API/WebSocket) connection. /// /// ## Demo diff --git a/src/use_window.rs b/src/use_window.rs index b0185f8..542b1f9 100644 --- a/src/use_window.rs +++ b/src/use_window.rs @@ -54,7 +54,7 @@ impl UseWindow { navigator(&self) -> Option ); - /// Returns the same as [`use_document`]. + /// Returns the same as [`fn@use_document`]. #[inline(always)] pub fn document(&self) -> UseDocument { use_document() diff --git a/src/utils/use_derive_signal.rs b/src/utils/use_derive_signal.rs index 1e7e9c2..6e7f7fc 100644 --- a/src/utils/use_derive_signal.rs +++ b/src/utils/use_derive_signal.rs @@ -1,6 +1,6 @@ /// Macro to easily create helper functions that derive a signal using a piece of code. /// -/// See [`is_ok`] or [`use_to_string`] as examples. +/// See [`fn@crate::is_ok`] or [`fn@crate::use_to_string`] as examples. #[macro_export] macro_rules! use_derive_signal { ( diff --git a/src/watch_debounced.rs b/src/watch_debounced.rs index b52d2eb..2dbe3ef 100644 --- a/src/watch_debounced.rs +++ b/src/watch_debounced.rs @@ -34,7 +34,7 @@ use leptos::*; /// /// Please note that if the current component is cleaned up before the debounced callback is called, the debounced callback will not be called. /// -/// There's also `watch_debounced_with_options` where you can specify the other watch options (except `filter`). +/// There's also [`watch_debounced_with_options`] where you can specify the other watch options (except `filter`). /// /// ``` /// # use leptos::*; @@ -70,8 +70,8 @@ use leptos::*; /// /// ## See also /// -/// * [`watch`] -/// * [`watch_throttled`] +/// * `leptos::watch` +/// * [`fn@crate::watch_throttled`] pub fn watch_debounced(deps: DFn, callback: CFn, ms: f64) -> impl Fn() + Clone where DFn: Fn() -> W + 'static, @@ -82,7 +82,8 @@ where watch_with_options(deps, callback, WatchOptions::default().debounce(ms)) } -/// Version of `watch_debounced` that accepts `WatchDebouncedOptions`. See [`watch_debounced`] for how to use. +/// Version of `watch_debounced` that accepts `WatchDebouncedOptions`. +/// See [`watch_debounced`] for how to use. pub fn watch_debounced_with_options( deps: DFn, callback: CFn, diff --git a/src/watch_pausable.rs b/src/watch_pausable.rs index 62099e7..1d7d924 100644 --- a/src/watch_pausable.rs +++ b/src/watch_pausable.rs @@ -52,7 +52,7 @@ use leptos::*; /// /// ## See also /// -/// * [`watch`] +/// * `leptos::watch` pub fn watch_pausable( deps: DFn, callback: CFn, diff --git a/src/watch_throttled.rs b/src/watch_throttled.rs index 00497a3..5fd585f 100644 --- a/src/watch_throttled.rs +++ b/src/watch_throttled.rs @@ -1,7 +1,7 @@ use crate::{watch_with_options, ThrottleOptions, WatchOptions}; use default_struct_builder::DefaultBuilder; -/// A throttled version of [`watch`]. +/// A throttled version of `leptos::watch`. /// /// ## Demo /// @@ -69,8 +69,8 @@ use default_struct_builder::DefaultBuilder; /// /// ## See also /// -/// * [`watch`] -/// * [`watch_debounced`] +/// * `leptos::watch` +/// * [`fn@crate::watch_debounced`] pub fn watch_throttled(deps: DFn, callback: CFn, ms: f64) -> impl Fn() + Clone where DFn: Fn() -> W + 'static, @@ -81,7 +81,7 @@ where watch_with_options(deps, callback, WatchOptions::default().throttle(ms)) } -/// Version of `watch_throttled` that accepts `WatchThrottledOptions`. See [`watch_throttled`] for how to use. +/// Version of [`fn@watch_throttled`] that accepts `WatchThrottledOptions`. See [`watch_throttled`] for how to use. pub fn watch_throttled_with_options( deps: DFn, callback: CFn, diff --git a/src/watch_with_options.rs b/src/watch_with_options.rs index b01c255..85747fd 100644 --- a/src/watch_with_options.rs +++ b/src/watch_with_options.rs @@ -38,7 +38,8 @@ use std::rc::Rc; /// /// ## Filters /// -/// The callback can be throttled or debounced. Please see [`watch_throttled`] and [`watch_debounced`] for details. +/// The callback can be throttled or debounced. Please see [`fn@crate::watch_throttled`] +/// and [`fn@crate::watch_debounced`] for details. /// /// ``` /// # use leptos::*; @@ -86,8 +87,8 @@ use std::rc::Rc; /// /// ## See also /// -/// * [`watch_throttled`] -/// * [`watch_debounced`] +/// * [`fn@crate::watch_throttled`] +/// * [`fn@crate::watch_debounced`] /// Version of `watch` that accepts `WatchOptions`. See [`watch`] for how to use. pub fn watch_with_options( diff --git a/src/whenever.rs b/src/whenever.rs index b8f4c3c..260e944 100644 --- a/src/whenever.rs +++ b/src/whenever.rs @@ -20,7 +20,7 @@ use crate::{watch_with_options, WatchOptions}; /// /// ### Callback Function /// -/// Same as [`watch`], the callback will be called with `callback(input, prev_input, prev_return)`. +/// Same as [`fn@crate::watch`], the callback will be called with `callback(input, prev_input, prev_return)`. /// /// ``` /// # use leptos::*; @@ -39,7 +39,7 @@ use crate::{watch_with_options, WatchOptions}; /// /// ### Computed /// -/// Same as [`watch`], you can pass a getter function to calculate on each change. +/// Same as [`fn@crate::watch`], you can pass a getter function to calculate on each change. /// /// ``` /// # use leptos::*; @@ -59,7 +59,7 @@ use crate::{watch_with_options, WatchOptions}; /// /// ### Options /// -/// Options and defaults are same as [`watch_with_options`]. +/// Options and defaults are same as [`fn@watch_with_options`]. /// /// ``` /// # use leptos::*;