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

Can't see source code link when using linkcode #421

Closed
msalvaris opened this issue Dec 31, 2020 · 4 comments
Closed

Can't see source code link when using linkcode #421

msalvaris opened this issue Dec 31, 2020 · 4 comments
Labels
question A generic inquiry

Comments

@msalvaris
Copy link

I have configured sphinx to use linkcode and can see the links in the html output but can't see the links when publishing to confluence. Is there a configuration option I am missing or is it simply can't use linkcode with confluencebuilder?

@jdknight jdknight added the question A generic inquiry label Dec 31, 2020
@jdknight
Copy link
Member

@msalvaris, unfortunately it is not possible at this time.

Sphinx internal extension sphinx.ext.linkcode (as well as sphinx.ext.viewcode extension) only support injecting nodes into html format documentation. Support for these extensions could be added in the future; however, it will first require submitting changes on these extensions before the confluencebuilder extension can take advantage of them.

While the above is possibly the "right" way to do this, support for these extension would then only work on the next release of the Sphinx engine (assuming changes are accepted). Since the linkcode implementation seems small enough, some level of backwards compatibility could be added to the confluencebuilder extension --but more investigation would be required here.

@msalvaris
Copy link
Author

Thanks for the super prompt reply @jdknight!
Good to know that it isn't due to me having misconfigured something.

@SajadAzami
Copy link

Hey @jdknight, is there any update on this extension? I'd be interested in contributing to enable this extension if it's not available yet and if you can give me some pointers to start with.

@jdknight
Copy link
Member

Hey @jdknight, is there any update on this extension? I'd be interested in contributing to enable this extension if it's not available yet and if you can give me some pointers to start with.

@SajadAzami, there maybe nothing that the confluencebuilder extension could do at this time to support the sphinx.ext.linkcode extension. If you are interested in proposing a change to the sphinx.ext.linkcode itself, the best starting point would be to look at how the extension builds its reference nodes, where the following filter html is applied:

def doctree_read(app: Sphinx, doctree: Node) -> None:
    ...
            onlynode = addnodes.only(expr='html')

If the filter was changed, for demonstration purposes, to confluence, a user would be able to see generated links for defined object descriptions in their Confluence documentation:

def doctree_read(app: Sphinx, doctree: Node) -> None:
    ...
            onlynode = addnodes.only(expr='confluence')

Next would be trying to find a solution to work for existing html format builders and extensions that wish to explicitly support the use of this extension. What the best way to do this would be best decided by the Sphinx team. The following shows a proposed approach to the matter; however, such a change would require submitting and having the implementation reviewed/approved by a member of the Sphinx team (assuming they would desire such a change).

A partial/possible way would be to emulate some of the implementation found inside sphinx.ext.viewcode which defines an is_supported_builder function. If such a function existed inside sphinx.ext.linkcode and is also somehow modified to allow a third-party extension to register itself as one that could support the extension, then the confluencebuilder extension (and other extensions) could register itself during initialization to hint to generated desired reference nodes. If such a concept works inside the Sphinx implementation, the same modifications may also be introduced inside sphinx.ext.viewcode, which in turn this extension could possibly take advantage of it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question A generic inquiry
Projects
None yet
Development

No branches or pull requests

3 participants