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

Test: URL link over mixed formatting #45

Open
novoid opened this issue Apr 23, 2020 · 5 comments
Open

Test: URL link over mixed formatting #45

novoid opened this issue Apr 23, 2020 · 5 comments
Assignees
Labels
enhancement helpwanted quickfix small change necessary to fix this

Comments

@novoid
Copy link
Owner

novoid commented Apr 23, 2020

Add a test to see, if following is working as expected:

*this is [[https://karl-voit.at][bold]]*
*this is [[https://karl-voit.at][bold*]]
*this [[https://karl-voit.at][is]] bold*
[[https://karl-voit.at][*This]] is bold*
*[[https://karl-voit.at][This]] is bold*

If an issue is detected, fix it accordingly.

Update 2022-01-23: line 2 and 4 of the example can't be directly converted to HTML/XML as they may result in invalid syntax (see discussion below). For now, it should be safe to ignore those cases. Maybe this issue can only be solved by switching to a better parser: #63

@novoid novoid added enhancement helpwanted quickfix small change necessary to fix this labels Apr 23, 2020
@novoid novoid self-assigned this Apr 23, 2020
@mbeppler
Copy link

Could you please state what /you/ would expect.

For me the 2nd and 4th line is malformed. And for a one to one translation to HTML xmllint agrees with me.

<b>this is <a href="https://karl-voit.at">bold</a></b>
<b>this is <a href="https://karl-voit.at">bold</b></a>
<b>this <a href="https://karl-voit.at">is</a> bold</b>
<a href="https://karl-voit.at"><b>This</a> is bold</b>
<b><a href="https://karl-voit.at">This</a> is bold</b>

A quick test with GNU Emacs 27.2 and Org mode 9.4.6 shows the asterisk is in the link (underlined), exactly as you've written it down. But only the 2nd line is bold, the 4th not. Inconsistent!

Unfortunately Markdown has no underscore and <u> is not working inside a github comment to show this. Long live Orgdown 😉

@novoid
Copy link
Owner Author

novoid commented Jan 22, 2022

Hi,

Here, we do have the issue that Org-mode is implemented in a clever way but not in a way that translates well to valid HTML/XML.

For example: Foo [[https://karl-voit.at][description*]]* bar. The first asterisk was added after the rest by moving the cursor from the left to the right until the space character right of the "n". The second asterisk was added when moving the cursor from the right hand side, going left. So the inserting position is related to the cursor movement direction.

With XML/HTML you need to make sure that the form is a valid one. Clearly, the second and fourth line aren't valid at all for HTML. The Orgdown examples of mine are valid Org-mode syntax. If Orgdown is translated without thinking too much about that, that might end up in this invalid form.

This might be very tricky to implement...

@mbeppler
Copy link

Hello,

totally forgot how frustrated I was with Org mode and editing links at the beginning. Never liked org-insert-link to edit. For some things, like search and replace, I used vi 😀. Till I found org-toggle-link-display.

I know you got big heat for the name Orgdown alone. But this opportunity should be used to define a proper grammar. For a good reason example 2 and 4 are invalid everywhere else. If I would thinking about adding support to a tool, I would ignore these or not doing it at all.

Here the result from pandoc:

<strong>this is <a href="https://karl-voit.at">bold</a></strong>
<strong>
    this is <a href="https://karl-voit.at">bold*</a>
    <strong>this <a href="https://karl-voit.at">is</a> bold</strong>
    <a href="https://karl-voit.at">*This</a> is bold
</strong>
<strong><a href="https://karl-voit.at">This</a> is bold</strong>

As you introduced Orgdown I started to add a tool page for pandoc but quickly stopped as I was looking how different they treated the block examples. Could not decide on, supported as pandoc converted the examples, or partly because the result was different - or this not.

If this example should be valid Orgdown I think pandoc doesn't even support links fully.

But I don't think this is the right place for this discussion.

BTW: curiosity got the better of me and I checked the export from org (C-c C-e h H)

<b>this is <a href="https://karl-voit.at">bold</a></b>
<b>
    this is <a href="https://karl-voit.at">bold*</a>
    *this <a href="https://karl-voit.at">is</a> bold
</b>
<a href="https://karl-voit.at">*This</a> is bold*
<b><a href="https://karl-voit.at">This</a> is bold</b>

If you add text before and after the link it is better to see that org is displaying as it is exporting.

Please define a grammar for Orgdown where 2nd and 4th example are invalid as Org can't handle it for display and export!

@mbeppler
Copy link

Sorry, totally got carried away and missed the point. Using Emacs Org mode to edit links direct might lead to this. And you need a solution to handle the mess.

For this unfortunately I don't have one. Org mode and pandoc both fail. And I don't think there will be a general solution. Only for specific ones, and these might do even the wrong thing in an other specific case.

I in your place would search for these and fix in the org source and try not to create a new one in the future.

@novoid
Copy link
Owner Author

novoid commented Jan 23, 2022

Off-topic: I understand the issues here and implications. However, me and the Orgdown initiative are not in the position of defining something that differs from the GNU Emacs implementation of Org-mode. Therefore, this needs to be addressed by the Org-mode ML.

For lazyblorg (well, the most dominant issue of lazyblorg is to get a decent generic Orgdown parser), it is safe to neglect this issue here to a certain degree. I made other assumptions (empty line between two different markup elements, ...) in plenty places so far. Those might change after switching to a better parser. Until then, the syntax that lazyblorg understands is a small subset of Orgdown. See also #63

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement helpwanted quickfix small change necessary to fix this
Projects
None yet
Development

No branches or pull requests

2 participants