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

Markdown code block fixes #1053

Merged
merged 4 commits into from
Jun 2, 2019

Conversation

vidarh
Copy link
Contributor

@vidarh vidarh commented Dec 23, 2018

  • Makes Markdown lexer recognise code blocks (~~~/```) that startes at the very first line of a file.
  • Makes Markdown lexer recognise code blocks if the lexer is passed input line by line with the "continue" flag.
  • Makes Markdown lexer apply guesser to code-blocks when no name is provided.

* Code blocks starting at the first line of a file are not recognised.
* Code blocks are not recognised if the file is lexed line by line.
* While the lexer tries to pass lines of code in to #find_fancy,
 it does not set the name to 'guess' when none is provided, so it achieves nothing.
…put.

The same issue causes it to fail recognition at the start of a source,
and when parsing line by line, as it depended on a multi-line regex
match. This instead matches on either just the first line or the whole
block if provided, and if only the first block is provided, it pushes
a dynamic state that recognizes the end of the code block but delegates
all other input to the sub-lexer.
@vidarh
Copy link
Contributor Author

vidarh commented Dec 23, 2018

Hi, I'm trying to use Rouge for a Ruby text-editor, and since I'm doing incremental syntax highlighting and various additional filtering I ran into some corner cases with the Markdown lexer. It adds some complexity, so happy to discuss/try alternative approaches if you don't think this is the way to do it.

@pyrmont
Copy link
Contributor

pyrmont commented May 28, 2019

@vidarh Can you do a force push here to run a fresh build of Travis? Something like

$ git commit --amend
$ git push --force

should do the trick.

@pyrmont pyrmont added the author-action The PR has been reviewed but action by the author is needed label May 28, 2019
@vidarh vidarh force-pushed the markdown-code-block-fixes branch from 6c43168 to a74e135 Compare May 28, 2019 18:42
@pyrmont pyrmont merged commit dabd56e into rouge-ruby:master Jun 2, 2019
@pyrmont
Copy link
Contributor

pyrmont commented Jun 2, 2019

Sorry, @vidarh. I'd missed that you'd updated this!

@pyrmont pyrmont removed the author-action The PR has been reviewed but action by the author is needed label Jun 2, 2019
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

Successfully merging this pull request may close these issues.

None yet

2 participants