-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
fix: readerer get theme dir path bug #1405
Conversation
Thanks for the PR! Can you explain more about what the problem is? This seems to change the meaning of the |
Assuming the root path is let theme_dir = match html_config.theme {
Some(ref theme) => theme.to_path_buf(),
None => ctx.root.join("theme"),
};
let theme = theme::Theme::new(theme_dir); pub fn new<P: AsRef<Path>>(theme_dir: P) -> Self {
let theme_dir = theme_dir.as_ref();
let mut theme = Theme::default();
println!("final theme dir => {}",&theme_dir.display());
// If the theme directory doesn't exist there's no point continuing...
if !theme_dir.exists() || !theme_dir.is_dir() {
return theme;
}
...
} If the theme directory is configured.
Beacuse of So I think here need to join root path,and the theme must be under |
If you have a custom theme, it should be in a directory next to the |
If so, Here, // If the theme directory doesn't exist there's no point continuing...
if !theme_dir.exists() || !theme_dir.is_dir() {
return theme;
} |
Can you explain in more detail what is not working for you? The following commands should create a book with a custom theme: mdbook init foo
cd foo
cat << EOF >> book.toml
[output.html]
theme = "my-theme"
EOF
mkdir my-theme
echo "<html><body>{{{ content }}}</body></html>" > my-theme/index.hbs
mdbook build --open |
Are you maybe running In that case, it does seem to not work correctly. I think it would be reasonable to fix that, but this PR would need to change to remove the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, looks like there were some issues with a git merge, so I squashed the commits. Generally using a separate branch, and rebasing will avoid those kinds of issues.
@ehuss Thanks . |
Fix #1404
Now, it works on my build in local.