Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

abbr not supported in markdown #73

Closed
oupala opened this issue Apr 15, 2016 · 29 comments
Closed

abbr not supported in markdown #73

oupala opened this issue Apr 15, 2016 · 29 comments

Comments

@oupala
Copy link

oupala commented Apr 15, 2016

markdown has been recently added as a new feature of this theme, it works well and is a pleasure to use.

Unfortunately, the markdown parser does not support the abbr, which identified as a bug in marked: markedjs/marked#27

The issue suggest to use another markdown parser known as markdown-it: markdown-it.

I let you decide what to do.

@mudassir0909
Copy link
Owner

oh, I didn't know about this, my reply would be same as here :)

mudassir0909 added a commit that referenced this issue May 3, 2016
@oupala
Copy link
Author

oupala commented May 4, 2016

@mudassir0909 it seems that you closed the issue a bit too fast!

I tried to use abbr, but I did not succeeded due to some limitations. Let me explain them.

First, I think that each string is parsed from markdown to html separately. This means that you can't define the abbrs somewhere in the footer and use them anywhere else in the resume.

Second, my tests show that the html generated by markdown-it is escaped by the elegant jsonresume theme. It should produce the following html:

The <abbr title="Hyper Text Markup Language">HTML</abbr> specification.

but the produced html is the following:

The &lt;abbr title="Hyper Text Markup Language"&gt;HTMLspecification.

We can see that < is converted to &lt;, > to &gt;, </abbr> is stripped (including the trailing space).

abbr is not usable at this time, we should reopen this issue.

@mudassir0909
Copy link
Owner

mudassir0909 commented May 4, 2016

Well, I tested it with the following string & it worked perfectly.

 "*[HTML]: Hyper Text Markup Language.\nThe HTML specification is maintained by the W3C."

Added the above string inside the highlights array & it worked as expected

@mudassir0909 mudassir0909 reopened this May 4, 2016
@mudassir0909
Copy link
Owner

mudassir0909 commented May 4, 2016

And yes, each string is parsed separately because there is no other way to globally compile everything & put them back to where they came from. For example, work[0].highlights is an array, you can't just compile the entire array, you have to individually compile each item in the array unless you have any other idea for the same.

Also can you share what is your resume.json structure so that I can get the idea of what you're trying to do

@oupala
Copy link
Author

oupala commented May 18, 2016

I tried with the exact same string as you:

 "*[HTML]: Hyper Text Markup Language.\nThe HTML specification is maintained by the W3C."

and I get the following generated html:

<li class="mop-wrapper">
    <p>@@@@~*[HTML]: Hyper Text Markup Language.
        <br>The HTML specification is maintained by the W3C.~@@@@</p>
</li>

Of course, the abbr is not displayed.

When I use this string:

"this is HTML !\n*[HTML]: Hyper Text Markup Language\n"

and I get the following generated html:

<li class="mop-wrapper">
    <p>@@@@~this is <abbr title="Hyper Text Markup Language">HTML</abbr> !</p>
    <p>~@@@@</p>
</li>

This time, the abbr is not displayed, but there is still some strange strings: @@@@~ and ~@@@@.

It seems that the final \n is important.

@mudassir0909
Copy link
Owner

strange! let me check this weekend

@oupala
Copy link
Author

oupala commented Jun 22, 2016

Hi @mudassir0909, did you had time to test it?

@mudassir0909
Copy link
Owner

Yes I did test it & this is what I'm seeing

screen shot 2016-06-22 at 10 59 05 pm

for the json

screen shot 2016-06-22 at 11 00 25 pm

Maybe you could share your jsonresume profile? that'd be more helpful

@oupala
Copy link
Author

oupala commented Jul 4, 2016

I tried with the markdown that you copied:

      "summary": "conception and QA",
      "highlights": [
        "this is HTML !\n*[HTML]: Hyper Text Markup Language\n",
        "conception of a distributed system"

And the result is showing some annoying @@@@~ and ~@@@@ strings:

screenshot 2016-07-04 10 40 10

I don't have any idea on where it could come from. I'm using debian jessie with a standard nvm install of npm.

Searching @@@@~ string is hard with Google...

Any help would be gladly welcome!

@oupala
Copy link
Author

oupala commented Jul 4, 2016

Further testing shows me that the strange strings are due to the final \n.

Without the final \n, the abbr is not rendered, but the @@@@~ disappear.

@mudassir0909
Copy link
Owner

Ah! Maybe compatibility issue with the OS, if you have a VM, can you try publishing the same from ubuntu & see if the issue still persists?

Also, if possible open up node console & include mardown-it, markdown-it-abbr. Try to convert the markdown in the console & if the issue is at package level, maybe we can raise the issue in their github repository

@oupala
Copy link
Author

oupala commented Jul 5, 2016

The problem does not come from debian: I've just tested with Ubuntu Xenial (a real Ubuntu, not a VM) and I get the same result. What OS are you using?

Where does that come from?

I thought it could come from the encoding:

$ file resume.json 
resume.json: UTF-8 Unicode text, with very long lines

What is your encoding?

@oupala
Copy link
Author

oupala commented Jul 5, 2016

Could you help me test markdown-it and markdown-it-abbr from the node console? I would like to test if only I knew how to do it.

@mudassir0909
Copy link
Owner

mudassir0909 commented Jul 10, 2016

Assume you have node installed on your machine, you can open node console using the following command

node

Once you enter the console you could do

var markdown = require('markdown-it')({
    breaks: true
}).use(require('markdown-it-abbr'));

markdown.render("this is HTML !\n*[HTML]: Hyper Text Markup Language\n")

See if the output exports special characters

P.S. Ensure you have markdown-it & markdown-it-abbr installed globally

@mudassir0909
Copy link
Owner

mudassir0909 commented Jul 10, 2016

By the way here is my encoding

$ file resume.json
resume.json: ASCII English text

I'm on OS X El Capitan

@mudassir0909
Copy link
Owner

Also, did you publish your resume somewhere? can I have a look at it?

@oupala
Copy link
Author

oupala commented Jul 11, 2016

Here is the result of my test:

>node
> var markdown = require('markdown-it')({
...     breaks: true
... }).use(require('markdown-it-abbr'));
undefined
> markdown.render("this is HTML !\n*[HTML]: Hyper Text Markup Language\n")
'<p>this is <abbr title="Hyper Text Markup Language">HTML</abbr> !</p>\n'
> .exit

So, it seems to work!

As my file is in UTF-8 and yours is in ASCII, this could explain the different behaviour. Could please add an é character somewhere in your resume, save it in UTF-8, and try to render it again?

My resume is not published anywhere at this time (it is not finished yet as there is still some bugs), but I can send it to by private mail.

@mudassir0909
Copy link
Owner

shoot me an email at mudassir.dev @ gmail.com, attach your resume.json file, it'll make things easier for me

@oupala
Copy link
Author

oupala commented Aug 19, 2016

It might be due to differences in system's locales.

Here are mines:

>locale
LANG=fr_FR.utf8
LANGUAGE=
LC_CTYPE="fr_FR.utf8"
LC_NUMERIC="fr_FR.utf8"
LC_TIME="fr_FR.utf8"
LC_COLLATE="fr_FR.utf8"
LC_MONETARY="fr_FR.utf8"
LC_MESSAGES="fr_FR.utf8"
LC_PAPER="fr_FR.utf8"
LC_NAME="fr_FR.utf8"
LC_ADDRESS="fr_FR.utf8"
LC_TELEPHONE="fr_FR.utf8"
LC_MEASUREMENT="fr_FR.utf8"
LC_IDENTIFICATION="fr_FR.utf8"
LC_ALL=

What are yours?

@mudassir0909
Copy link
Owner

LANG="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_CTYPE="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_ALL="en_US.UTF-8"

@mudassir0909
Copy link
Owner

And even then this issue is probably related to markdown-it-abbr npm package & has nothing to with this them, I feel

@oupala
Copy link
Author

oupala commented Aug 19, 2016

As explained in my previous comment, everything seems to work very well with markdown-it and markdown-it-abbr.

Do you really think I should try to have a deeper look at markdown-it-abbr?

@mudassir0909
Copy link
Owner

As mentioned in the email, it could be due to hackmyresume. If you are not having any issues when you host your resume(jsonresume) locally then it's probably hackmyresume

See https://github.com/mudassir0909/jsonresume-theme-elegant#contributing on how to host your resume locally

@oupala
Copy link
Author

oupala commented Aug 23, 2016

It works very well with jsonresume-theme-elegant self-hosted. But how do you manage to do that without resume-cli?

I'll have to dive into hackmyresume to find out where it does come from... (see hacksalot/HackMyResume#168)

Thanks a lot for your patience!

EDIT: replace json-server by resume-cli

@mudassir0909
Copy link
Owner

no problem :) closing the issue then

@mudassir0909
Copy link
Owner

how do you manage to do that without json-server?

I didn't get this part

@oupala
Copy link
Author

oupala commented Aug 24, 2016

I edited the previous comment.

How do you manage to render the resume without resume-cli?

@mudassir0909
Copy link
Owner

Aha, this even I've no clue, although this might help

https://github.com/mudassir0909/jsonresume-theme-elegant/blob/master/serve.js#L47

We use this script to render the theme locally, you could do the similar thing

@oupala
Copy link
Author

oupala commented Aug 24, 2016

So... What is resume-cli for if jsonresume-theme-elegant is a standalone tool?

I mean, it's more than a theme, it is a fully usable standalone tool!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants