mihaeu / cosmere Goto Github PK
View Code? Open in Web Editor NEWSync your markdown files to Confluence
Home Page: https://mihaeu.github.io/cosmere/
License: MIT License
Sync your markdown files to Confluence
Home Page: https://mihaeu.github.io/cosmere/
License: MIT License
Hello!
While using cosmere I'm getting this error:
× fatal AggregateError
at AxiosError.from (<pathToNpm>\npm\node_modules\cosmere\node_modules\axios\dist\node\axios.cjs:836:14)
at RedirectableRequest.handleRequestError (<pathToNpm>\npm\node_modules\cosmere\node_modules\axios\dist\node\axios.cjs:3086:25)
at RedirectableRequest.emit (node:events:518:28)
at eventHandlers.<computed> (<pathToNpm>\npm\node_modules\cosmere\node_modules\follow-redirects\index.js:38:24)
at ClientRequest.emit (node:events:518:28)
at Socket.socketErrorListener (node:_http_client:500:9)
at Socket.emit (node:events:518:28)
at emitErrorNT (node:internal/streams/destroy:169:8)
at emitErrorCloseNT (node:internal/streams/destroy:128:3)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
at Axios.request (<pathToNpm>\npm\node_modules\cosmere\node_modules\axios\dist\node\axios.cjs:3876:41)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async ConfluenceAPI.getAttachments (<pathToNpm>\npm\node_modules\cosmere\dist\src\api\ConfluenceAPI.js:56:17)
at async updateAttachments (<pathToNpm>\npm\node_modules\cosmere\dist\src\UpdatePage.js:120:32)
at async updatePage (<pathToNpm>\npm\node_modules\cosmere\dist\src\UpdatePage.js:186:18)
at async Object.default_1 [as default] (<pathToNpm>\npm\node_modules\cosmere\dist\src\cli\MainCommand.js:10:9)
can you please support?
Thx!
Hi,
if I add CDATA in an xml code snippet like
<notes><![CDATA[file name: snakeyaml-1.33.jar]]></notes>
then it fails with a 400
… awaiting First attempt failed, retrying ...
✖ fatal Error: Request failed with status code 400
at createError (/builds/catalyst/documentation/node_modules/axios/lib/core/createError.js:16:15)
at settle (/builds/catalyst/documentation/node_modules/axios/lib/core/settle.js:17:12)
at IncomingMessage.handleStreamEnd (/builds/catalyst/documentation/node_modules/axios/lib/adapters/http.js:269:11)
at IncomingMessage.emit (events.js:412:35)
at endReadableNT (internal/streams/readable.js:1317:12)
at processTicksAndRejections (internal/process/task_queues.js:82:21)
error Command failed with exit code 1.
see cdata-in-xml.md
Logs end up being very long, because absolute paths are used instead of relative ones.
I've just been trying out your tool, and so far I like it :) Though during setup I came across a small bit that was not documented.
When talking about the config file you state:
"baseUrl": "YOUR_BASE_URL",
I interpreted it as being https://confluence.myOrganization.com
. A bit later I found out it should be https://confluence.myOrganization.com/rest/api
.
The solution is probably as simple as replacing the line above with
"baseUrl": "YOUR_BASE_URL/rest/api",
▶ start Starting to render "README.md"
… awaiting Deleting attachment "example.png" ...
… awaiting Uploading attachment "example.png" for "example
" ...
… awaiting Fetch current page for "example
" ...
✔ success No change in remote version for "README.md" detected, no update necessary
Done in 2.80s.
example does not resolve
Hello!
If possible, please implement a setting in cosmere.json to be able to compare the current document with a document already rendered in Confluence. And if both documents are the same, then stop rendering for the current document.
Within a details block, rendering of code blocks seems to be broken. Adding an empty line after the opening block breaks the rendering.
<details>
<summary>Click here to see build profile </summary>
```xml
<test />
```
</details>
<ac:structured-macro ac:name="expand"><ac:parameter ac:name="title">Click here to see build profile </ac:parameter><ac:rich-text-body><p><code>xml
<test /></code></p>
</ac:rich-text-body></ac:structured-macro>
(newline after xml codefences
<details>
<summary>Click here to see build profile </summary>
```xml
<test />
```
</details>
<ac:structured-macro ac:name="expand"><ac:parameter ac:name="title">Click here to see build profile </ac:parameter><ac:rich-text-body><p><code>xml</p>
<p><test /></code></p>
</ac:rich-text-body></ac:structured-macro>
Use e.g. https://github.com/jonschlinkert/markdown-toc to generate a table of contents in markdown and then convert to confluence as usual.
Or create the option to generate a table of contents from your config file and save that to a separate page.
I'd like to configure that my code blocks are collapsible because my code blocks become very large.
For instance in the config.json
"collapsible": true
makes all code blocks collapsible.
I would like to add options to the configuration file include/exclude that allowed you to specify a set of globs to scan for markdown files (similar to the way include/exclude work in TypeScript's configuration files).
If a file is found, we would read the YAML frontmatter at the start of the document and used that to obtain the pageId/title values.
We have a large monorepo and avoiding having a central list of documents would be nice to have. Admittedly, we could generate the pages list on the fly during the build if we had to, so I understand if you aren't interested in this feature.
That being said, I'm happy to do the work for it -- I just want to make sure you're open to the PR before I start on it.
Example:
This is an example:
* test
git clone https://github.com/<GROUP>/<PROJECT>
It's been a while since I've used Cosmere, so I just upgraded to v0.16.0 of Cosmere and it now crashes when running npx cosmere
:
$ npx cosmere
▶ start Starting to render "posts/test.md"
✖ fatal TypeError: Cannot read property 'filter' of undefined
My cosmere.json
:
{
"baseUrl": "<BASE_URL>",
"personalAccessToken": "<TOKEN>",
"cachePath": "build",
"prefix": "This blog post was automatically converted from Markdown. For comments please use the comment section below as inline comments will get lost when re-uploading",
"pages": [
{
"pageId": "<POST_ID>",
"file": "posts/test.md",
"title": "Test"
}
]
}
The file posts/test.md
is empty but the same error occurs with any other file I've tried.
Currently attachments are always being uploaded, regardless if it's necessary.
Instead of sending username / password, I would like be able to send an Authorization: Bearer <my token>
HTTP header to https://<confluence url>/rest/api
as basic HTTP auth is getting disabled in more and more Confluence setups these days.
I've been using cosmere
as part of a CICD pipeline, and experienced an unexplained issue: every time I'd be notified of changes in a document that, upon inspection, had no changes at all. This would happen in several documents, and comparing document versions in Confluence yielded no visible changes.
After tinkering and debugging, I'm positive this is due to html characters breaking the equality check here:
Line 48, src/UpdatePage.ts
function isRemoteUpdateRequired(newContent: string, confluencePage: any): boolean {
const local = removeDynamicIds(newContent).trim().replace(/'/g, "'");
const remote = removeDynamicIds(confluencePage.body.storage.value).trim();
return local !== remote;
}
As you can see, the replace is only covering single quotes. However, any other HTML symbol is ignored, and as such it's interpreted as a different document, hence being re-uploaded. I've experienced this with other symbols such as –
, “
and many others. Also, line breaks are showing as <br/>
locally and <br />
remotely (note the whitespace).
Hopefully, a more thorough logic when comparing local and remotely will help with the issue.
Add a way to specify a link to the original document in the prefix.
E.g.
{
"prefix": "This document is automatically generated. Please don't edit it directly! ${originalDocument}"
}
The following markdown caused a Error: Request failed with status code 400
when trying to sync to Confluence:
---
Thank you very much for creating this very nice project and have a lovely day
Lukas
h2. Problem
[description](./some/path/to/image.png)
Will produce errors like
✖ fatal Error: ENOENT: no such file or directory, copyfile '../images/bla.png' -> '.../dist/._images/bla.png'
Hello!
Images in numbered and bulleted lists are not displayed in Confluence.
1. Click **Show Filter** - the form will change appearance:
  <sup>*Search by criteria*</sup>
<br/>
![Search by criteria](./media/criteria_search.png)
In Confluence it looks like this:
- The **Composition** tab of the order contains the following information:
  <sup>*Tab "Order Composition"*</sup>
<br/>
![Tab "Order Composition"](./media/order_composition.png)
In Confluence it looks like this:
Could you possibly mention in the README which version of Markdown is supported? For instance, I noticed that strike-through is available (~~foo~~
) even though it's not part of the official Markdown spec.
Example in Markdown:
# Cosmere Test Child-Page
[Anchor Test](#target)
## h2
### h3
#### Target
## h2 2
### h3 2
#### Target
Is rendered as:
<p><a href="#target">Anchor Test</a></p>
<h2 id="h2">h2</h2>
<h3 id="h3">h3</h3>
<h4 id="target">Target</h4>
<h2 id="h2-2">h2 2</h2>
<h3 id="h3-2">h3 2</h3>
<h4 id="target">Target</h4>
But Confluence generates the following headers:
<h2 id="CosmereTestChildPage-h2">h2</h2>
<h3 id="CosmereTestChildPage-h3">h3</h3>
<h4 id="CosmereTestChildPage-Target">Target</h4>
<h2 id="CosmereTestChildPage-h22">h2 2</h2>
<h3 id="CosmereTestChildPage-h32">h3 2</h3>
<h4 id="CosmereTestChildPage-Target.1">Target</h4>
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.