Skip to content

Conversation

@mportiz08
Copy link
Contributor

@mportiz08 mportiz08 commented Mar 25, 2024

Bug/issue #, if applicable: 125507297

Summary

Adds support for rendering "thematic breaks" within content using the <hr> element.

With the corresponding Swift-DocC PR, the markdown syntax for horizontal rules can be used in content to indicate a thematic break within content, and this PR adds rendering support for this.

Example Markdown:

diff --git a/SwiftDocCRender.docc/contributing/Internals.md b/SwiftDocCRender.docc/contributing/Internals.md
index d3054747..2500a12d 100644
--- a/SwiftDocCRender.docc/contributing/Internals.md
+++ b/SwiftDocCRender.docc/contributing/Internals.md
@@ -6,6 +6,8 @@ Learn how DocC-Render is built internally, the principles behind its structure,
 
 DocC-Render supports rendering reference pages, tutorials, and articles to document your project in a structured manner.
 
+---
+
 Each page fetches its required render JSON asynchronously, from the `/data` directory. To learn more about the types of pages DocC-Render supports, visit the [DocC Docs](https://www.swift.org/documentation/docc).
 
 ### Modular Architecture

Example rendering:

Screenshot 2024-03-25 at 12 19 20 PM

Dependencies

swiftlang/swift-docc#865

Testing

Steps:

  1. Checkout/build the branch of Swift-DocC from Support thematic breaks #865
  2. Checkout/build the branch of Swift-DocC-Render from this PR
  3. Add/modify content with a markdown horizontal rule (like the example above)
  4. Preview the docs using DOCC_HTML_DIR=/path/to/swift-docc-render/dist swift run docc preview ExampleContent.docc and verify that a horizontal rule is rendered in the appropriate place

Checklist

Make sure you check off the following items. If they cannot be completed, provide a reason.

  • Added tests
  • Ran npm test, and it succeeded
  • Updated documentation if necessary

@mportiz08
Copy link
Contributor Author

@swift-ci test

Copy link

@emilyychenn emilyychenn left a comment

Choose a reason for hiding this comment

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

This works great when I test it locally with my version of swift-docc (from here)! Just curious, is the thematic break supposed to have more emphasis than the horizontal line between the "Overview" and "Topics" sections?

Screenshot 2024-03-26 at 13 15 01

Copy link
Member

@marinaaisa marinaaisa left a comment

Choose a reason for hiding this comment

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

I tested it and it works great!
I added a comment to fix how hr looks by default.

Btw, you missed the docc executable in the testing instructions, if you want to update them:

DOCC_HTML_DIR=/path/to/swift-docc-render/dist swift run docc preview ExampleContent.docc

@mportiz08
Copy link
Contributor Author

This works great when I test it locally with my version of swift-docc (from here)! Just curious, is the thematic break supposed to have more emphasis than the horizontal line between the "Overview" and "Topics" sections?

Screenshot 2024-03-26 at 13 15 01

No, it should probably look the same. Thanks for catching that!

@mportiz08
Copy link
Contributor Author

@swift-ci test

@mportiz08 mportiz08 requested a review from marinaaisa March 26, 2024 16:24
@mportiz08
Copy link
Contributor Author

This works great when I test it locally with my version of swift-docc (from here)! Just curious, is the thematic break supposed to have more emphasis than the horizontal line between the "Overview" and "Topics" sections?
Screenshot 2024-03-26 at 13 15 01

No, it should probably look the same. Thanks for catching that!

Fixed

Screen Shot 2024-03-26 at 09 30 33

Copy link
Member

@marinaaisa marinaaisa left a comment

Choose a reason for hiding this comment

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

LGTM!

@mportiz08
Copy link
Contributor Author

@swift-ci test

@mportiz08 mportiz08 merged commit 3343e95 into swiftlang:main Mar 27, 2024
@mportiz08 mportiz08 deleted the support-thematic-breaks branch March 27, 2024 20:41
mportiz08 added a commit to mportiz08/swift-docc-render that referenced this pull request Mar 27, 2024
Add support for "thematic breaks" using `<hr>`.

Resolves: rdar://125507297
mportiz08 added a commit that referenced this pull request Apr 2, 2024
Add support for "thematic breaks" using `<hr>`.

Resolves: rdar://125507297
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.

3 participants