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

Support bold and italics at the same time #2053

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/rouge/lexers/markdown.rb
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,8 @@ def html
push :link
end

rule %r/[*][*]#{edot}*?[*][*]/, Generic::Strong
rule %r/[*]{2}[^* \n][^*\n]*[*]{2}/, Generic::Strong
rule %r/[*]{3}[^* \n][^*\n]*[*]{3}/, Generic::EmphStrong
rule %r/__#{edot}*?__/, Generic::Strong

rule %r/[*]#{edot}*?[*]/, Generic::Emph
Expand Down
4 changes: 4 additions & 0 deletions lib/rouge/themes/base16.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ def self.make_light!
style Generic::Deleted, :fg => :base08
style Generic::Heading, :fg => :base0D, :bg => :base00, :bold => true

style Generic::Emph, :italic => true
style Generic::EmphStrong, :italic => true, :bold => true
style Generic::Strong, :bold => true

style Keyword, :fg => :base0E
style Keyword::Constant,
Keyword::Type, :fg => :base09
Expand Down
1 change: 1 addition & 0 deletions lib/rouge/themes/bw.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class BlackWhiteTheme < CSSTheme
style Generic::Heading, :bold => true
style Generic::Subheading, :bold => true
style Generic::Emph, :italic => true
style Generic::EmphStrong, :italic => true, :bold => true
style Generic::Strong, :bold => true
style Generic::Prompt, :bold => true

Expand Down
1 change: 1 addition & 0 deletions lib/rouge/themes/colorful.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ class Colorful < CSSTheme
style Generic::Inserted, :fg => "#00A000"
style Generic::Error, :fg => "#FF0000"
style Generic::Emph, :italic => true
style Generic::EmphStrong, :italic => true, :bold => true
style Generic::Strong, :bold => true
style Generic::Prompt, :fg => "#c65d09", :bold => true
style Generic::Output, :fg => "#888"
Expand Down
1 change: 1 addition & 0 deletions lib/rouge/themes/github.rb
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ def self.make_light!
Name::Tag, :fg => :tag

style Generic::Inserted, :fg => :fgInserted, :bg => :bgInserted
style Generic::EmphStrong, :italic => true, :bold => true

style Keyword::Constant,
Literal,
Expand Down
5 changes: 4 additions & 1 deletion lib/rouge/themes/gruvbox.rb
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,10 @@ def self.make_light!
style Generic::Deleted, :fg => :red, :bg => :bg0
style Generic::Heading, :fg => :green, :bold => true

style Generic::Emph, :italic => true
style Generic::EmphStrong, :italic => true, :bold => true
style Generic::Strong, :bold => true

style Keyword, :fg => :red
style Keyword::Constant, :fg => :purple
style Keyword::Type, :fg => :yellow
Expand All @@ -164,7 +168,6 @@ def self.make_light!
style Literal::Number, :fg => :purple

style Literal::String::Symbol, :fg => :blue

end
end
end
3 changes: 3 additions & 0 deletions lib/rouge/themes/igor_pro.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ class IgorPro < CSSTheme
style Comment::Preproc, :fg => '#CC00A3'
style Comment::Special, :fg => '#CC00A3'
style Comment, :fg => '#FF0000'
style Generic::Emph, :italic => true
style Generic::EmphStrong, :italic => true, :bold => true
style Generic::Strong, :bold => true
style Keyword::Constant, :fg => '#C34E00'
style Keyword::Declaration, :fg => '#0000FF'
style Keyword::Reserved, :fg => '#007575'
Expand Down
1 change: 1 addition & 0 deletions lib/rouge/themes/magritte.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ class Magritte < CSSTheme
style Generic::Deleted, :fg => :cherry
style Generic::Inserted, :fg => :forest
style Generic::Emph, :italic => true
style Generic::EmphStrong, :italic => true, :bold => true
style Generic::Strong, :bold => true
style Generic::Traceback, :fg => :black, :bg => :lavender
style Keyword::Constant, :fg => :forest, :bold => true
Expand Down
3 changes: 2 additions & 1 deletion lib/rouge/themes/molokai.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ class Molokai < CSSTheme
style Error, :fg => :white, :bg => :grey
style Generic::Inserted, :fg => :green
style Generic::Deleted, :fg => :red
style Generic::Emph, :fg => :black, :italic => true
style Generic::Emph, :italic => true
style Generic::EmphStrong, :italic => true, :bold => true
style Generic::Error,
Generic::Traceback, :fg => :red
style Generic::Heading, :fg => :grey
Expand Down
3 changes: 2 additions & 1 deletion lib/rouge/themes/monokai.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ class Monokai < CSSTheme
style Error, :fg => :carmine, :bg => :very_dark
style Generic::Inserted, :fg => :white, :bg => :dimgreen
style Generic::Deleted, :fg => :white, :bg => :dimred
style Generic::Emph, :fg => :black, :italic => true
style Generic::Emph, :italic => true
style Generic::EmphStrong, :italic => true, :bold => true
style Generic::Error,
Generic::Traceback, :fg => :dark_red
style Generic::Heading, :fg => :grey
Expand Down
7 changes: 4 additions & 3 deletions lib/rouge/themes/monokai_sublime.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ class MonokaiSublime < CSSTheme
style Literal::String::Regex, :fg => :orange
style Generic::Output, :fg => :dark_grey
style Generic::Prompt, :fg => :emperor
style Generic::Strong, :bold => false
style Generic::Emph, :italic => true
style Generic::EmphStrong, :italic => true, :bold => true
style Generic::Strong, :bold => true
style Generic::Subheading, :fg => :light_grey
style Name::Builtin, :fg => :orange
style Comment::Multiline,
Expand All @@ -42,8 +44,7 @@ class MonokaiSublime < CSSTheme
Generic::Error,
Generic::Traceback, :fg => :carmine
style Generic::Deleted,
Generic::Inserted,
Generic::Emph, :fg => :dark
Generic::Inserted, :fg => :dark
style Keyword::Constant,
Keyword::Declaration,
Keyword::Reserved,
Expand Down
1 change: 1 addition & 0 deletions lib/rouge/themes/pastie.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class Pastie < CSSTheme
style Generic::Inserted, :fg => '#000000', :bg => '#ddffdd'

style Generic::Emph, :italic => true
style Generic::EmphStrong, :italic => true, :bold => true
style Generic::Strong, :bold => true

style Generic::Lineno, :fg => '#888888'
Expand Down
1 change: 1 addition & 0 deletions lib/rouge/themes/thankful_eyes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ class ThankfulEyes < CSSTheme
style Generic::Deleted, :fg => :scarletred2
style Generic::Inserted, :fg => :go_get_it
style Generic::Emph, :italic => true
style Generic::EmphStrong, :italic => true, :bold => true
style Generic::Strong, :bold => true
style Generic::Traceback, :fg => :eggshell_cloud, :bg => :slate_blue
style Keyword::Constant, :fg => :pink_merengue, :bold => true
Expand Down
1 change: 1 addition & 0 deletions lib/rouge/themes/tulip.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class Tulip < CSSTheme
style Generic::Deleted, :fg => :red
style Generic::Inserted, :fg => :green
style Generic::Emph, :italic => true
style Generic::EmphStrong, :italic => true, :bold => true
style Generic::Strong, :bold => true
style Generic::Traceback,
Generic::Lineno, :fg => :white, :bg => :purple
Expand Down
3 changes: 2 additions & 1 deletion lib/rouge/token.rb
Original file line number Diff line number Diff line change
Expand Up @@ -172,15 +172,16 @@ def self.token(name, shortname, &b)
token :Generic, 'g' do
token :Deleted, 'gd'
token :Emph, 'ge'
token :EmphStrong, 'ges'
token :Error, 'gr'
token :Heading, 'gh'
token :Inserted, 'gi'
token :Lineno, 'gl'
token :Output, 'go'
token :Prompt, 'gp'
token :Strong, 'gs'
token :Subheading, 'gu'
token :Traceback, 'gt'
token :Lineno, 'gl'
end

# convenience
Expand Down
8 changes: 8 additions & 0 deletions spec/visual/samples/markdown
Original file line number Diff line number Diff line change
Expand Up @@ -828,6 +828,8 @@ HTML `<em>` tag; double `*`'s or `_`'s will be wrapped with an HTML

**double asterisks**

***triple asterisks***

__double underscores__

will produce:
Expand Down Expand Up @@ -1097,3 +1099,9 @@ has (parens too)](example.com), and text after it.

[this is not a
link]

*single asterisks*
_single underscores_
**double asterisks**
***triple asterisks***
__double underscores__