-
Notifications
You must be signed in to change notification settings - Fork 29
Conversation
Issue #36
Previously: * List ``` go A := 123 ``` Created a code-span and didn't include language information. Treat all code with at least 3 accents as a code-block and try to detect language header.
Issue #36
@@ -209,7 +209,8 @@ implements the following extensions: | |||
to use 2 backslashes it the end of the line.\\ | |||
|
|||
* **Includes**, support including files with `{{filename}}` syntax. This is only | |||
done when include is started at the beginning of a line. | |||
done when include is started at the beginning of a line. The filename is | |||
specified with forward slashes `/`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would word this as 'The path separator is for the forward slash /
. Even on non-Unix environments'.'
I like the PR, but would like to see it be minimized or be put into multiple PR that each fix a different thing. The |
Anyways, as you need it split/minimized... how do these PR-s sound?
|
As to your final comment: I get the gist of your PR (sorry missed that before). Just cleaning up this one seems fine. |
I hope I fixed all the issues raised. |
type linespan struct{ begin, end int } | ||
|
||
// next updates begin and end to point to the next line | ||
func (sc *linespan) next(content []byte) bool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for all changes. I however thing this add something new that should happen in another PR. This (linespan
) is only used once (now), and there is is basically to prefix each line with the indent.
Nice. One nit about |
I'll just merge and clean up myself (if I think it is important enough :) ) Thanks for this PR! |
I was just about to start working on this. Anyways, thanks. The reason I introduced I'm certain that a more general |
Totally agree. There is one snag though: upstream blackfriday. I still need However I think this change would be such a large clean-up that I can live
|
We/I need to double check how images get included with the syntax |
So while converting https://github.com/miekg/learninggo to relative includes: I get this:
Which does not seem WAI.... |
Scratch that, everything is relative the the current file. |
Yep, figure includes don't follow the same rules, see https://github.com/miekg/learninggo/blame/master/ex/functions/stack.md#L9 |
Ok, There is also this little thing
Which makes the tests fail. |
And this is also interesting:
This means the Perl (/o) code included is not properly detected as code - digging in right now. Regardless: I think relative includes make a lot of sense. |
And with my non-pushed
Prolly related to parsing that CodeInclude |
I'm sorry, but I've reverted this PR. These changes make my learning.md not compile at all and the include perl example |
I you were to pick this up again, I think a way forward is doing the relative includes first (without changing any of the other logic) and prepare followup PR to move stuff around. And if not, than I'll give it a whack. |
Sad, but I understand. I guess, I can manage with absolute paths or write a minimal markdown parser for my own needs. I was debugging ~30min to figure out why the perl part isn't working, but didn't reach any good conclusions. The result that comes out of first pass looked correct, although I might have missed something obvious, since there was a lot of it. I was guessing that maybe the code included contained triple accents and terminated the code block early and misaligned rest of it. Although this should've happened with the regular html version as well. The main problem is that the code including trick can only work, if the fenced blocks have the language header detection. Alternatively if the includes are done with a single pass. Both require changes to the way other code works. I don't think I have a good enough understanding of this code to make a fix that accounts for all corner cases properly (as I initially suspected). |
Ok, so I gave this a couple of hours and with the current code (based of blackfriday) this is probable insane todo. It works for markdown file includes (that happen in Of course this can be worked around and everything can be fixed - but this becomes hacky fast and impairs the possibility of incorporating upstream fixes. So I am (also) going to stop implementing this :) The filename normalizing (i.e. everything uses / - even on windows) is a worthwhile addition though. |
Now this works as with relative imports.
Where
toc.md
contains:and
chapter1/toc.md
:When specifying
{{/xyz.md}}
will refer to the folder where main file is located.{{/../xyz.md}}
will resolve to{{/xyz.md}}
, because it is disallowed to go outside of the root folder.Fixes #36