Skip to content

Load additional (external) resources #940

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

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

sytsereitsma
Copy link

Allow users to insert additional resources from other directories

Adding one or more sections like this to book.toml:

[[output.html.additional-resources]]
output-dir="img"
src="../uml/*.png"

Will copy the files to the book output directory.

Adding one or more sections like this to book.toml:

```toml
[[output.html.additional-resources]]
output-dir="img"
src="../uml/*.png"
```

Will copy the files to the book output directory.
@Dylan-DPC-zz
Copy link

Dylan-DPC-zz commented May 31, 2019

Thanks
you need to make the following rustfmt changes:

Diff in /home/travis/build/rust-lang-nursery/mdBook/src/config.rs at line 388:
     }
 }
 
-
 /// Additional files not normaly copied (like external images etc), which
 /// you want to add to the book output.
 /// In book.toml:
Diff in /home/travis/build/rust-lang-nursery/mdBook/src/config.rs at line 422:
     }
 }
 
-
 /// Configuration for the build procedure.
 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
 #[serde(default, rename_all = "kebab-case")]
Diff in /home/travis/build/rust-lang-nursery/mdBook/src/config.rs at line 487:
     pub git_repository_icon: Option<String>,
 
     /// The additional resources to copy
-    pub additional_resources: Option<Vec<AdditionalResource>>
+    pub additional_resources: Option<Vec<AdditionalResource>>,
 }
 
 impl HtmlConfig {
Diff in /home/travis/build/rust-lang-nursery/mdBook/src/config.rs at line 670:
             git_repository_url: Some(String::from("https://foo.com/")),
             git_repository_icon: Some(String::from("fa-code-fork")),
             additional_resources: Some(vec![
-                    AdditionalResource {
-                        src: String::from("foo*.*"),
-                        output_dir: PathBuf::from("bar"),
-                    },
-                    AdditionalResource {
-                        src: String::from("chuck*.*"),
-                        output_dir: PathBuf::from("norris"),
-                    }                
-                ]),
+                AdditionalResource {
+                    src: String::from("foo*.*"),
+                    output_dir: PathBuf::from("bar"),
+                },
+                AdditionalResource {
+                    src: String::from("chuck*.*"),
+                    output_dir: PathBuf::from("norris"),
+                },
+            ]),
             ..Default::default()
         };

@sytsereitsma
Copy link
Author

@Dylan-DPC I already made these changes yesterday, or am I missing something?

Regards,

Sytse

@ehuss
Copy link
Contributor

ehuss commented May 31, 2019

I think this would also need documentation in config.md.

@sytsereitsma
Copy link
Author

@ehuss I was wondering where the documentation was generated from, now I know.

Documentation added.

@rustbot
Copy link
Collaborator

rustbot commented Apr 30, 2025

☔ The latest upstream changes (possibly #2681) made this pull request unmergeable. Please resolve the merge conflicts.

@rustbot rustbot added the S-waiting-on-author Status: The marked PR is awaiting some action (such as code changes) from the PR author. label Apr 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author Status: The marked PR is awaiting some action (such as code changes) from the PR author.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants