-
Notifications
You must be signed in to change notification settings - Fork 0
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
Twine links should adhere to linebreaks #46
Comments
This could be solved in at least two ways, depending on the current behaviour and limitations of the current API.
First options is preferred, though further investigations is needed. |
Currently all links are handled by the WikiLinks parsing feature of Pegdown. Using the custom TwineLinkParser is not possible because parser plugins appear to be called after link parsing, and thus the links are parsed as reflinks instead. I've tried subclassing the Parser to override this behaviour, but that does not appear to be possible, see sirthias/pegdown#54. This behaviour by Twine is not valid markdown. In order to solve this properly this has to be changed at the parser level because otherwise the linebreaks (which do not mean anything in valid Markdown in this context) are lost. |
I checked the different Twine story formats and it turns out that each story format handles their own markdown parsing. And all but snowman appear to just replace all newlines with For example:
When rendered should appear as
Because even different Twine story formats are not consistent I don't think fixing this even on the parser side it a good thing because not we need to know which template we're using. I don't think it's a smart idea to take templates into account, because that can easily break when using custom templates, or when the templates are updated. It appears that one of Markdowns major flaws, lack of spec, strikes again. A quick search for a couple of editors shows several that behave differently:
|
In order to keep the burden on the complexity of the code down the only solution I'm comfortable with at this point is to do the following based on a custom option (it is up to the user which behaviour they want):
I think it's best it should default to replacing linebreaks in order to support the majority of the default Twine templates. So I've created a new issue #49 in order to support custom options. I've also created a new issue #50 to signify this decision, it that describes the LINEBREAK behaviour as described above. |
Summary
Spiner places all twine links on a the same line even when separated by linebreaks. Instead it should place them in a new line.
Expected behaviour
The following markdown syntax in Twine:
Should translate to something along the lines of:
Actual behaviour:
The example above translates to the following:
The text was updated successfully, but these errors were encountered: