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

Code support is broken #25

Open
si14 opened this issue Jul 5, 2013 · 2 comments
Open

Code support is broken #25

si14 opened this issue Jul 5, 2013 · 2 comments

Comments

@si14
Copy link

si14 commented Jul 5, 2013

When I'm pasting this to my overview.edoc:

<pre lang="erlang">
16> ecirca:load(B).
{ok,{ecirca,#Ref<0.0.0.166>,<<>>,<0.48.0>,medium}}
</pre>

I get:

> rebar doc skip_deps=true
==> ecirca (doc)
2991- fatal: {invalid_name,"0.0.0."}
./doc/overview.edoc: at line 6: error in XML parser: {fatal,{{invalid_name,"0.0.0."},
                             {file,file_name_unknown},
                             {line,101},
                             {col,18}}}.
edoc: error in doclet 'edown_doclet': {'EXIT',error}.
ERROR: doc failed while processing /home/si14/repos/ecirca: {'EXIT',error}

And I also can't use Github's variant because of "```-quote ended unexpectedly" error.

@uwiger
Copy link
Contributor

uwiger commented Jul 6, 2013

The problem here is that edoc (via Xmerl) requires the markup to be valid XHTML, and markup is still parsed within pre tags ('pre' just means "preformatted" and tells the parser to preserve whitespace). In this case, the error occurs even before Edown gets a chance to massage the data.

What you can do is either to escape the < and > (as &lt; and &gt; respectively) or to do this:

<pre lang="erlang"><![CDATA[
16> ecirca:load(B).
{ok,{ecirca,#Ref<0.0.0.166>,<<>>,<0.48.0>,medium}}
]]></pre>

using <![CDATA[ ... ]]> as a wrapper to avoid having to escape the source. This should also be reasonably Edoc-compatible (although normal Edoc processing will ignore the lang="erlang" part).

As an aside, Edoc adds the <![CDATA[ ... ]]> wrapper when you use the ... ''' syntax (note though, how Edoc uses different end brackets from Github Markdown), but since it doesn't include any way to indicate the language (and erlang ... ''' would cause the "erlang" bit to end up on a line of its own. This would look funny in normal Edoc and Edown would have to guess that it means that the section should be highlighted as Erlang code).

@si14
Copy link
Author

si14 commented Jul 6, 2013

Now I see, thank you. Would you mind putting this explanation to README?

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