Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add follow_symlinks config option. #72

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ pub struct Config {
pub follow_web_links: bool,
/// Are we allowed to link to files outside of the book's source directory?
pub traverse_parent_directories: bool,

/// Should treat symlinks as terminal points?
pub follow_symlinks: bool,

/// A list of URL patterns to ignore when checking remote links.
#[serde(default)]
pub exclude: Vec<HashedRegex>,
Expand Down Expand Up @@ -124,6 +128,7 @@ impl Default for Config {
Config {
follow_web_links: false,
traverse_parent_directories: false,
follow_symlinks: true,
exclude: Vec::new(),
user_agent: default_user_agent(),
http_headers: HashMap::new(),
Expand Down Expand Up @@ -296,6 +301,7 @@ https = ["accept: html/text", "authorization: Basic $TOKEN"]
follow_web_links: true,
warning_policy: WarningPolicy::Error,
traverse_parent_directories: true,
follow_symlinks: true,
exclude: vec![HashedRegex::new(r"google\.com").unwrap()],
user_agent: String::from("Internet Explorer"),
http_headers: HashMap::from_iter(vec![(
Expand Down
1 change: 1 addition & 0 deletions src/validate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ fn lc_validate(
.set_links_may_traverse_the_root_directory(
cfg.traverse_parent_directories,
)
.set_follow_symlinks(cfg.follow_symlinks)
// take into account the `index` preprocessor which rewrites `README.md`
// to `index.md` (which tne gets rendered as `index.html`)
.set_default_file("README.md")
Expand Down