markvincze / sabledocs

Simple static documentation generator for Protobuf and gRPC contracts.
MIT License
45 stars 12 forks source link

Linking to images #51

Closed robin-moss closed 4 months ago

robin-moss commented 6 months ago

Hello,

I've tried to add image linking into the generated site, using markdown ![](path/to/image) works, but the same doc string can be shown on several different paths. For my use case, I cannot just use /path/from/root as the site is not hosted at the root URL.

I'm not sure of the best way to resolve this, but I would appreciate any suggestions/improvements for doing this.

Thanks

robin-moss commented 6 months ago

I've just realised all the files are at the same level so a ../ would do it :facepalm:

markvincze commented 4 months ago

Hi @robin-moss,

Do I understand correctly that you manually copied the image files into the folder of the generated documentation? I'm thinking about implementing better support for this scenario, let's say do what Hugo does (https://gohugo.io/content-management/static-files/), and have the convention that if you have a folder called static in the same folder where you have sabledocs.toml, then all the files inside that folder would get copied to the root of the generated output, so that could be used for including content like image files in the generated docs. Would that be useful for your use-case?

robin-moss commented 4 months ago

Do I understand correctly that you manually copied the image files into the folder of the generated documentation?

Yip, that's what I ended up doing, then using a relative path:

<img src="imgs/subfolder/my_img.png" width="800px" />

I'm pretty sure the markdown style worked as well but I wanted to limit the width :)

Would that be useful for your use-case?

Yes, that would work for me

markvincze commented 4 months ago

@robin-moss thanks for the quick reply! I'll add it to the todo list to have support for including arbitrary extra static content in the generated output, that should make this easier (and then either using the Markdown image markup, or the <img ... /> approach will still keep working the same way).

markvincze commented 4 months ago

@robin-moss I implemented support for including extra static content in the generated output, it's described in the readme: https://github.com/markvincze/sabledocs/?tab=readme-ov-file#static-content

robin-moss commented 4 months ago

Thank you :)