{"id":13847235,"url":"https://github.com/mihaeu/cosmere","last_synced_at":"2025-08-15T20:31:22.853Z","repository":{"id":39421532,"uuid":"228903476","full_name":"mihaeu/cosmere","owner":"mihaeu","description":"Sync your markdown files to Confluence","archived":false,"fork":false,"pushed_at":"2024-06-16T10:19:58.000Z","size":672,"stargazers_count":39,"open_issues_count":18,"forks_count":10,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-08-09T03:45:51.266Z","etag":null,"topics":["confluence","converter","doc","markdown","md"],"latest_commit_sha":null,"homepage":"https://mihaeu.github.io/cosmere/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mihaeu.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-12-18T18:59:37.000Z","updated_at":"2025-07-03T16:19:31.000Z","dependencies_parsed_at":"2024-01-15T20:49:07.244Z","dependency_job_id":"6c9b4dd2-5788-4b9b-a029-33372bf54cf6","html_url":"https://github.com/mihaeu/cosmere","commit_stats":{"total_commits":120,"total_committers":8,"mean_commits":15.0,"dds":0.3666666666666667,"last_synced_commit":"87ce29e4c777037eaa6270cb1b13a286fcea810f"},"previous_names":[],"tags_count":21,"template":false,"template_full_name":null,"purl":"pkg:github/mihaeu/cosmere","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mihaeu%2Fcosmere","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mihaeu%2Fcosmere/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mihaeu%2Fcosmere/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mihaeu%2Fcosmere/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mihaeu","download_url":"https://codeload.github.com/mihaeu/cosmere/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mihaeu%2Fcosmere/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269689746,"owners_count":24459705,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-10T02:00:08.965Z","response_time":71,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["confluence","converter","doc","markdown","md"],"created_at":"2024-08-04T18:01:14.084Z","updated_at":"2025-08-15T20:31:22.550Z","avatar_url":"https://github.com/mihaeu.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"# Cosmere\n\nSync your markdown files to confluence.\n\n## Features\n\n-   upload new versions only when necessary\n-   upload/delete local images as attachments\n-   supports the original markdown spec and parts from [CommonMark](https://marked.js.org/#specifications) and [GitHub Flavored Markdown](https://marked.js.org/#specifications)\n-   can be used as a CLI command or in a script\n\n## Usage\n\n### Global Installation\n\n```bash\nnpm install -g cosmere\n\n# or\n\nyarn global add cosmere\n```\n\n### Library\n\n```bash\nnpm install --save-dev cosmere\n\n# or\n\nyarn add --dev cosmere\n```\n\n### Configuration\n\nTo get started generate configuration using\n\n```bash\ncosmere generate-config [--config=\u003cpath\u003e]\n```\n\nwhich produces:\n\n```json\n{\n    \"baseUrl\": \"\u003cyour base url including /rest/api\u003e\",\n    \"user\": \"\u003cyour username\u003e\",\n    \"pass\": \"\u003cyour password\u003e\",\n    \"personalAccessToken\": \"\u003cyour personal access token (can be set instead of username/password)\u003e\",\n    \"cachePath\": \"build\",\n    \"prefix\": \"This document is automatically generated. Please don't edit it directly!\",\n    \"pages\": [\n        {\n            \"pageId\": \"1234567890\",\n            \"file\": \"README.md\",\n            \"title\": \"Optional title in the confluence page, remove to use # h1 from markdown file instead\"\n        }\n    ]\n}\n```\n\n### Continuous Integration\n\nIn most scenarios it is not recommended storing your credentials in the configuration file, because you will probably add it to your VCS. Instead, it is recommended to provide the following environment variables in your build pipeline (GitLab CI, GitHub Actions, Jenkins, ...):\n\n```ini\nCONFLUENCE_USERNAME=YOUR_USERNAME\nCONFLUENCE_PASSWORD=YOUR_PASSWORD\n```\n\nor\n\n```ini\nCONFLUENCE_PERSONAL_ACCESS_TOKEN=\"\u003cyour auth token\u003e\"\n```\n\nor add it in front of the command when executing locally (add a space in front of the command when using bash in order to not write the credentials to the bash history):\n\n```bash\n CONFLUENCE_USER=YOUR_USERNAME CONFLUENCE_PASSWORD=YOUR_PASSWORD cosmere\n # or\n CONFLUENCE_PERSONAL_ACCESS_TOKEN=\"\u003cyour personal access token\u003e\" cosmere\n```\n\n### Run\n\n```bash\n# global installation\ncosmere --help\n\n# local installation with yarn\nyarn cosmere --help\n\n# local installation with npm\nnpm run cosmere --help\n\n# or plain\nnode_modules/.bin/cosmere --help\n```\n\nor create an alias:\n\n```json\n{\n    \"scripts\": {\n        \"pushdoc\": \"cosmere\"\n    }\n}\n```\n\n## Using Cosmere as a library\n\n```js\nimport cosmere from \"cosmere/dist/src/lib\";\nimport ConfluenceRenderer from \"cosmere/dist/src/ConfluenceRenderer\";\n\nclass CustomRenderer extends ConfluenceRenderer {\n    constructor(options, config, page) {\n        super(options, config, page);\n    }\n\n    image(href, title, text) {\n        if (href.startsWith(\"http\")) {\n            return `\u003cac:image ac:width=\"768px\" ac:height=\"768px\"\u003e\u003cri:url ri:value=\"${href}\" /\u003e\u003c/ac:image\u003e`;\n        }\n        return `\u003cac:image ac:width=\"768px\" ac:height=\"768px\"\u003e\u003cri:attachment ri:filename=\"${href}\" /\u003e\u003c/ac:image\u003e`;\n    }\n}\n\nconst config = {\n    baseUrl: \"\u003cyour base url including /rest/api\u003e\",\n    user: \"\u003cyour username\u003e\",\n    pass: \"\u003cyour password\u003e\",\n    cachePath: \"build\",\n    prefix: \"This document is automatically generated. Please don't edit it directly!\",\n    insecure: false,\n    force: false,\n    fileRoot: \"/usr/bin/myawesomefolder\",\n    pages: [\n        {\n            pageId: \"1234567890\",\n            file: \"README.md\", // this path will be evaluated as fileRoot + file\n            title: \"Optional title in the confluence page, remove to use # h1 from markdown file instead\",\n        },\n    ],\n    customRenderer: CustomRenderer,\n};\n\nawait cosmere(config);\n```\n\n## Troubleshooting\n\n### Custom certificates on Confluence instance\n\nUse the `--insecure` option for your `cosmere` call in order to not reject invalid certificates. This is risky, and it's preferable to get proper certificates.\n\n## Need new features?\n\nPlease, feel free to create any issues and pull request that you need.\n\n## Release\n\n1. Add feature/fix bugs etc.\n2. Document changes in [`CHANGELOG.md`](CHANGELOG.md) (with the new [version](https://semver.org/))\n3. Commit everything\n4. Push/merge to main\n5. Run\n    ```bash\n    yarn release\n    yarn np \u003cmajor|minor|patch\u003e\n    ```\n\n## History\n\n### md2confluence\n\nI had various scripts that stitched markdown files together and uploaded them. I forked [`md2confluence`](https://github.com/jormar/md2confluence) by [Jormar Arellano](https://github.com/jormar) and started playing around with that, but quickly noticed that many markdown files broke due to the conversion process (wiki -\u003e storage instead of directly to storage).\n\n### Cosmere\n\nThe project diverged from its original intent and so I decided to rename it. [Cosmere](https://coppermind.net/wiki/Cosmere) is the wonderful universe of various books written by [Brandon Sanderson](https://www.brandonsanderson.com/). If you are into fantasy I strongly recommend checking him out.\n\n## License\n\nSee [LICENSE](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmihaeu%2Fcosmere","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmihaeu%2Fcosmere","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmihaeu%2Fcosmere/lists"}