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

Is __resources nessesary? #372

Open
Kostov6 opened this issue Jan 13, 2025 · 0 comments
Open

Is __resources nessesary? #372

Kostov6 opened this issue Jan 13, 2025 · 0 comments
Assignees
Labels
kind/enhancement Enhancement, improvement, extension priority/3 Priority (lower number equals higher priority)

Comments

@Kostov6
Copy link
Contributor

Kostov6 commented Jan 13, 2025

What would you like to be added:
Right now referenced images are added in __resources

// download urls from referenced repositories
downloadResourceName := DownloadURLName(*resourceURL)
if err = d.downloader.Schedule(link, downloadResourceName, source); err != nil {
return link, err
}

But with #358 we can download them via that mechanism
func (d *Worker) processSource(ctx context.Context, sourceType string, source string, nodePath string) (*docContent, error) {
var dc *docContent
content, err := d.repositoryhosts.Read(ctx, source)
if err != nil {
return nil, fmt.Errorf("reading %s %s from node %s failed: %w", sourceType, source, nodePath, err)
}
dc = &docContent{docCnt: content, docURI: source}
if strings.HasSuffix(source, ".md") {
dc.docAst, err = markdown.Parse(d.markdown, content)
if err != nil {
return nil, fmt.Errorf("fail to parse %s %s from node %s: %w", sourceType, source, nodePath, err)
}
}
return dc, nil
}

if strings.HasSuffix(cnt.docURI, ".md") {
rnd := markdown.NewLinkModifierRenderer(markdown.WithLinkResolver(lrt.resolveLink))
if err := rnd.Render(b, cnt.docCnt, cnt.docAst); err != nil {
return err
}
} else {
b.Write(cnt.docCnt)
}

With this we can also drop resourcedownloader package

Why is this needed / describe a real-world scenario:
It does not seem there is a universal place for resources. For example:

How to categorize this?:

/kind enhancement
/priority 3

@Kostov6 Kostov6 added the kind/enhancement Enhancement, improvement, extension label Jan 13, 2025
@gardener-robot gardener-robot added the priority/3 Priority (lower number equals higher priority) label Jan 13, 2025
@Kostov6 Kostov6 changed the title Is '__resources' nessesary? Is __resources nessesary? Jan 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement Enhancement, improvement, extension priority/3 Priority (lower number equals higher priority)
Projects
None yet
Development

No branches or pull requests

2 participants