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

Generate internal links to notes #32

Merged
merged 6 commits into from
Apr 18, 2021
Merged

Generate internal links to notes #32

merged 6 commits into from
Apr 18, 2021

Conversation

mickael-menu
Copy link
Member

@mickael-menu mickael-menu commented Apr 18, 2021

  • Customize the link format from the note formats settings. You can for example choose regular Markdown links, Wiki-links or a custom format.
    [format.markdown]
    # Format used to generate links between notes.
    # Either "wiki", "markdown" or a custom template. Default is "markdown".
    link-format = "wiki"
    # Indicates whether a link's path will be percent-encoded.
    link-encode-path = false
    # Indicates whether a link's path file extension will be removed.
    link-drop-extension = true
  • Use the {{link}} template variable when formatting notes to print a link to the note, relative to the working directory.
    $ zk list --format "* {{link}}"
    * [Note formats](note-format.md)
    * [Searching and filtering notes](note-filtering.md)
    * [Changelog](../CHANGELOG.md)
    ...
  • Use the {{format-link path title}} template helper to render a custom link.

@mickael-menu mickael-menu merged commit 2bb4cbd into main Apr 18, 2021
@mickael-menu mickael-menu deleted the feature/render-link branch April 18, 2021 14:37
@mickael-menu
Copy link
Member Author

@CodiumAI-Agent /review

@CodiumAI-Agent
Copy link

PR Analysis

  • 🎯 Main theme: Adding functionality to generate internal links to notes with customizable link format
  • 📌 Type of PR: Enhancement
  • 🧪 Relevant tests added: True
  • Focused PR: Yes, all changes are related to the main theme of generating and formatting internal links.
  • 🔒 Security concerns: No security concerns found

PR Feedback

  • General suggestions: The PR is well-structured and focused, with clear commit messages. The added functionality is well-tested and the code is clean and follows good practices. However, there are a few areas where the code could be improved for better readability and maintainability.

  • 🤖 Code feedback:

    • relevant file: internal/core/link_format_test.go
      suggestion: Consider refactoring the test functions to reduce code duplication. The newTester function is used multiple times with similar logic. You could create a helper function that takes the necessary parameters and returns a test function. [medium]
      relevant line: func TestMarkdownLinkFormatter(t *testing.T) {

    • relevant file: internal/core/config.go
      suggestion: The ParseConfig function is quite long and does a lot of things. Consider breaking it down into smaller, more manageable functions. This will improve readability and maintainability. [medium]
      relevant line: func ParseConfig(content []byte, path string, parentConfig Config) (Config, error) {

    • relevant file: internal/core/note_format.go
      suggestion: The newNoteFormatter function now takes a linkFormatter as a parameter. This increases the function's complexity and makes it harder to test. Consider refactoring the code to avoid passing the linkFormatter as a parameter. [medium]
      relevant line: func newNoteFormatter(basePath string, template Template, linkFormatter LinkFormatter, fs FileStorage) (NoteFormatter, error) {

How to use

Tag me in a comment '@CodiumAI-Agent' and add one of the following commands:
/review [-i]: Request a review of your Pull Request. For an incremental review, which only considers changes since the last review, include the '-i' option.
/describe: Modify the PR title and description based on the contents of the PR.
/improve: Suggest improvements to the code in the PR.
/ask <QUESTION>: Pose a question about the PR.

To edit any configuration parameter from 'configuration.toml', add --config_path=new_value
For example: /review --pr_reviewer.extra_instructions="focus on the file: ..."
To list the possible configuration parameters, use the /config command.

@mickael-menu
Copy link
Member Author

@CodiumAI-Agent /describe

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.

2 participants