NAME

WWW::Crawl4AI::Markdown - markdown field resolution across Crawl4AI response shapes

VERSION

version 0.001

SYNOPSIS

use WWW::Crawl4AI::Markdown qw( resolve_markdown_chain );

my $md = { fit_markdown => '', raw_markdown => 'content', ... };
my $text = resolve_markdown_chain($md);  # returns 'content'

DESCRIPTION

Resolves the markdown field from Crawl4AI's structured response object. Crawl4AI returns markdown as a hash { fit_markdown, raw_markdown, markdown_with_citations, markdown } — the chain prefers filtered (fit) but skips empty candidates.

Shared by "_extract_markdown" in WWW::Crawl4AI::Client and "_flatten_markdown" in WWW::Crawl4AI::Strategy::Callback.

resolve_markdown_chain

my $text = resolve_markdown_chain($md);

Given a markdown hashref (or plain string), returns the first non-empty value from this candidate chain: fit_markdown, raw_markdown, markdown_with_citations, markdown. Returns undef if none are defined or non-empty, or the original string if a plain scalar was passed.

SUPPORT

Issues

Please report bugs and feature requests on GitHub at https://github.com/Getty/p5-www-crawl4ai/issues.

CONTRIBUTING

Contributions are welcome! Please fork the repository and submit a pull request.

AUTHOR

Torsten Raudssus <torsten@raudssus.de> https://raudss.us/

COPYRIGHT AND LICENSE

This software is copyright (c) 2026 by Torsten Raudssus.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.