Code Monkey home page Code Monkey logo

Comments (4)

zoni avatar zoni commented on June 5, 2024 1

It's currently pretty hard-coded:

obsidian-export/src/lib.rs

Lines 674 to 688 in 6af4c91

let target_file = target_file.unwrap();
// We use root_file() rather than current_file() here to make sure links are always
// relative to the outer-most note, which is the note which this content is inserted into
// in case of embedded notes.
let rel_link = diff_paths(
target_file,
&context
.root_file()
.parent()
.expect("obsidian content files should always have a parent"),
)
.expect("should be able to build relative path when target file is found in vault");
let rel_link = rel_link.to_string_lossy();
let mut link = utf8_percent_encode(&rel_link, PERCENTENCODE_CHARS).to_string();

I'm not against making this more configurable/overrideable, but it would be nice to know what you're trying to achieve and why you would want a different behavior.

The intent of obsidian-export is to give you a normalized CommonMark input to feed to later processors (such as static site generators like Zola). It's obsidian-export's job to make sure that input has valid links/paths on the local filesystem that those tools can resolve correctly (which it currently does).

It's not intended to construct final URLs directly, as that's really the job of Hugo, Zola, etc. to do (because it's also their concern to change .md to .html, or to link to a directory instead of a file in case of "pretty URLs")

from obsidian-export.

benbohmer avatar benbohmer commented on June 5, 2024

This would be useful for many use cases, not only Zola!

from obsidian-export.

zoni avatar zoni commented on June 5, 2024

Related issue: #73

from obsidian-export.

smaroukis avatar smaroukis commented on June 5, 2024

I also had an issue where I wanted to leave the spaces encoded as literal spaces, for a responsive image partial for a hugo site, which uses the image in markdown as

{{< imgh src="filename with spaces.png" alt="alt-text" >}}

(since the image filename itself is not renamed to be percent encoded by obsidian-export the partial does not find the asset)

Of course the partial could be changed to first percent encode the resource, but I'm just getting started with hugo...

Partial I'm using: https://mijndertstuij.nl/posts/hugo-responsive-images/

from obsidian-export.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.