Coder Social home page Coder Social logo

cosmere's People

Contributors

chrisjenks14 avatar dependabot[bot] avatar entrofi avatar eszti avatar fetzi avatar jormar avatar mihaeu avatar rion18 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

cosmere's Issues

Horizontal lines not supported?

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

CDATA fails

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

collapsible code blocks

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.

AggregateError

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!

Document which version of Markdown is supported

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.

Title extraction: newlines captured

▶  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.

Code blocks break <details> rendering

Bug Description

Within a details block, rendering of code blocks seems to be broken. Adding an empty line after the opening block breaks the rendering.

How to Reproduce

Works

Input

<details>
<summary>Click here to see build profile </summary>
```xml
<test />
```
</details>

Output

<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
&lt;test /&gt;</code></p>
</ac:rich-text-body></ac:structured-macro>

Broken

Input

(newline after xml codefences

<details>
<summary>Click here to see build profile </summary>
```xml

<test />
```
</details>

Output

<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>&lt;test /&gt;</code></p>
</ac:rich-text-body></ac:structured-macro>

Allow usage of `./path` paths

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'

Add support for include/exclude options

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.

Cosmere crashes with `TypeError: Cannot read property 'filter' of undefined`

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.

Print relative paths

Logs end up being very long, because absolute paths are used instead of relative ones.

Axios error in 0.17.0

It seems that the 0.17.0 version is not uploading attachments to Confluence. Maybe we can revert the change introduced in

eee00c6
368380e

where, instead of deleting the files at the end of the process, it was changed to delete the file PER attachment call

Document that the base url needs the API base url

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",

Add support for Atlassian access tokens

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.

Add link to original document

Problem

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}"
}

New Version

Hello, @mihaeu! Thanks for the cool project :)

Are there any plans to release a new version?

We are trying to use your product, but there are some issues:

  1. #4
  2. #32
  3. #34
  4. #47

Anchors don't work in Confluence

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>

Images in numbered and bulleted lists are not displayed

Hello!
Images in numbered and bulleted lists are not displayed in Confluence.

How to Reproduce

Example 1 (numbered list):

1. Click **Show Filter** - the form will change appearance:

   &ensp; <sup>*Search by criteria*</sup>
   <br/>
   ![Search by criteria](./media/criteria_search.png)

In Confluence it looks like this:

image

Example 2 (bulleted list):

- The **Composition** tab of the order contains the following information:

  &ensp; <sup>*Tab "Order Composition"*</sup>
  <br/>
  ![Tab "Order Composition"](./media/order_composition.png)

In Confluence it looks like this:

image

HTML alphanumeric values breaking local - remote equality check

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(/&#39;/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 &ndash;, &ldquo; 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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.