I'd like to convert markdown file name to hugo ugly url in command line

Hi,

For example, in title of markdown 1.md, there’s a link ./title of markdown 2.md. When publishing 2 markdown files, I’m converting the link to hugo shortcode relref like {{< relref "title of markdown 2.md" >}} which works fine.

As I want to use markdown file for hugo and pdf converting, I don’t use relref shortcode in markdown file. The thing is when converting the markdown with a link like ./another markdown.md to pdf, I also need to convert it again.

So, I tried to convert file name of markdown to hugo style ugly url like this-is-url.html but ended up realizing it’s not straightforward. Some title with + is converted without + and some title + is converted with +, so I’m not too sure what kind of rule is used.

In short,

  • Is there any way for me to use go source code to use relref function in command line?
  • Can I get conversion rule so that I can implement it using sed, tr and any other tool?

Thanks