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

Introduce mermaid sequence #21

Merged
merged 1 commit into from
May 5, 2024
Merged

Introduce mermaid sequence #21

merged 1 commit into from
May 5, 2024

Conversation

nao1215
Copy link
Owner

@nao1215 nao1215 commented May 5, 2024

Summary by CodeRabbit

  • New Features

    • Added support for generating mermaid sequence diagrams in the markdown package.
    • Introduced new sequence diagram examples involving participants in a wake-up scenario.
    • Enhanced markdown generation capabilities with new functions for alerts and badges.
  • Documentation

    • Updated README with detailed descriptions and examples for the markdown package.
    • Added a new generated.md file showcasing a sequence diagram example.
  • Bug Fixes

    • Standardized references to "The markdown package" across documentation for consistency.
  • Tests

    • Added various tests for new functionalities in sequence diagram manipulation and markdown generation.

Copy link

coderabbitai bot commented May 5, 2024

Walkthrough

The recent updates bring significant enhancements to the markdown package, including support for mermaid sequence diagrams, terminology refinements, and new Markdown and diagram generation features. These updates aim to improve clarity, functionality, and testing capabilities for sequence diagrams.

Changes

File(s) Summary
README.md Clarified package descriptions, added mermaid sequence diagrams support, and improved function naming for better understanding.
doc/sequence/...,
mermaid/sequence/...
Introduced and enhanced sequence diagram generation with new methods, configurations, and thorough testing coverage.

🐇💬
Oh, hark! What light through yonder codebase breaks?
Mermaid diagrams and markdown shakes.
With each commit, our docs do grow,
In streams of sequence, neatly in a row.
Hop, skip—a leap in logic's embrace,
CodeRabbit celebrates, with joyous face! 🎉🐰


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

examples_test.go Outdated Show resolved Hide resolved
mermaid/sequence/config.go Outdated Show resolved Hide resolved
mermaid/sequence/config.go Outdated Show resolved Hide resolved
mermaid/sequence/config.go Outdated Show resolved Hide resolved
examples_test.go Show resolved Hide resolved
examples_test.go Outdated Show resolved Hide resolved

This comment has been minimized.

Copy link

github-actions bot commented May 5, 2024

Code Metrics Report

main (e758807) #21 (bc2088e) +/-
Coverage 90.5% 91.4% +1.0%
Test Execution Time 10s 1s -9s
Details
  |                     | main (e758807) | #21 (bc2088e) |  +/-  |
  |---------------------|----------------|---------------|-------|
+ | Coverage            |          90.5% |         91.4% | +1.0% |
  |   Files             |              5 |            11 |    +6 |
  |   Lines             |            210 |           315 |  +105 |
+ |   Covered           |            190 |           288 |   +98 |
+ | Test Execution Time |            10s |            1s |   -9s |

Code coverage of files in pull request scope (0.0% → 93.3%)

Files Coverage +/-
mermaid/sequence/activation.go 100.0% +100.0%
mermaid/sequence/config.go 100.0% +100.0%
mermaid/sequence/directive.go 100.0% +100.0%
mermaid/sequence/note.go 100.0% +100.0%
mermaid/sequence/sequence.go 79.4% +79.4%
mermaid/sequence/statement.go 100.0% +100.0%

Reported by octocov

SyncResponse("David", "Sophia", "wake up, wake up").
String()

md.NewMarkdown(os.Stdout).
Copy link

Choose a reason for hiding this comment

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

🚫 [golangci] reported by reviewdog 🐶
G104: Errors unhandled. (gosec)

@nao1215 nao1215 merged commit 97b5eb5 into main May 5, 2024
18 checks passed
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 9

Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between e758807 and dca28ed.
Files ignored due to path filters (1)
  • go.sum is excluded by !**/*.sum
Files selected for processing (16)
  • README.md (4 hunks)
  • doc/sequence/generated.md (1 hunks)
  • doc/sequence/main.go (1 hunks)
  • examples_test.go (2 hunks)
  • mermaid/sequence/activation.go (1 hunks)
  • mermaid/sequence/activation_test.go (1 hunks)
  • mermaid/sequence/config.go (1 hunks)
  • mermaid/sequence/config_test.go (1 hunks)
  • mermaid/sequence/directive.go (1 hunks)
  • mermaid/sequence/directive_test.go (1 hunks)
  • mermaid/sequence/note.go (1 hunks)
  • mermaid/sequence/note_test.go (1 hunks)
  • mermaid/sequence/sequence.go (1 hunks)
  • mermaid/sequence/sequence_test.go (1 hunks)
  • mermaid/sequence/statement.go (1 hunks)
  • mermaid/sequence/statement_test.go (1 hunks)
Files skipped from review as they are similar to previous changes (14)
  • doc/sequence/main.go
  • examples_test.go
  • mermaid/sequence/activation.go
  • mermaid/sequence/activation_test.go
  • mermaid/sequence/config.go
  • mermaid/sequence/config_test.go
  • mermaid/sequence/directive.go
  • mermaid/sequence/directive_test.go
  • mermaid/sequence/note.go
  • mermaid/sequence/note_test.go
  • mermaid/sequence/sequence.go
  • mermaid/sequence/sequence_test.go
  • mermaid/sequence/statement.go
  • mermaid/sequence/statement_test.go
Additional Context Used
LanguageTool (25)
README.md (23)

Near line 4: Possible spelling mistake found.
Context: ...pkg.go.dev/github.com/nao1215/markdown) [![MultiPlatformUnitTest](https://github.com/nao1215/markdown/ac...


Near line 5: Possible spelling mistake found.
Context: ...rkdown/actions/workflows/unit_test.yml) [![reviewdog](https://github.com/nao1215/markdown/ac...


Near line 6: Possible spelling mistake found.
Context: ...rkdown/actions/workflows/reviewdog.yml) [![Gosec](https://github.com/nao1215/markdown/ac...


Near line 10: Possible spelling mistake found.
Context: ...arkdown is a simple markdown builder in golang. The markdown package assembles Markdow...


Near line 12: Possible spelling mistake found.
Context: ...eloped to save test results in nao1215/spectest. ...


Near line 12: Possible spelling mistake found.
Context: ...age implements the features required by spectest. For example, the markdown package supp...


Near line 12: Possible spelling mistake found.
Context: ...ams**, which was a necessary feature in spectest. Additionally, complex code that inc...


Near line 29: Possible spelling mistake found.
Context: ...x] Text formatting; bold, italic, code, strikethrough, bold italic - [x] Text with link - [x]...


Near line 38: Only proper nouns start with an uppercase character (there are exceptions for headlines).
Context: ... ### Features not in Markdown syntax - Generate badges; RedBadge(), YellowBadge(), Gree...


Near line 144: This sentence does not start with an uppercase letter.
Context: ... please refer to the following link. - sample.md ### Ge...


Near line 147: Don’t put a space before the full stop.
Context: ...e to generate Markdown first. Then, run "go generate ./..." to generate Markdown. [Code exam...


Near line 186: Unpaired symbol: ‘]’ seems to be missing
Context: ...wn. This syntax is supported by GitHub. Code example: ```g...


Near line 220: Please check whether ‘not’ might be the correct word here instead of ‘note’.
Context: ...l look like this; > [!NOTE] > This is note > [!TIP] > This is tip > [!IMPO...


Near line 223: Consider using either the past participle “tipped” or the present participle “tipping” here.
Context: ... > This is note > [!TIP] > This is tip > [!IMPORTANT] > This is important...


Near line 235: Unpaired symbol: ‘]’ seems to be missing
Context: ...e red, yellow, and green status badges. Code example: ```g...


Near line 260: Did you mean the formatting language “Markdown” (= proper noun)?
Context: ...id sequence diagram Generate mermaid in markdown. You can generate mermaid using go gene...


Near line 260: Don’t put a space before the full stop.
Context: ...te Mermaid first. Then, run "go generate ./..." to generate it. ```go package mai...


Near line 302: Unpaired symbol: ‘]’ seems to be missing
Context: ...m). Build() } ``` Plain text output: [markdown is here](./doc/sequence/generat...


Near line 352: Possible spelling mistake found.
Context: ...Markdown documents produced by nao1215/spectest. ...


Near line 372: Possible spelling mistake found.
Context: ...o all markdown files located within the testdata directory. ```go if err := GenerateI...


Near line 414: The phrase ‘feel free to’ is used quite frequently. Consider using a less frequent alternative to set your writing apart from others and make it sound more professional.
Context: ...e, GitHub Star motivates me to develop! Please feel free to contribute to this project. [![Star Hi...


Near line 419: It seems that a comma is missing.
Context: ...215/markdown&Date) ### Contributors ✨ Thanks goes to these wonderful people ([emoji ...


Near line 449: Using many exclamation marks might seem excessive (in this case: 12 exclamation marks for a text that’s 4740 characters long)
Context: ...ation. Contributions of any kind welcome!

doc/sequence/generated.md (2)

Near line 1: Posibleng may nahanap na mali sa ispeling
Context: ## Sequence Diagram ```mermaid sequenceDiagram ...


Near line 1: Posibleng may nahanap na mali sa ispeling
Context: ## Sequence Diagram ```mermaid sequenceDiagram particip...

@@ -0,0 +1,21 @@
## Sequence Diagram
Copy link

Choose a reason for hiding this comment

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

Correct the spelling error in the heading.

- ## Sequence Diagram
+ ## Sequence Diagram

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
## Sequence Diagram
## Sequence Diagram

Add a blank line after the heading for proper Markdown formatting.

## Sequence Diagram
+ 

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
## Sequence Diagram
## Sequence Diagram

@@ -0,0 +1,21 @@
## Sequence Diagram
```mermaid
Copy link

Choose a reason for hiding this comment

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

Ensure that the fenced code block is surrounded by blank lines for proper Markdown formatting.

## Sequence Diagram
+ 
```mermaid
3~

end

David-->>Sophia: wake up, wake up
```
Copy link

Choose a reason for hiding this comment

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

Files should end with a single newline character to conform to POSIX standards.

21~

<!-- This is an auto-generated comment by CodeRabbit -->

@@ -7,15 +7,15 @@
[![Gosec](https://github.com/nao1215/markdown/actions/workflows/gosec.yml/badge.svg)](https://github.com/nao1215/markdown/actions/workflows/gosec.yml)
![Coverage](https://raw.githubusercontent.com/nao1215/octocovs-central-repo/main/badges/nao1215/markdown/coverage.svg)
# What is markdown package
The Package markdown is a simple markdown builder in golang. This library assembles Markdown using method chaining, not uses a template engine like [html/template](https://pkg.go.dev/html/template). The syntax of Markdown follows GitHub Markdown.
The Package markdown is a simple markdown builder in golang. The markdown package assembles Markdown using method chaining, not uses a template engine like [html/template](https://pkg.go.dev/html/template). The syntax of Markdown follows **GitHub Markdown**.
Copy link

Choose a reason for hiding this comment

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

Correct the spelling error in the description.

- The Package markdown is a simple markdown builder in golang.
+ The markdown package is a simple markdown builder in Golang.

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
The Package markdown is a simple markdown builder in golang. The markdown package assembles Markdown using method chaining, not uses a template engine like [html/template](https://pkg.go.dev/html/template). The syntax of Markdown follows **GitHub Markdown**.
The markdown package is a simple markdown builder in Golang. The markdown package assembles Markdown using method chaining, not uses a template engine like [html/template](https://pkg.go.dev/html/template). The syntax of Markdown follows **GitHub Markdown**.


This library was initially developed to display test results in [nao1215/spectest](https://github.com/nao1215/spectest). Therefore, it implements the features required by spectest, but there are no plans to add additional functionalities unless requested by someone.
The markdown package was initially developed to save test results in [nao1215/spectest](https://github.com/nao1215/spectest). Therefore, the markdown package implements the features required by spectest. For example, the markdown package supports **mermaid sequence diagrams**, which was a necessary feature in spectest.
Copy link

Choose a reason for hiding this comment

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

Clarify the sentence to improve readability.

- The markdown package was initially developed to save test results in [nao1215/spectest](https://github.com/nao1215/spectest).
+ The markdown package was initially developed to document test results for [nao1215/spectest](https://github.com/nao1215/spectest).

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
The markdown package was initially developed to save test results in [nao1215/spectest](https://github.com/nao1215/spectest). Therefore, the markdown package implements the features required by spectest. For example, the markdown package supports **mermaid sequence diagrams**, which was a necessary feature in spectest.
The markdown package was initially developed to document test results for [nao1215/spectest](https://github.com/nao1215/spectest). Therefore, the markdown package implements the features required by spectest. For example, the markdown package supports **mermaid sequence diagrams**, which was a necessary feature in spectest.

@@ -32,6 +32,7 @@ Additionally, complex code that increases the complexity of the library, such as
- [x] Plain text
- [x] Details
- [x] Alerts; NOTE, TIP, IMPORTANT, CAUTION, WARNING
- [x] mermaid (only support sequence diagram)
Copy link

Choose a reason for hiding this comment

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

Clarify that the support for Mermaid diagrams is limited to sequence diagrams.

- - [x] mermaid (only support sequence diagram)
+ - [x] Mermaid diagrams (currently, only sequence diagrams are supported)

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
- [x] mermaid (only support sequence diagram)
- [x] Mermaid diagrams (currently, only sequence diagrams are supported)

@@ -142,6 +143,45 @@ func main() {
If you want to see how it looks in Markdown, please refer to the following link.
- [sample.md](./doc/generated_example.md)

### Generate Markdown using `"go generate ./..."`
Copy link

Choose a reason for hiding this comment

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

Add a blank line after the heading for proper Markdown formatting.

### Generate Markdown using `"go generate ./..."`
+ 

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
### Generate Markdown using `"go generate ./..."`
### Generate Markdown using `"go generate ./..."`

@@ -216,45 +256,98 @@ Your badge will look like this;
![Badge](https://img.shields.io/badge/yellow_badge-yellow)
![Badge](https://img.shields.io/badge/green_badge-green)

### Generate Markdown using `"go generate ./..."`
You can generate Markdown using `go generate`. Please define code to generate Markdown first. Then, run `"go generate ./..."` to generate Markdown.
### Generate mermaid sequence diagram
Copy link

Choose a reason for hiding this comment

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

Clarify the description to improve understanding.

- Generate mermaid in markdown. You can generate mermaid using go generate.
+ Generate Mermaid diagrams in Markdown using the `go generate` command.

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
### Generate mermaid sequence diagram
### Generate Mermaid diagrams in Markdown using the `go generate` command.

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.

1 participant