SDNURoboticsAILab / SDNURoboticsAILab.github.io

The websites of Robotics AI Lab
https://sdnuroboticsailab.github.io/
MIT License
2 stars 12 forks source link

关于插入MkDocs 中timeline插件的问题 #32

Closed Sothebylin closed 3 months ago

Sothebylin commented 3 months ago

我想在成员风采添加时间轴但遇到问题 timeline插件地址:https://www.neoteroi.dev/mkdocs-plugins/ 从官方知道插入timeline插件的步骤为: 1)pip install neoteroi-mkdocs 2)获取额外的css文件 3)编辑mkdocs.yml文件以包含来自 Neoteroi mkdocs-plugins 的额外 CSS 文件和neoteroi.timeline扩展名 4)提供了四个timeline实例

我已经完成了前三步,将额外的CSS文件放入css文件夹,使其与mkdocs.yml在同一目录下,但是由于成员风采页面是Markdown语法,而官方并未提供如何在md文件实现timeline,通过查阅我计划使用Mkdocs-Macros这个插件将json文件在markdown渲染(官网:https://mkdocs-macros-plugin.readthedocs.io/en/latest/#getting-started ) 可是使用时出现如下错误,无法解决希望得到帮助

image

EvanWonghere commented 3 months ago

官方说了如何在 md 文件中使用,见 https://www.neoteroi.dev/mkdocs-plugins/timeline/#__tabbed_1_3,或者如果你查看官方网站的仓库,查看 timeline 该页面的文档:https://github.com/Neoteroi/mkdocs-plugins-docs/blob/main/docs/timeline.md,会发现正是此用法

Math-Still commented 3 months ago

额外的CSS应该放在和mkdocs渲染文件夹中,也就是docs/(docs_dir)中,更改位置就可以了

Sothebylin commented 3 months ago

okkkkkkkk,我已经成功实现样例时间轴的复现,但是,我无法将图片放入时间轴。官方提供的图标(icon)可以存放图像链接,但内容(content)无法显示图片,我仿照图标方式希望在内容里插入图片(使用相对路径)失败,同时图像的url链接也失败。认为需要修改其CSS文件添加图像属性,但是有点无从下手 image image image image image

Math-Still commented 3 months ago

content属性是str,接受的输入为str类型,输入的不会自动转换为加载图片的模块。 可以考虑使用html嵌入的方式,例如:

- content: <img src="./your_img_path" alt="your_context">
  icon: './your_icon_path'
  sub_title: your_sub_tittle
  title: your_tittle
Math-Still commented 3 months ago

图片建议直接放在相对目录下,今后可能不会再使用图床

EvanWonghere commented 3 months ago

使用 base64 或可解决,可参照 https://stackoverflow.com/questions/34485420/how-do-you-put-an-image-file-in-a-json-objecthttps://en.wikipedia.org/wiki/Data_URI_scheme#HTML

Sothebylin commented 3 months ago

已解决,感谢解答!!!

Sothebylin commented 3 months ago

已解决,感谢解答!!!