Skip to content

Commit

Permalink
Improved documentation of markdown's fragment extractor.
Browse files Browse the repository at this point in the history
  • Loading branch information
HU90m committed Aug 22, 2023
1 parent 6e9784a commit 8c57e9c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lychee-lib/src/extract/markdown.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,13 @@ pub(crate) fn extract_markdown(input: &str, include_verbatim: bool) -> Vec<RawUr
.collect()
}

/// Extract unparsed URL strings from a Markdown string.
/// Extract fragments/anchors/fragments from a Markdown string.
///
/// Fragments are generated from headings using the same unique kebab case method as GitHub.
/// If a [heading attribute](https://github.com/raphlinus/pulldown-cmark/blob/master/specs/heading_attrs.txt)
/// is present,
/// this will be added to the fragment set **alongside** the other generated fragment.
/// It means a single heading such as `## Frag 1 {#frag-2}` would generate two fragments.
pub(crate) fn extract_markdown_fragments(input: &str) -> HashSet<String> {
let mut in_heading = false;
let mut heading = String::new();
Expand Down

0 comments on commit 8c57e9c

Please sign in to comment.