Skip to content
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
32 changes: 31 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ clap = "2.33.3"
atom_syndication = "0.11.0"
chrono = "0.4.19"
url = { version = "2.2.2", features = ["serde"] }
walkdir = "2.3.2"

[features]
fail-on-warnings = []
6 changes: 5 additions & 1 deletion src/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ pub fn build_site(config: Config) -> Result<()> {
);

// collect all posts
let posts = post_parser.parse_posts(&config.posts_source_directory)?;
let (posts, static_files) =
post_parser.parse_posts(&config.posts_source_directory)?;

// Parse the template files.
let index_template = parse_template(config.index_template.iter())?;
Expand Down Expand Up @@ -56,6 +57,9 @@ pub fn build_site(config: Config) -> Result<()> {
};
writer.write_posts(&posts)?;

// write the static files
writer.write_static_files(&static_files)?;

// copy static directory
copy_dir(
&config.static_source_directory,
Expand Down
23 changes: 23 additions & 0 deletions src/markdown.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,29 @@ impl<'a> EventConverter<'a> {
// intercepting heading tags and returning the tag size + 2.
Tag::Heading(s) => Tag::Heading(s + 2),

// Internal image links (links from blog posts, pages, and assets
// *to* posts, pages, and assets) need to be converted from their
// input formats to their output formats (e.g., a post linking to
// another post as `foo.md` will need to be converted to an
// equivalent link ending in `foo.html`).
Tag::Image(
link @ (LinkType::Inline
| LinkType::Reference
| LinkType::ReferenceUnknown
| LinkType::Shortcut
| LinkType::Autolink
| LinkType::Collapsed
| LinkType::CollapsedUnknown),
url,
title,
) => Tag::Image(
link,
CowStr::Boxed(
self.link_converter.convert(&url)?.into_boxed_str(),
),
title,
),

// Internal links (links from blog posts, pages, and assets *to*
// posts, pages, and assets) need to be converted from their input
// formats to their output formats (e.g., a post linking to another
Expand Down
Loading