Coder Social home page Coder Social logo

Comments (10)

Gazler avatar Gazler commented on August 17, 2024

I threw together a quick test for the expected behavior. https://gist.github.com/Gazler/d7221ad76b20b4f72154

I copied the source style from https://github.com/elixir-lang/elixir/blob/a0be9fe272922fe151e5e42e4ebc464c19fb5c50/lib/elixir/lib/kernel/typespec.ex#L130

from earmark.

ericmj avatar ericmj commented on August 17, 2024

@Gazler You missed the back-ticks. It should work without escapes inside back-ticks.

from earmark.

pragdave avatar pragdave commented on August 17, 2024

Are there precedents for that behavior?
On Aug 16, 2014 8:57 AM, "Eric Meadows-Jönsson" [email protected]
wrote:

@Gazler https://github.com/Gazler You missed the back-ticks. It should
work without escapes inside back-ticks.


Reply to this email directly or view it on GitHub
#5 (comment).

from earmark.

ericmj avatar ericmj commented on August 17, 2024

That | shouldn't be a table separator inside back-ticks is obvious to me. How would it even render correctly otherwise? <td><code>foo</td><td>bar</code></td> is invalid HTML.

For the other issue, are you saying that there should be no way to have | chars inside tables?

from earmark.

pragdave avatar pragdave commented on August 17, 2024

No, of course you should be able to do it.

But I already fixed this in https://github.com/pragdave/earmark/issues/2—it works when you put a backslash in front of the |

Here's the output from typespecs:

screen shot 2014-08-16 at 11 37 57 am

I got this by extracting the table into t.md, and then running

./earmark t.md >t.html

Are you perhaps running an older version?

from earmark.

ericmj avatar ericmj commented on August 17, 2024

That would explain it, sorry about that Dave. ex_doc is on earmark 0.1.4, I will update it.

Any chance we could also have | not treated as table separator when it appears between back-ticks.

Current behaviour:

iex(11)> Earmark.to_html("foo | bar\nfoo | `bar | baz`")
"<p>foo | bar\nfoo | <code class=\"inline\">bar | baz</code></p>\n"

Proposed behaviour:

iex(1)> Earmark.to_html("foo | bar\nfoo | `bar | baz`")
"<table>\n<colgroup>\n<col align=\"left\">\n<col align=\"left\">\n</colgroup>\n<tr>\n<td>foo</td><td>bar</td>\n</tr>\n<tr>\n<td>foo</td><td><code class=\"inline\">bar | baz</code></td>\n</tr>\n</table>\n"

from earmark.

pragdave avatar pragdave commented on August 17, 2024

I'm resisting this simply because I want to be compatible with the majority
of Markdown processors out there, and right now I haven't surveyed them to
see what they do.

I'm leaving this open until I have time to see what the others do.

On Sat, Aug 16, 2014 at 12:58 PM, Eric Meadows-Jönsson <
[email protected]> wrote:

That would explain it, sorry about that Dave. ex_doc is on earmark 0.1.4,
I will update it.

Any chance we could also have | not treated as table separator between
back-ticks.

Current behaviour:

iex(11)> Earmark.to_html("foo | bar\nfoo | bar | baz")"

foo | bar\nfoo | <code class="inline">bar | baz

\n"

Proposed behaviour:

iex(1)> Earmark.to_html("foo | bar\nfoo | bar | baz")"

\n\n<col align="left">\n<col align="left">\n\n\n\n\n\n\n\n
foobar
foo<code class="inline">bar | baz
\n"


Reply to this email directly or view it on GitHub
#5 (comment).

from earmark.

ericmj avatar ericmj commented on August 17, 2024

@pragdave The nightly doc builds now use 0.1.10 but we are still seeing the issue with escaped \|, see http://elixir-lang.org/docs/master/elixir/Kernel.Typespec.html. What should we fix in this code https://github.com/elixir-lang/elixir/blob/master/lib/elixir/lib/kernel/typespec.ex#L125-L146 to make it render correctly?

from earmark.

pragdave avatar pragdave commented on August 17, 2024

I don't think you're running the Earmark you think you are.

Here's what I see for that table, running 0.1.11. (to create this, just mix
escript.build in earmark, and earmark typespec.ex)

Built-in typeDefined asterm anybinary<< _ :: _ * 8 >>bitstring<< _ :: _ * 1

booleanfalse | truebyte0..255char 0..0x10ffffnumberinteger | float
char_list[char] list[any]maybe_improper_listmaybe_improper_list(any, any)
nonempty_list nonempty_list(any)iodataiolist | binaryiolist
maybe_improper_list(byte | binary | iolist, binary | []) moduleatom | tuple
mfa{atom, atom, arity}arity 0..255nodeatomtimeout:infinity | non_neg_integer
no_returnnonefun(... -> any)

On Thu, Sep 4, 2014 at 11:28 AM, Eric Meadows-Jönsson <
[email protected]> wrote:

@pragdave https://github.com/pragdave The nightly doc builds now use
0.1.10 but we are still seeing the issue with escaped |, see
http://elixir-lang.org/docs/master/elixir/Kernel.Typespec.html. What
should we fix in this code
https://github.com/elixir-lang/elixir/blob/master/lib/elixir/lib/kernel/typespec.ex#L125-L146
to make it render correctly?


Reply to this email directly or view it on GitHub
#5 (comment).

from earmark.

ericmj avatar ericmj commented on August 17, 2024

You are right, sorry about that again. ex_doc was using defaults I did not expect, the generated docs on elixir-lang.org should use earmark from here on.

from earmark.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.