gitdown icon indicating copy to clipboard operation
gitdown copied to clipboard

Bug to convert title with number format

Open phan0041 opened this issue 5 years ago • 5 comments

In file: gitdown/src/gitdown.js Line 308 to 314

Source code:

// `test`
normalizedName = _.trim(marked(normalizedName));

// <p><code>test</code></p>
normalizedName = normalizedName.slice(3, -4);

// <code>test</code>

===

The conversion is incorrect if the title like this: 1. Title one Raw markdown: ## 1. Title one Expected raw output: ## 1.Title one Expected user view: 1. Title one

Actual error result:

// `1. Title one`
normalizedName = _.trim(marked(normalizedName));

// <ol>\n<li>1. Title one</li>\n</ol>
normalizedName = normalizedName.slice(3, -4);

// >\n<li>Title one</li>\n<

===

phan0041 avatar Aug 24 '20 16:08 phan0041

@phan0041 I read this a few times, but I am still not sure what the bug is.

It is always handy to have: what you tried to do, what you were expecting, and what happened instead.

Either way, I will fast track merging and releasing bug fixes if there are any.

gajus avatar Aug 24 '20 18:08 gajus

@gajus Thank you for the reply.

What I tried to do: use gitdown.js to create a heading title with number like this: 1. Importing CDN Extension NuGet Package

What I put inside the source code:

## 1. Importing CDN Extension NuGet Package

What I expect:

## 1. Importing CDN Extension NuGet Package

The actual result:

## >
<li>Importing CDN Extension NuGet Package</li>
<

Sample file: https://github.com/Azure/portaldocs/blob/master/portal-sdk/generated/portalfx-pde-cdn.md

phan0041 avatar Aug 24 '20 18:08 phan0041

Where is the source file for https://github.com/Azure/portaldocs/blob/master/portal-sdk/generated/portalfx-pde-cdn.md?

gajus avatar Aug 24 '20 22:08 gajus

The source file is located in the private repository of company (as a confidential information). Only the generated file is shown to public.

To make a sample source file, you can put two lines of: ## 1. Importing CDN Extension NuGet Package And run gitdown.js it will produce this error. In the line 308 to 314 of file gitdown/src/gitdown.js, it does the incorrect conversion.

phan0041 avatar Aug 24 '20 22:08 phan0041

Gotcha. Well, if you end up working on a failing test case/ fix, I will prioritize addressing it.

gajus avatar Aug 25 '20 19:08 gajus