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

[FEAT] Link to API docs from markdown guides #2474

Closed
Tracked by #1925
griest024 opened this issue Jun 15, 2023 · 5 comments · Fixed by #2964
Closed
Tracked by #1925

[FEAT] Link to API docs from markdown guides #2474

griest024 opened this issue Jun 15, 2023 · 5 comments · Fixed by #2964
Assignees
Labels
docs This issue is related to documentation feat a new feature, enhancement, or improvement hacktoberfest This PR or issue is related to Hacktoberfest p2 medium priority tools: dgeni @daffodil/tools-dgeni
Milestone

Comments

@griest024
Copy link
Member

griest024 commented Jun 15, 2023

💡 Feature request

Feature Name

Link to API docs from markdown

The Desired Behavior

@daffodil/tools-dgeni replaces exported symbol links in markdown with daff.io links.

Your Use Case

As a daffodil dev, I want to be able to write API symbols in markdown files and have these replaced by the appropriate daff.io link to the symbol.

Prior Work

dgeni will currently correctly transform links of the form /libs/<package>/<symbol> but this is rather cumbersome. Ideally any public API symbol written in code blocks would be transformed to the appropraite link.

@griest024 griest024 added feat a new feature, enhancement, or improvement tools: dgeni @daffodil/tools-dgeni labels Jun 15, 2023
@griest024
Copy link
Member Author

@hanmangokiwi is this something you're interested in tackling?

@shadow0500
Copy link

@griest024 you can use this approach

import { Dgeni, Plugin } from '@daffodil/tools-dgeni';

export class LinkToApiDocsPlugin implements Plugin {

  constructor(dgeni: Dgeni) {
    super(dgeni);

    // Register a processor that will replace links to symbols with links to daff.io.
    const linkToApiDocsProcessor = (doc: Document, node: Node) => {
      if (node.type === 'link' && node.attributes['href'].startsWith('daffodil')) {
        // Replace the link with the daff.io link for the symbol.
        node.attributes['href'] = `https://daff.io/docs/${node.attributes['href']}`;
      }
    };

    dgeni.addProcessor('linkToApiDocs', linkToApiDocsProcessor);
  }
}

@xelaint xelaint added the hacktoberfest This PR or issue is related to Hacktoberfest label Sep 20, 2023
@xelaint xelaint added the docs This issue is related to documentation label Nov 30, 2023
@AnnieMi888 AnnieMi888 added the p2 medium priority label Nov 30, 2023
@AnnieMi888 AnnieMi888 added this to the Daffodil v1.0 milestone Nov 30, 2023
@xelaint
Copy link
Member

xelaint commented Jun 11, 2024

@griest024 is this still relevant?

@griest024
Copy link
Member Author

Yes. Many times we will need to link to API symbols in docs (guides and other API docs). These links should be clickable and navigate to the relevant page of the API docs

@xelaint xelaint mentioned this issue Jun 11, 2024
26 tasks
@griest024 griest024 changed the title [FEAT] Link to API docs from markdown [FEAT] Link to API docs from markdown guides Jun 13, 2024
@griest024
Copy link
Member Author

this can be supported with a slightly goofy /libs/<package>/<symbol> syntax. It would be cool to have code blocks that match any API symbol to automatically get replaced with the link but that requires some interpackage dgeni deps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs This issue is related to documentation feat a new feature, enhancement, or improvement hacktoberfest This PR or issue is related to Hacktoberfest p2 medium priority tools: dgeni @daffodil/tools-dgeni
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants