Code Monkey home page Code Monkey logo

Comments (8)

jakewvincent avatar jakewvincent commented on May 16, 2024 1

@trev-dev can you try this out on the dev branch and see if this is working as expected? If you're using Packer, you'd do the following. You'll need to stipulate an implicit extension in order to get this working, so assuming you're working with markdown files, you'd do:

use({
    'jakewvincent/mkdnflow.nvim',
    branch = 'dev',
    config = function()
        require('mkdnflow').setup({
            -- ...
            links = {
                implicit_extension = 'md'
            }
            -- ...
        })
    end
})

from mkdnflow.nvim.

jakewvincent avatar jakewvincent commented on May 16, 2024

This is reasonable! My current thought is to create a links table that will contain settings for both the link style (currently its own config option) and implicit extension:

require('mkdnflow').setup({
    links = {
        style = 'markdown',
        implicit_extension = 'md'
    }
})

I think rather than disabling interpretation of implicit extensions by default, it would be nice for the default behavior to be flexible--if there's no extension, the link is interpreted with an implicit extension... if there is, that's taken to be an explicit extension without issue. I'll try this out right now.

from mkdnflow.nvim.

jakewvincent avatar jakewvincent commented on May 16, 2024

I guess even if interpretation is flexible, there's the question of whether links should be created with or without extensions by default. That should probably be a config option. I'm not sure what most static site generators expect, but I believe Jekyll at least expects an explicit .md extension. Which static site generator are you using? Any idea what's most common?

from mkdnflow.nvim.

trev-dev avatar trev-dev commented on May 16, 2024

I'm using Hugo, and the question of how to get its parser to drop the .md had been asked a few times and has gone unanswered. I had considered some other option such as pelican but I wanted to use something closer to GoLang because learning.

from mkdnflow.nvim.

jakewvincent avatar jakewvincent commented on May 16, 2024

or sorry, I meant any idea which behavior is most common when it comes to static site generators? Do you know if most tend not to expect an extension?

(I almost have this ready for testing, btw)

from mkdnflow.nvim.

trev-dev avatar trev-dev commented on May 16, 2024

or sorry, I meant any idea which behavior is most common when it comes to static site generators? Do you know if most tend not to expect an extension?

(I almost have this ready for testing, btw)

I have only used Pelican & Hugo in terms of static site generators that are not just my fingers and a text editor. I assume (bad!) that the expected behavior is to link to the expected generated route somehow, be it explicitly or via some route generator filter/method/function.

Hugo is interesting in that I may make relative links to content. As such, the extension itself is the only thing standing in my way...and I won't have to double-up on work or give up working links in one place or another.

can you try this out on the dev branch and see if this is working as expected?

Yes!

from mkdnflow.nvim.

jakewvincent avatar jakewvincent commented on May 16, 2024

[Note for self] Anchors within a link's source are currently only interpreted correctly if the .md extension is explicit. e.g. the following attempts to open a file document.mdanchor.md instead of opening document.md and trying to find a heading matching # Anchor within that document.

[Link name](document#anchor)

from mkdnflow.nvim.

jakewvincent avatar jakewvincent commented on May 16, 2024

Addressed above comment in commit 0c305cb (currently in dev branch)

from mkdnflow.nvim.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.