Skip to main content
All CollectionsCapable for Confluence Docs
Using the Diff Macro in Confluence
Using the Diff Macro in Confluence

Compare differences between two pieces of text or code on your Confluence pages using the Diff Macro

Updated over a week ago

The Diff Macro in Capable for Confluence is a powerful tool that allows you to compare two pieces of text or code side-by-side, highlighting the differences between them.

This feature is incredibly useful for teams that need to review changes in code, documents, or any other text-based content. By visually displaying the differences, the Diff Macro makes it easier to spot changes, review edits, and ensure accuracy in collaborative environments:

  • Bug Retrospectives: Imagine your team has just resolved a bug in the codebase. Using the Diff Macro, you can compare the pre- and post-fix versions of the code to pinpoint what caused the issue and how it was fixed. This visual comparison is extremely helpful for learning from mistakes and improving future coding practices.

  • Documentation Updates: When updating documentation, the Diff Macro allows you to compare the old and new versions side-by-side. This makes it easy to ensure that all necessary updates have been made and helps avoid missing important changes.

  • Project Revisions: If a project involves multiple rounds of revisions, the Diff Macro can help track changes over time, providing a clear view of how the content has evolved.

Showcase

Why Use the Diff Macro?

  • Streamlined Code Reviews: When working with code, it's essential to see what has been added, removed, or modified. The Diff Macro highlights these changes clearly, allowing for quick and effective code reviews.

  • Document Revisions: If you're editing documents collaboratively, the Diff Macro can help you track changes made by different team members, making it easier to consolidate edits and ensure that nothing is overlooked.

  • Bug Retrospectives: When conducting a retrospective on a bug, the Diff Macro is invaluable for comparing the code before and after the bug fix. It helps the team understand what went wrong and how it was resolved, aiding in learning and preventing future issues.

  • Writing Documentation: Use the Diff Macro to compare different versions of documentation, ensuring that updates are accurately reflected and any significant changes are clearly communicated.

  • Change Tracking: The macro is ideal for comparing different versions of any text-based content, ensuring that all changes are accounted for before finalizing a document or piece of code.

How to Use the Diff Macro

  1. Insert the Diff Macro

    • Edit the Confluence page where you want to display the comparison.

    • Use the "Insert" button or type / to bring up the macro browser.

    • Search for and select the "Diff" macro from the list.
      โ€‹

  2. Configure the Text or Code to Compare

    • After inserting the macro, you'll be presented with two fields: Before and After.

    • In the Before field, paste the original version of the text or code you want to compare.

    • In the After field, paste the modified version.

    • The Diff Macro will automatically highlight the differences between the two versions. Additions, deletions, and changes will be clearly marked, making it easy to review the modifications.
      โ€‹

  3. Visualize the Differences

    • The Diff Macro displays the two versions side-by-side, with differences highlighted in colors. For example, additions might be shown in green, while deletions appear in red, as shown in the attached screenshot.

    • This side-by-side view allows you to easily compare the versions and understand exactly what has been changed.

  4. Save and Share

    • Once you have configured the Diff Macro and reviewed the differences, save your Confluence page.

    • The comparison will be available for anyone viewing the page, making it an excellent tool for collaborative reviews and discussions.

Tips for Effective Use

  • Multiple Revisions: Use the Diff Macro to compare different versions of a document or codebase over time, ensuring that each change is tracked and reviewed.

  • Collaborative Editing: Share the page with your team to get feedback on the changes. The visual highlights make it easier for everyone to understand what has been altered.

  • Error Checking: Before finalizing a document or piece of code, use the Diff Macro to ensure that no unintended changes have been made.

By incorporating the Diff Macro into your Confluence workflow, you can enhance collaboration, streamline reviews, and ensure that all changes are carefully tracked and reviewed. Whether you're a developer, editor, project manager, or part of a QA team, this tool can significantly improve the way you manage and review text and code changes on your Confluence pages.

Did this answer your question?