You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Unable to use custom Rouge formatter for highlighting #617
It seems that the formatter subclasses don't share a common constructor interface. Some need the options, some another formatter, some yet another thing...
Any suggestions? The only way to solve this seems to be to specify the formatter as class and not as string.
The basic idea is to emulate the implementation for Rouge::Formatters::HTMLLegacy
That class is unofficially deprecated for Rouge. They told me that it wouldn't get updated to handle newer formatters.
@daenney I really can't remember why I wrote what you quoted but since the formatter class is first resolved, regardless of whether it is specified as class or string, and only then an object instantiated, it won't be possible in this way.
Writing an adapter would work but I don't want to complicate things on kramdown's end when rouge can do that better.
So as @ashmaroli said: We are leaving this as it is for now and see what rouge does.
@ashmaroli@daenney I don't think that rouge will do something about this. So on kramdown's end I will document the requirements for the formatter option of rouge and the user will need to make sure that s/he provides a correct (wrapper) class.
Activity
gettalong commentedon Aug 16, 2019
It seems that the formatter subclasses don't share a common constructor interface. Some need the options, some another formatter, some yet another thing...
Any suggestions? The only way to solve this seems to be to specify the formatter as class and not as string.
ashmaroli commentedon Aug 16, 2019
I did take this issue up to Rouge's maintainers themselves, but there hasn't been a response till date.
I would recommend to implement an adapter of sorts. But not sure, if that lies within the scope of
kramdown. So, left it as is..gettalong commentedon Aug 16, 2019
The problem with the adapter route is that if a formatter takes another formatter, which one should it take?
ashmaroli commentedon Aug 16, 2019
The basic idea is to emulate the implementation for
Rouge::Formatters::HTMLLegacyThat class is unofficially deprecated for Rouge. They told me that it wouldn't get updated to handle newer formatters.
daenney commentedon Apr 5, 2020
I just ran into this issue trying to use
HTMLLinewisefrom Jekyll. I'm curious if it's at all possible?This seems to suggest it should already be possible, or am I misunderstanding the comment?
gettalong commentedon Apr 16, 2020
@daenney I really can't remember why I wrote what you quoted but since the formatter class is first resolved, regardless of whether it is specified as class or string, and only then an object instantiated, it won't be possible in this way.
Writing an adapter would work but I don't want to complicate things on kramdown's end when rouge can do that better.
So as @ashmaroli said: We are leaving this as it is for now and see what rouge does.
gettalong commentedon Jan 6, 2021
@ashmaroli @daenney I don't think that rouge will do something about this. So on kramdown's end I will document the requirements for the formatter option of rouge and the user will need to make sure that s/he provides a correct (wrapper) class.