Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ Add page break before h2 #132

Closed
wants to merge 0 commits into from
Closed

✨ Add page break before h2 #132

wants to merge 0 commits into from

Conversation

Zxis233
Copy link
Contributor

@Zxis233 Zxis233 commented Feb 29, 2024

Give an option to choose whether to enable page break after each h2 title except the first one.

@Keldos-Li
Copy link
Owner

🤔should correct: after h2 => before h2

@Zxis233
Copy link
Contributor Author

Zxis233 commented Mar 1, 2024

🤔should correct: after h2 => before h2

yeah, it's a typo :P
I'm really sorry about that.

@Zxis233 Zxis233 changed the title ✨ Add page break after h2 ✨ Add page break before h2 Mar 1, 2024
@Keldos-Li
Copy link
Owner

emm,请再push一个commit更改代码中的写法

@Zxis233
Copy link
Contributor Author

Zxis233 commented Mar 2, 2024

emm,请再push一个commit更改代码中的写法

其实功能是“使每个二级标题单独一页显示”,所以强制分页在二级标题下的内容之后(?)
不过保持一致性我都改成一样吧,免得歧义

@Keldos-Li
Copy link
Owner

@RalXYZ

Copy link
Collaborator

@RalXYZ RalXYZ left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Zxis233 @Keldos-Li 抱歉拖了这么久才审核,这个 pr 的审核请求邮件被我不小心忽略掉了。
我对这个 pr 的意见主要有两个点。

  1. page-break-before 这个属性目前已经 deprecated 了,应该换成 break-before
  2. 我不太认同把默认值设为 avoid。我觉得默认的行为没必要改,维持原始值是最稳妥的。我换种说法,需要分页的地方用 always 这个肯定没问题,不需要分页的地方我觉得应该维持原样用 auto

更细节的观点我已经在相关位置进行了批注。我不知道大家对此有无其他看法。如果认同这个观点,辛苦 @Zxis233 修改并测试一下,再提交一个 commit。

@@ -116,6 +116,10 @@
--link-color-light: #2E67D3;
--link-color-dark: #8bb1f9;

/* == 强制分页 == */
/* 二级标题前是否分页显示,always为开启,void为关闭 */
--page-break-before-h2: void;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

请再确认一下,这里确定是 void 吗?我在 page-break-before 的 MDN 文档 里并没有找到 void 这个值。
此外,根据我的理解,开关的默认值不应该是显式的开或者关,而应该是字面意思的“默认值”,从而保持尽可能大的兼容性。如,针对 page-break-before 这个属性而言,它的默认值是 auto

@@ -13,6 +13,12 @@ body {
#write {
padding: 0 !important;
}
h2 {
page-break-before: var(--page-break-before-h2);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

page-break-before 这个 tag 已被弃用,参见它的MDN文档。根据文档指引,请考虑使用 break-before

page-break-before: var(--page-break-before-h2);
}
h2:first-of-type {
page-break-before: avoid;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我认为无需显式地更改 page-break-before 这个属性在 first-of-type 情况下的值为 avoid。请考虑保持它的值为 auto,即维持默认情况。

@RalXYZ
Copy link
Collaborator

RalXYZ commented Apr 15, 2024

再次为我的粗心和拖延表示歉意,以后我尽可能避免拖这么久。感谢 @Zxis233 的贡献和 @Keldos-Li 的工作。

@Zxis233
Copy link
Contributor Author

Zxis233 commented Apr 16, 2024

@Zxis233 @Keldos-Li 抱歉拖了这么久才审核,这个 pr 的审核请求邮件被我不小心忽略掉了。 我对这个 pr 的意见主要有两个点。

  1. page-break-before 这个属性目前已经 deprecated 了,应该换成 break-before
  2. 我不太认同把默认值设为 avoid。我觉得默认的行为没必要改,维持原始值是最稳妥的。我换种说法,需要分页的地方用 always 这个肯定没问题,不需要分页的地方我觉得应该维持原样用 auto

更细节的观点我已经在相关位置进行了批注。我不知道大家对此有无其他看法。如果认同这个观点,辛苦 @Zxis233 修改并测试一下,再提交一个 commit。

收到。感谢指正。
另外,不知道typora是否支持在markdown元数据的地方传入参数?类似´typora-copy-images-to´可以强制指定图片保存方式,这样就不需要来回修改css文件了 XP

@RalXYZ
Copy link
Collaborator

RalXYZ commented Apr 16, 2024

另外,不知道typora是否支持在markdown元数据的地方传入参数?

这个我之前没了解过,我理解是没有这种功能,你可以调查一下

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants