Skip to content

Conversation

@tbouffard
Copy link
Member

@tbouffard tbouffard commented Jan 3, 2025

Adapt the mxGraph tutorial, which mainly includes information about the Editor class.

Notes

Closes #613

Summary by CodeRabbit

  • Documentation

    • Updated README.md with clearer migration status description.
    • Removed "work in progress" warning from intro documentation.
    • Added new tutorial documents for maxGraph:
      • Editor Input/Output
      • maxGraph Editor
      • Graph
      • The Hello World Example
    • Adjusted sidebar positioning for various documentation sections.
    • Introduced a new "Tutorials" category in documentation.
    • Updated migration documentation with significant changes to features and usage patterns.
  • Chores

    • Disabled documentation announcement bar.
    • Removed old mxGraph tutorial HTML file.

@tbouffard tbouffard added the documentation Improvements or additions to documentation label Jan 3, 2025
@coderabbitai
Copy link

coderabbitai bot commented Jan 3, 2025

Walkthrough

This pull request focuses on migrating and updating the documentation for the maxGraph library. The changes involve removing work-in-progress warnings, adding new tutorial documents, and reorganizing the documentation structure. The tutorials cover key aspects of the library such as the Graph class, Editor, and a Hello World example, progressively replacing the original mxGraph documentation. The changes aim to provide more comprehensive and clear guidance for users transitioning to maxGraph.

Changes

File Change Summary
README.md Updated documentation migration warning and streamlined migration status sections
packages/website/docs/development/_category_.json Modified category position from 13 to 21
packages/website/docs/intro.md Removed work-in-progress warning block
packages/website/docs/known-issues.md Changed sidebar_position from 20 to 100
packages/website/docs/tutorials/_category_.json Added new Tutorials category with position 12
packages/website/docs/tutorials/editor-input-output.md New tutorial on Editor input/output functionality
packages/website/docs/tutorials/editor.md New tutorial on maxGraph Editor usage and configuration
packages/website/docs/tutorials/graph.md New tutorial on Graph class and its features
packages/website/docs/tutorials/the-hello-world-example.md New Hello World tutorial
packages/website/docs/usage/_category_.json Updated category position from 12 to 13
packages/website/docusaurus.config.ts Commented out announcement bar configuration
packages/website/old-mxgraph/tutorial.html Deleted original mxGraph tutorial file

Assessment against linked issues

Objective Addressed Explanation
Migrate first draft of content [#618]
Review and adapt content to maxGraph API
Avoid duplicating content between Manual and Tutorial Requires further review of Manual content.

Possibly related issues

Possibly related PRs

  • docs: add a Codecs page #524: Migration documentation updates in migrate-from-mxgraph.md, providing additional context for library transition.

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>, please review it.
    • 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 gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @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.
    • @coderabbitai help me debug CodeRabbit configuration file.

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 using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration 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.

@tbouffard tbouffard marked this pull request as ready for review January 5, 2025 17:18
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: 4

🧹 Nitpick comments (10)
packages/website/docs/tutorials/editor-input-output.md (2)

67-70: Modernize JavaScript example

The JavaScript example could be improved with modern practices:

-const data = editor.writeGraphModel();
-editor.readGraphModel(xmlUtils.parseXml(data));
+try {
+    const data = editor.writeGraphModel();
+    editor.readGraphModel(xmlUtils.parseXml(data));
+} catch (error) {
+    console.error('Failed to process graph model:', error);
+    // Handle error appropriately
+}

33-33: Add missing comma for better readability

-The editor issues a post request to the specified URL passing the XML along as a POST variable called xml.
+The editor issues a post request to the specified URL, passing the XML along as a POST variable called xml.
🧰 Tools
🪛 LanguageTool

[uncategorized] ~33-~33: Possible missing comma found.
Context: ... issues a post request to the specified URL passing the XML along as a POST variabl...

(AI_HYDRA_LEO_MISSING_COMMA)

packages/website/docs/tutorials/the-hello-world-example.md (2)

34-34: Enhance CSS styling guidance

Consider providing a complete CSS example for container styling:

.graph-container {
    width: 100%;
    height: 600px;
    border: 1px solid #ccc;
    overflow: auto;
    /* Optional: Prevent text selection during graph interaction */
    user-select: none;
}

63-79: Add error handling to the graph manipulation example

The code example should demonstrate proper error handling:

 // Gets the default parent for inserting new cells.
 // This is normally the first child of the root (ie. layer 0).
 const parent = graph.getDefaultParent();
 
 // Adds cells to the model in a single step
 model.beginUpdate();
 try  {
+    if (!parent) {
+        throw new Error('Failed to get default parent');
+    }
     const v1 = graph.insertVertex(parent, null, 'Hello,', 20, 20, 80, 30);
     const v2 = graph.insertVertex(parent, null, 'World!', 200, 150, 80, 30);
     graph.insertEdge(parent, null, '', v1, v2);
+} catch (error) {
+    console.error('Failed to create graph:', error);
+    // Handle error appropriately
 }
 finally {
     // Updates the display
     model.endUpdate();
 }
packages/website/docs/tutorials/editor.md (2)

36-39: Update code example to use modern practices

The code example uses the older mxUtils. Consider updating to modern practices:

-const config = mxUtils.load('editors/config/keyhandler-commons.xml').getDocumentElement();
-const editor = new Editor(config);
+async function createEditor() {
+    try {
+        const response = await fetch('editors/config/keyhandler-commons.xml');
+        const text = await response.text();
+        const parser = new DOMParser();
+        const config = parser.parseFromString(text, 'text/xml').documentElement;
+        return new Editor(config);
+    } catch (error) {
+        console.error('Failed to initialize editor:', error);
+        throw error;
+    }
+}

70-84: Add explanation for XML template attributes

The XML template example would benefit from detailed comments explaining each attribute's purpose:

 <add as="symbol">
   <Symbol label="Symbol" customAttribute="whatever">
     <Cell vertex="1" connectable="true">
+      <!-- Geometry defines the size of the cell -->
       <Geometry as="geometry" width="32" height="32"/>
+      <!-- Style configuration for the cell -->
       <Object fillColor="green" image="images/event.png" as="style">
         <Array as="baseStyleNames">
+          <!-- Base style that this cell inherits from -->
           <add value="symbol" />
         </Array>
       </Object>        
     </Cell>
+    <!-- Custom child elements can be added for additional metadata -->
     <CustomChild customAttribute="whatever"/>
   </Symbol>
 </add>
packages/website/docs/tutorials/graph.md (4)

29-29: Add alt text to the Graph class hierarchy diagram

The image is missing alt text which impacts accessibility.

-![The Graph class hierarchy](assets/graphs/graph.png)
+![Class hierarchy showing Graph as the central class with its relationships to other classes](assets/graphs/graph.png)

43-43: Add alt text to the model diagram

The image is missing alt text which impacts accessibility.

-![](assets/graphs/model.png)
+![Diagram showing the relationship between Graph Model, Cells, and Layers](assets/graphs/model.png)
🧰 Tools
🪛 Markdownlint (0.37.0)

43-43: null
Images should have alternate text (alt text)

(MD045, no-alt-text)


100-100: Update TODO comment to be more specific

The TODO comment about migrating to a new method signature should include more details about the expected changes.

-[//]: # (TODO migrate to the new insertVertex method using a single object parameter)
+[//]: # (TODO migrate to use graph.insertVertex({ parent, value, position: [x, y], size: [width, height], style }) instead of the legacy parameter list)

26-27: Improve wording in introduction

Consider a more concise wording to avoid wordiness.

-Instantiate [Graph](https://maxgraph.github.io/maxGraph/api-docs/classes/Graph.html) in order to create a graph. This is the central class in the API.
+Create a graph by instantiating the [Graph](https://maxgraph.github.io/maxGraph/api-docs/classes/Graph.html) class, which is central to the API.
🧰 Tools
🪛 LanguageTool

[style] ~26-~26: Consider a shorter alternative to avoid wordiness.
Context: ...o/maxGraph/api-docs/classes/Graph.html) in order to create a graph. This is the central cla...

(IN_ORDER_TO_PREMIUM)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d2c363c and ce755ce.

⛔ Files ignored due to path filters (4)
  • packages/website/docs/tutorials/assets/graphs/editor.png is excluded by !**/*.png
  • packages/website/docs/tutorials/assets/graphs/graph.png is excluded by !**/*.png
  • packages/website/docs/tutorials/assets/graphs/model.png is excluded by !**/*.png
  • packages/website/docs/tutorials/assets/hello-world-example.png is excluded by !**/*.png
📒 Files selected for processing (12)
  • README.md (1 hunks)
  • packages/website/docs/development/_category_.json (1 hunks)
  • packages/website/docs/intro.md (0 hunks)
  • packages/website/docs/known-issues.md (1 hunks)
  • packages/website/docs/tutorials/_category_.json (1 hunks)
  • packages/website/docs/tutorials/editor-input-output.md (1 hunks)
  • packages/website/docs/tutorials/editor.md (1 hunks)
  • packages/website/docs/tutorials/graph.md (1 hunks)
  • packages/website/docs/tutorials/the-hello-world-example.md (1 hunks)
  • packages/website/docs/usage/_category_.json (1 hunks)
  • packages/website/docusaurus.config.ts (1 hunks)
  • packages/website/old-mxgraph/tutorial.html (0 hunks)
💤 Files with no reviewable changes (2)
  • packages/website/docs/intro.md
  • packages/website/old-mxgraph/tutorial.html
✅ Files skipped from review due to trivial changes (5)
  • packages/website/docs/usage/category.json
  • packages/website/docs/development/category.json
  • packages/website/docs/known-issues.md
  • packages/website/docusaurus.config.ts
  • packages/website/docs/tutorials/category.json
🧰 Additional context used
🪛 LanguageTool
packages/website/docs/tutorials/graph.md

[style] ~26-~26: Consider a shorter alternative to avoid wordiness.
Context: ...o/maxGraph/api-docs/classes/Graph.html) in order to create a graph. This is the central cla...

(IN_ORDER_TO_PREMIUM)

packages/website/docs/tutorials/editor-input-output.md

[uncategorized] ~33-~33: Possible missing comma found.
Context: ... issues a post request to the specified URL passing the XML along as a POST variabl...

(AI_HYDRA_LEO_MISSING_COMMA)


[uncategorized] ~39-~39: Possible missing comma found.
Context: ... an example, consider the following PHP file which is located in the same directory ...

(AI_HYDRA_LEO_MISSING_COMMA)


[style] ~40-~40: Consider a shorter alternative to avoid wordiness.
Context: ...st be set to server.php on the editor in order to post the diagram to the server. The PHP...

(IN_ORDER_TO_PREMIUM)

packages/website/docs/tutorials/the-hello-world-example.md

[uncategorized] ~55-~55: Although a hyphen is possible, it is not necessary in a compound modifier in which the first word is an adverb that ends in ‘ly’.
Context: ...The endUpdate should always go into a finally-block to make sure it is always executed if t...

(HYPHENATED_LY_ADVERB_ADJECTIVE)

packages/website/docs/tutorials/editor.md

[uncategorized] ~11-~11: Possible missing comma found.
Context: ...Graphtutorial was used to create this page which still containsmxGraph` class di...

(AI_HYDRA_LEO_MISSING_COMMA)


[style] ~26-~26: Consider a shorter alternative to avoid wordiness.
Context: .../maxGraph/api-docs/classes/Editor.html) in order to create an editor. This is the central c...

(IN_ORDER_TO_PREMIUM)

🪛 Markdownlint (0.37.0)
packages/website/docs/tutorials/graph.md

68-68: null
Spaces inside link text

(MD039, no-space-in-links)


85-85: null
Spaces inside link text

(MD039, no-space-in-links)


43-43: null
Images should have alternate text (alt text)

(MD045, no-alt-text)

packages/website/docs/tutorials/editor.md

32-32: null
Images should have alternate text (alt text)

(MD045, no-alt-text)

🔇 Additional comments (1)
README.md (1)

132-132: LGTM! Documentation update is clear and concise

The simplified warning message better reflects the current state of the documentation while maintaining transparency about ongoing improvements.

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: 3

🧹 Nitpick comments (3)
packages/website/docs/tutorials/editor.md (1)

71-84: Add XML example context

The XML template example could benefit from a brief explanation of:

  • The purpose of the Symbol element
  • The significance of the customAttribute
  • The role of baseStyleNames
packages/website/docs/tutorials/graph.md (2)

100-100: Address TODO comment about migration

There's a TODO comment about migrating to the new insertVertex method.

Would you like me to help implement the migration to the new method signature or create an issue to track this task?


68-68: Fix markdown formatting

Remove spaces inside link text for better markdown formatting:

-A style is a [CellStateStyle object ](https://maxgraph.github.io/maxGraph/api-docs/types/CellStateStyle.html)
+A style is a [CellStateStyle object](https://maxgraph.github.io/maxGraph/api-docs/types/CellStateStyle.html)

Also applies to: 85-85

🧰 Tools
🪛 Markdownlint (0.37.0)

68-68: null
Spaces inside link text

(MD039, no-space-in-links)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ce755ce and 59212bf.

📒 Files selected for processing (3)
  • packages/website/docs/tutorials/editor-input-output.md (1 hunks)
  • packages/website/docs/tutorials/editor.md (1 hunks)
  • packages/website/docs/tutorials/graph.md (1 hunks)
🧰 Additional context used
📓 Learnings (1)
packages/website/docs/tutorials/graph.md (1)
Learnt from: tbouffard
PR: maxGraph/maxGraph#618
File: packages/website/docs/tutorials/graph.md:56-59
Timestamp: 2025-01-06T09:09:47.410Z
Learning: In the maxGraph library, the classes "Cell" and "GraphDataModel" are valid, while "GraphCell" and "GraphModel" do not exist.
🪛 LanguageTool
packages/website/docs/tutorials/graph.md

[uncategorized] ~11-~11: Possible missing comma found.
Context: ...Graphtutorial was used to create this page which still containsmxGraph` class di...

(AI_HYDRA_LEO_MISSING_COMMA)


[style] ~26-~26: Consider a shorter alternative to avoid wordiness.
Context: ...o/maxGraph/api-docs/classes/Graph.html) in order to create a graph. This is the central cla...

(IN_ORDER_TO_PREMIUM)


[uncategorized] ~115-~115: A comma might be missing here.
Context: ...earance"> ## Appearance In certain cases you may want to override specific attri...

(AI_EN_LECTOR_MISSING_PUNCTUATION_COMMA)

packages/website/docs/tutorials/editor.md

[style] ~26-~26: Consider a shorter alternative to avoid wordiness.
Context: .../maxGraph/api-docs/classes/Editor.html) in order to create an editor. This is the central c...

(IN_ORDER_TO_PREMIUM)

packages/website/docs/tutorials/editor-input-output.md

[style] ~40-~40: Consider a shorter alternative to avoid wordiness.
Context: ...st be set to server.php on the editor in order to post the diagram to the server. The PHP...

(IN_ORDER_TO_PREMIUM)

🪛 Markdownlint (0.37.0)
packages/website/docs/tutorials/graph.md

68-68: null
Spaces inside link text

(MD039, no-space-in-links)


85-85: null
Spaces inside link text

(MD039, no-space-in-links)


43-43: null
Images should have alternate text (alt text)

(MD045, no-alt-text)

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: 0

🧹 Nitpick comments (8)
packages/website/docs/tutorials/editor.md (1)

72-84: Add comments to explain XML attributes

Consider adding inline comments to explain the purpose of key attributes in the template XML.

 <add as="symbol">
+  <!-- 'as' attribute defines the template name -->
   <Symbol label="Symbol" customAttribute="whatever">
+    <!-- Cell element defines the graphical properties -->
     <Cell vertex="1" connectable="true">
       <Geometry as="geometry" width="32" height="32"/>
+      <!-- Object element defines the visual style -->
       <Object fillColor="green" image="images/event.png" as="style">
         <Array as="baseStylenames">
           <add value="symbol" />
         </Array>
       </Object>        
     </Cell>
     <CustomChild customAttribute="whatever"/>
   </Symbol>
 </add>
packages/website/docs/tutorials/graph.md (3)

11-11: Fix grammar in warning message

Add a comma after "this page" for better readability.

-The original `mxGraph` tutorial was used to create this page which still contains `mxGraph` class diagrams to migrate to the maxGraph API.
+The original `mxGraph` tutorial was used to create this page, which still contains `mxGraph` class diagrams to migrate to the maxGraph API.
🧰 Tools
🪛 LanguageTool

[uncategorized] ~11-~11: Possible missing comma found.
Context: ...Graphtutorial was used to create this page which still containsmxGraph` class di...

(AI_HYDRA_LEO_MISSING_COMMA)


68-68: Fix markdown link formatting

Remove extra spaces in link text for better markdown compliance.

-A style is a [CellStateStyle object ](https://maxgraph.github.io/maxGraph/api-docs/types/CellStateStyle.html), to be used with the cells. 
+A style is a [CellStateStyle object](https://maxgraph.github.io/maxGraph/api-docs/types/CellStateStyle.html), to be used with the cells. 

-The cell style is a [CellStateStyle object ](https://maxgraph.github.io/maxGraph/api-docs/types/CellStateStyle.html) which tells the graph to use the given named styles and override the specified keys. 
+The cell style is a [CellStateStyle object](https://maxgraph.github.io/maxGraph/api-docs/types/CellStateStyle.html) which tells the graph to use the given named styles and override the specified keys. 

Also applies to: 85-85

🧰 Tools
🪛 Markdownlint (0.37.0)

68-68: null
Spaces inside link text

(MD039, no-space-in-links)


100-100: Address TODO comment about insertVertex method migration

The TODO comment indicates that the insertVertex method needs to be migrated to use a single object parameter.

Would you like me to help implement this migration or create a GitHub issue to track this task?

packages/core/src/util/MaxXmlRequest.ts (1)

414-415: Show complete usage example.
The snippet properly demonstrates retrieving the document element. Consider adding minimal error handling for completeness.

packages/website/docs/usage/migrate-from-mxgraph.md (3)

176-176: Minor punctuation suggestion.
In the bullet list, consider removing the trailing colon after “getXml()”. The sentence reads more cleanly without it.

- - `getXml()`: Update your code to use `xmlUtils.getXml()` ...
+ - `getXml()` Update your code to use `xmlUtils.getXml()` ...
🧰 Tools
🪛 LanguageTool

[uncategorized] ~176-~176: Loose punctuation mark.
Context: ...tPoint(). #### xmlUtils-getXml(): Update your code to use xmlUtils.getXm...

(UNLIKELY_OPENING_PUNCTUATION)


179-179: Check section headings for clarity.
Ensure “In the default namespace” matches actual usage. If it’s describing only “get” and “load,” consider renaming for clarity.


180-181: Grammar and formatting consistency.
The bullet points for get() and load() sections read well, but each line could be rephrased to keep the instructions parallel (e.g., “Use get() instead of mxUtils.get()” to match the line for load()).

🧰 Tools
🪛 LanguageTool

[uncategorized] ~181-~181: Loose punctuation mark.
Context: ...instead ofmxUtils.get(). - load(): Update your code to use load()` instea...

(UNLIKELY_OPENING_PUNCTUATION)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 59212bf and 2ec206b.

📒 Files selected for processing (4)
  • packages/core/src/util/MaxXmlRequest.ts (2 hunks)
  • packages/website/docs/tutorials/editor.md (1 hunks)
  • packages/website/docs/tutorials/graph.md (1 hunks)
  • packages/website/docs/usage/migrate-from-mxgraph.md (1 hunks)
🧰 Additional context used
📓 Learnings (1)
packages/website/docs/tutorials/graph.md (1)
Learnt from: tbouffard
PR: maxGraph/maxGraph#618
File: packages/website/docs/tutorials/graph.md:56-59
Timestamp: 2025-01-06T09:09:47.410Z
Learning: In the maxGraph library, the classes "Cell" and "GraphDataModel" are valid, while "GraphCell" and "GraphModel" do not exist.
🪛 LanguageTool
packages/website/docs/tutorials/graph.md

[uncategorized] ~11-~11: Possible missing comma found.
Context: ...Graphtutorial was used to create this page which still containsmxGraph` class di...

(AI_HYDRA_LEO_MISSING_COMMA)


[style] ~26-~26: Consider a shorter alternative to avoid wordiness.
Context: ...o/maxGraph/api-docs/classes/Graph.html) in order to create a graph. This is the central cla...

(IN_ORDER_TO_PREMIUM)

packages/website/docs/usage/migrate-from-mxgraph.md

[uncategorized] ~176-~176: Loose punctuation mark.
Context: ...tPoint(). #### xmlUtils-getXml(): Update your code to use xmlUtils.getXm...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~177-~177: Loose punctuation mark.
Context: ...Utils.getXml(). - createXmlDocument(): Update your code to use xmlUtils.creat...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~181-~181: Loose punctuation mark.
Context: ...instead ofmxUtils.get(). - load(): Update your code to use load()` instea...

(UNLIKELY_OPENING_PUNCTUATION)

packages/website/docs/tutorials/editor.md

[style] ~26-~26: Consider a shorter alternative to avoid wordiness.
Context: .../maxGraph/api-docs/classes/Editor.html) in order to create an editor. This is the central c...

(IN_ORDER_TO_PREMIUM)

🪛 Markdownlint (0.37.0)
packages/website/docs/tutorials/graph.md

68-68: null
Spaces inside link text

(MD039, no-space-in-links)


85-85: null
Spaces inside link text

(MD039, no-space-in-links)

⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: build
  • GitHub Check: build (windows-2022)
  • GitHub Check: build (macos-14)
  • GitHub Check: build (ubuntu-22.04)
🔇 Additional comments (7)
packages/website/docs/tutorials/editor.md (1)

37-39: 🛠️ Refactor suggestion

Update code example to use xmlUtils

The example should use the xmlUtils utility class instead of the deprecated load function.

-import { load } from '@maxgraph/core';
-const config = load('editors/config/keyhandler-commons.xml').getDocumentElement();
+import { xmlUtils } from '@maxgraph/core';
+const config = xmlUtils.parseXml('editors/config/keyhandler-commons.xml').documentElement;
const editor = new Editor(config);

Likely invalid or redundant comment.

packages/core/src/util/MaxXmlRequest.ts (6)

347-347: Use plain definitions for clarity.
This change clarifies “textareas” → “text areas” in the comment, improving the documentation’s readability.


381-383: Ensure doc references match.
The doc block references get for asynchronous loading, which aligns well with the newly documented function. This is consistent, no issues noted.


388-390: Validate error reporting.
Switching from an alert-based error to console.error is more user-friendly in modern JS environments. Confirm that console.error meets the project’s logging guidelines.

Also applies to: 392-393


399-399: Return type clarity.
Returning MaxXmlRequest from load clarifies its usage for the caller. This is a good way to indicate the synced request outcome.


406-409: Improved documentation on async loading.
These lines adequately describe how the async call works. The mention of both success and error callbacks is helpful.


420-420: Consistency in examples.
All examples follow a similar pattern across the file, which is good for new users. Keep them consistent in style with the rest of the docs.

Also applies to: 423-425

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

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[DOC] Migrate the mxGraph Tutorial

1 participant