Skip to content

Commit

Permalink
Feature: Add support for GitHub integration in @webdoc/default-templa…
Browse files Browse the repository at this point in the history
…te (#169)
  • Loading branch information
ShukantPal authored Jun 9, 2022
1 parent e506e02 commit 437acf3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/webdoc-default-template/publish.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const {
Sitemap,
TemplateRenderer,
TemplatePipeline,
TemplateTagsResolver,
TemplateTagsResolver, RepositoryPlugin,
} = require("@webdoc/template-library");
const {linker, prepareLinker} = require("./helper/linker");
const _ = require("lodash");
Expand Down Expand Up @@ -129,6 +129,10 @@ exports.publish = async function publish(options /*: PublishOptions */) {
},
variant: config.template.variant,
});
if (config.template.repository) {
renderer.installPlugin("repository", RepositoryPlugin);
renderer.plugins.repository.buildRepository(config.template.repository);
}

const pipeline = new TemplatePipeline(renderer).pipe(new TemplateTagsResolver());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,13 @@ const modifiers = [
</span>
<?js if (source && sources) { ?>
<span class="tag--source">
<?js if (this.plugins.repository) { ?>
<?js= this.plugins.repository.linkTo(doc) ?>
<?js } else { ?>
<a href="<?js= source + sourceLinkFragment ?>">
<?js= sourceName + sourceStart ?>
</a>
<?js } ?>
</span>
<?js } ?>
</section>
Expand Down

0 comments on commit 437acf3

Please sign in to comment.