Skip to content

Support thematic breaks #865

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

Merged
merged 2 commits into from
Apr 3, 2024

Conversation

emilyychenn
Copy link
Contributor

@emilyychenn emilyychenn commented Mar 25, 2024

Bug/issue #: rdar://124275218

Summary

Markdown supports thematic breaks (aka horizontal rules) that are represented by placing three or more hyphens, asterisks, or underscores on a separate line, surrounded by blank lines. This PR adds support for thematic breaks within Swift DocC, adding a thematicBreak element in the render JSON.

[Minor fix]: also fixed a consistent typo in RenderContentCompilerTests.

Dependencies

DocC render needs to add support in order to render this thematic break from the render JSON.

Testing

Create a thematic break by add three or more hyphens, asterisks, or underscores on a separate line, surrounded by blank lines, and compile the documentation. The render JSON for the data type should now include an element of type "thematicBreak".

Checklist

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

  • Added tests
  • Ran the ./bin/test script and it succeeded
  • Updated documentation if necessary - N/A

@franklinsch franklinsch requested a review from d-ronnqvist March 25, 2024 17:34
Copy link
Contributor

@patshaughnessy patshaughnessy left a comment

Choose a reason for hiding this comment

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

Works perfectly for me 👍 - although as you say DocC Render doesn't support this yet but I see the same block content type appear in Render JSON.

Copy link
Contributor

@sofiaromorales sofiaromorales left a comment

Choose a reason for hiding this comment

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

Thanks for this 😄 A minor note - when we make changes to a file, we also need to update the year in the license header, like this: 202X-2024, besides that, this pr looks good to me.

@mportiz08
Copy link
Contributor

Works perfectly for me 👍 - although as you say DocC Render doesn't support this yet but I see the same block content type appear in Render JSON.

It does now as of this PR: swiftlang/swift-docc-render#791 :)

Copy link
Contributor

@d-ronnqvist d-ronnqvist left a comment

Choose a reason for hiding this comment

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

LGTM

@emilyychenn
Copy link
Contributor Author

@swift-ci Please test

Fix typo in RenderContentCompilerTests

resolve some PR feedback

Update Sources/SwiftDocC/Model/Rendering/Content/RenderBlockContent.swift

Co-authored-by: David Rönnqvist <[email protected]>

add tests with multiple variants of thematic breaks

Don't enforce unique filenames for documentation extensions (swiftlang#863)

* Allow documentation extensions to have the same name

Since documentation extensions' filenames have no impact on the URL of any pages, there's no need to enforce unique filenames for them.

DocC currently uses only the filename / last path component of articles to determine if there is a duplicate article. This change excludes doc extensions from that check to allow documentation extensions to have the same filename.

rdar://117174884

* Add test to ensure doc extensions can have the same filename

Checks that doc extensions with the same filename do not produce a warning and DocC no longer drops the content from one of the files.

Update the year in license headers

Bump patch version
@emilyychenn emilyychenn force-pushed the emily/add-horizontal-rule branch from 7f69445 to 505b285 Compare March 27, 2024 10:44
@emilyychenn
Copy link
Contributor Author

@swift-ci please test

@emilyychenn emilyychenn merged commit 6ed76cc into swiftlang:main Apr 3, 2024
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.

5 participants