Closed khaosdoctor closed 4 years ago
This is "normal" as colon have a special meaning in yaml, your title your be enclosed in quotes in that case, and it should run fine.
Maybe dev.to online editor is more lenient and its yaml parser can recover from that, but gre-matter
uses js-yaml
under the hood which only accepts proper yaml.
Yes, but I can't enclose it on quotes because when I pull it just ignores them... Do I have to update it on dev.to?
I tried to pre enclose it with quoting before parsing, however, it seemed to have no effect (this test is in the REPL).
I have a title that includes quotes curerntly on dev.to, and have no issue with devto i --pull
.
This is my prop:
title: "Build your first serverless app with Angular, NestJS and Azure"
You should make the change on dev.to platform before trying to import your articles in the CLI tool, that should fix your issue.
I was testing with the command:
devto init --pull -t <token>
but it crashes when the article title has colons, like this image:I did some research and it seems that this problem happens with Gray Matter. Specifically in line 54 of
article.js
https://github.com/sinedied/devto-cli/blob/1d447d91d8e9f22df58a18cfe8c29dbad9b5974c/lib/article.js#L54
For some reason, it is not treating correctly the colon, so I tried to put this regex:
data.body_markdown.replace(/(?<=title\:\s)(.*)?/gmi,
'$1')
, which puts every text inside quotes intitle:
, this way js-yaml can parse it right, however, it also did not work.I tried to replicate the issue in this Repl (feel free to test it) and it worked, so I believe it's something related to how the articles are being sent to the
getArticleFromRemoteData
function.Sorry I couldn't solve this