parent
9c0dd95bdb
commit
d9dbf4d567
|
@ -14,6 +14,7 @@ to the public directory
|
||||||
want to link directly to it
|
want to link directly to it
|
||||||
- Fix many shortcode parsing issues
|
- Fix many shortcode parsing issues
|
||||||
- Correctly copy themes shortcodes so they are useable in content
|
- Correctly copy themes shortcodes so they are useable in content
|
||||||
|
- Fix internal links not working for markdown files directly in `content` directory
|
||||||
|
|
||||||
## 0.3.2 (2018-03-05)
|
## 0.3.2 (2018-03-05)
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,11 @@ impl FileInfo {
|
||||||
let mut parent = file_path.parent().unwrap().to_path_buf();
|
let mut parent = file_path.parent().unwrap().to_path_buf();
|
||||||
let name = path.file_stem().unwrap().to_string_lossy().to_string();
|
let name = path.file_stem().unwrap().to_string_lossy().to_string();
|
||||||
let mut components = find_content_components(&file_path);
|
let mut components = find_content_components(&file_path);
|
||||||
let relative = format!("{}/{}.md", components.join("/"), name);
|
let relative = if !components.is_empty() {
|
||||||
|
format!("{}/{}.md", components.join("/"), name)
|
||||||
|
} else {
|
||||||
|
format!("{}.md", name)
|
||||||
|
};
|
||||||
|
|
||||||
// If we have a folder with an asset, don't consider it as a component
|
// If we have a folder with an asset, don't consider it as a component
|
||||||
if !components.is_empty() && name == "index" {
|
if !components.is_empty() && name == "index" {
|
||||||
|
|
|
@ -46,6 +46,14 @@ mod tests {
|
||||||
assert_eq!(res, "https://vincent.is/about");
|
assert_eq!(res, "https://vincent.is/about");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn can_resolve_valid_root_internal_link() {
|
||||||
|
let mut permalinks = HashMap::new();
|
||||||
|
permalinks.insert("about.md".to_string(), "https://vincent.is/about".to_string());
|
||||||
|
let res = resolve_internal_link("./about.md", &permalinks).unwrap();
|
||||||
|
assert_eq!(res, "https://vincent.is/about");
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn can_resolve_internal_links_with_anchors() {
|
fn can_resolve_internal_links_with_anchors() {
|
||||||
let mut permalinks = HashMap::new();
|
let mut permalinks = HashMap::new();
|
||||||
|
|
|
@ -6,3 +6,5 @@ date = 2016-03-01
|
||||||
|
|
||||||
|
|
||||||
{{ theme_shortcode() }}
|
{{ theme_shortcode() }}
|
||||||
|
|
||||||
|
Link to [root](./hello.md).
|
||||||
|
|
Loading…
Reference in a new issue