Skip to content

Add plugin CSS and custom CSS to the export PDF page #9376

Closed
@frostime

Description

@frostime
Contributor

In what scenarios do you need this feature?

目前在导出 PDF 的时候,主题的 css 样式是生效的。
但是插件的样式却不能生效。

Describe the optimal solution

希望插件的样式在导出的时候同样生效。

Describe the candidate solution

No response

Other information

No response

Activity

terwer

terwer commented on Oct 9, 2023

@terwer
Contributor

+1

royc01

royc01 commented on Oct 9, 2023

@royc01

+1

Vanessa219

Vanessa219 commented on Oct 9, 2023

@Vanessa219
Member

还麻烦举例详述一下。

frostime

frostime commented on Oct 9, 2023

@frostime
ContributorAuthor

还麻烦举例详述一下。

1. link icon 插件在思源中可以显示 url 的图标,但是导出 PDF 后就没有图标了

image

image

2. savor 有一个 callout 样式的功能,这个样式我同样抽离成了一个插件 sy-bq-callout,代码基本是一致的,还没有上架

但是使用 savor 主题导出的时候,callout 样式在PDF中会保留;使用插件的时候,PDF导出里面就没有对应的样式。

savor 可以导出:
52437e955061626907846b008eda8563

但是插件就不能导出

b4af3e96366e647ef506f178827e4da8

8a13dce69ec4f40904b0eef71db55094

Zuoqiu-Yingyi

Zuoqiu-Yingyi commented on Oct 9, 2023

@Zuoqiu-Yingyi
Contributor

代码片段样式也有同样的需求

Vanessa219

Vanessa219 commented on Oct 9, 2023

@Vanessa219
Member

看了一下,由于 PDF 是单独的静态页面,目前没办法引用插件。但是代码片段是可以添加的。

frostime

frostime commented on Oct 9, 2023

@frostime
ContributorAuthor

看了一下,由于 PDF 是单独的静态页面,目前没办法引用插件。但是代码片段是可以添加的。

请问同样是插入到 head 的 style 标签里,代码片段的css和插件的css有什么区别呢?

还是说导出 PDF 时不是从 head 当中读取 style 样式,而是根据特定的接口获取代码片段 css?如果是这样的话,是否可以给插件提供一个类似 addStyle 的接口,允许插件传入 css 字符串,让其在导出的时候生效?

Zuoqiu-Yingyi

Zuoqiu-Yingyi commented on Oct 9, 2023

@Zuoqiu-Yingyi
Contributor

看了一下,由于 PDF 是单独的静态页面,目前没办法引用插件。但是代码片段是可以添加的。

这里是指引用插件的 index.css

Vanessa219

Vanessa219 commented on Oct 10, 2023

@Vanessa219
Member

看了一下,由于 PDF 是单独的静态页面,目前没办法引用插件。但是代码片段是可以添加的。

这里是指引用插件的 index.css

@frostime

link-icon 这个没细看,里面好像是有 js 代码的,如果只加在 css 就可以了话那应该是没有问题的。

frostime

frostime commented on Oct 10, 2023

@frostime
ContributorAuthor

看了一下,由于 PDF 是单独的静态页面,目前没办法引用插件。但是代码片段是可以添加的。

这里是指引用插件的 index.css

@frostime

link-icon 这个没细看,里面好像是有 js 代码的,如果只加在 css 就可以了话那应该是没有问题的。

只需要让 style 里面的 css 生效就行,至于 js 操作的样式可以不用管。

changed the title [-]让插件样式在导出 PDF 的时候同样生效[/-] [+]Add plugin CSS and custom CSS to the export PDF page[/+] on Oct 10, 2023
self-assigned this
on Oct 10, 2023
added this to the 2.10.10 milestone on Oct 10, 2023
added a commit that references this issue on Oct 10, 2023

8 remaining items

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

    Development

    No branches or pull requests

      Participants

      @Vanessa219@terwer@frostime@royc01@Zuoqiu-Yingyi

      Issue actions

        Add plugin CSS and custom CSS to the export PDF page · Issue #9376 · siyuan-note/siyuan