Skip to content

Commit

Permalink
#7 enable GURU_CONVERT_MARKDOWN
Browse files Browse the repository at this point in the history
  • Loading branch information
peckjon committed Apr 6, 2021
1 parent 93fcbef commit f068558
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ Here is a PDF embed: <iframe src="../Assets/somedoc.pdf"></iframe>
- You cannot use both the `_DIR` and the `_YAML` way of configuring the same entity type. E.g., if you set both `GURU_CARD_DIR` and `GURU_CARD_YAML`, then `GURU_CARD_DIR` will be ignored.
- Although the ([Guru documentation](https://developer.getguru.com/docs/guru-sync-manual-api)) requires an ExternalId and ExternalUrl for most items, you can choose to omit them here for **cards** only; the action can auto-generate these properties for you.
- "Synchronized" collections take a few minutes to finish; you can check their status at `https://api.getguru.com/api/v1/import/JOBID/status`, where JOBID is the "jobId" shown at the end of the `peckjon/github-to-guru@master` step in your workflow's execution log.
- Guru automatically converts Markdown to HTML, but there are some [known issues](https://github.com/peckjon/github-to-guru/issues/7) with the conversion. To preconvert Markdown files using [markdown-it](https://www.npmjs.com/package/markdown-it), set the env `GURU_CONVERT_MARKDOWN` to `true` in your workflow.
- Guru automatically converts Markdown to HTML, but there are some [known issues](https://github.com/peckjon/github-to-guru/issues/7) with the conversion. To preconvert Markdown files using [markdown-it](https://www.npmjs.com/package/markdown-it), set the env `GURU_CONVERT_MARKDOWN` to `1` in your workflow.

### Appendix: creating a synchronized collection

Expand Down
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ function copyCardData(tmpCardsDir) {
tmpfileBase+=`_`;
}
console.log(`Writing ${cardFilename.replace(/\.md$/gi,'')} to ${tmpCardsDir}/${tmpfileBase}.yaml`);
if(process.env.GURU_CONVERT_MARKDOWN) {
if(process.env.GURU_CONVERT_MARKDOWN>0) {
var mdcontent = fs.readFileSync(cardFilename);
mdcontent += cardFooter.replace('__CARDPATH__',encodeURIComponent(cardFilename));
fs.writeFileSync(`${tmpCardsDir}/${tmpfileBase}.html`, markdownit.render(mdcontent))
Expand Down Expand Up @@ -273,7 +273,7 @@ function processStandardCollection(auth) {
if(process.env.GURU_CARD_DIR) {
core.setFailed("GURU_CARD_DIR is only supported for EXTERNAL collections: https://developer.getguru.com/docs/guru-sync-manual-api");
return;
} else if(process.env.GURU_CONVERT_MARKDOWN) {
} else if(process.env.GURU_CONVERT_MARKDOWN>0) {
core.setFailed("GURU_CONVERT_MARKDOWN is only supported for EXTERNAL collections: https://developer.getguru.com/docs/guru-sync-manual-api");
return;
} else {
Expand Down

0 comments on commit f068558

Please sign in to comment.