You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The error is in the directive RAML.Directives.rootDocumentation in root-documentation.js
Consider the following code containing CR+LF (\r\n) at the end of lines:
#%RAML 0.8
---
title: Cool REST APIbaseUri: http://example.com/apiversion: v1documentation:
- title: Getting startedcontent: | # Welcome to our cool API With our API you can cast magic!
If the string in content node is # Welcome to our cool API\r\n, i.e. formatted in Windows, then function getDocumentationContent() splitting content node to lines will get the first line as:
varlines=["#Welcome to our cool API\r","","With our API you can cast magic!"];// \r is invisible in debugger, and it seems strange why getting "identical" string in array with indexOf() fails
after splitting the content node in function getDocumentationContent(). At the same time the function getMarkdownHeaders() keeps the same string in headers as
// we get header from content as: var headers = content.match(/^#+\s(.*)$/gim);varselected="#Welcome to our cool API";// there is no \r at the end.
then in getDocumentationContent we try to match these string with:
varindex=lines.indexOf(selected);//and we get index=-1 because of invisible \r at the end of lines[0]
I think this is the reason.
The text was updated successfully, but these errors were encountered:
The error is in the directive RAML.Directives.rootDocumentation in root-documentation.js
Consider the following code containing CR+LF (
\r\n
) at the end of lines:If the string in
content
node is# Welcome to our cool API\r\n
, i.e. formatted in Windows, then functiongetDocumentationContent()
splittingcontent
node to lines will get the first line as:after splitting the
content
node in functiongetDocumentationContent()
. At the same time the functiongetMarkdownHeaders()
keeps the same string in headers asthen in
getDocumentationContent
we try to match these string with:I think this is the reason.
The text was updated successfully, but these errors were encountered: