aboutsummaryrefslogtreecommitdiff
path: root/docs/_plugins
diff options
context:
space:
mode:
Diffstat (limited to 'docs/_plugins')
-rw-r--r--docs/_plugins/bugify.rb2
-rw-r--r--docs/_plugins/highlight_alt.rb18
2 files changed, 16 insertions, 4 deletions
diff --git a/docs/_plugins/bugify.rb b/docs/_plugins/bugify.rb
index 0c5a0f5f5..0f910718b 100644
--- a/docs/_plugins/bugify.rb
+++ b/docs/_plugins/bugify.rb
@@ -4,6 +4,8 @@ module Jekyll
upstream_map = {
"Bootstrap" => "https://github.com/twbs/bootstrap/issues/",
"Edge" => ["https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/", "Edge issue"],
+ "A11yUserVoice" => ["https://microsoftaccessibility.uservoice.com/forums/307429-microsoft-accessibility-feedback/suggestions/", "Microsoft A11y UserVoice idea"],
+ "UserVoice" => ["https://wpdev.uservoice.com/forums/257854-microsoft-edge-developer/suggestions/", "Edge UserVoice idea"],
"Mozilla" => ["https://bugzilla.mozilla.org/show_bug.cgi?id=", "Mozilla bug"],
"Chromium" => ["https://bugs.chromium.org/p/chromium/issues/detail?id=", "Chromium issue"],
"WebKit" => ["https://bugs.webkit.org/show_bug.cgi?id=", "WebKit bug"],
diff --git a/docs/_plugins/highlight_alt.rb b/docs/_plugins/highlight_alt.rb
index d1ed9ccff..8a86a2202 100644
--- a/docs/_plugins/highlight_alt.rb
+++ b/docs/_plugins/highlight_alt.rb
@@ -27,14 +27,14 @@ module Jekyll
@options[key.to_sym] = value || true
end
end
- @options[:linenos] = "inline" if @options.key?(:linenos) and @options[:linenos] == true
+ @options[:linenos] = false
else
raise SyntaxError.new <<-eos
-Syntax Error in tag 'highlight' while parsing the following markup:
+Syntax Error in tag 'example' while parsing the following markup:
#{markup}
-Valid syntax: highlight <lang> [linenos]
+Valid syntax: example <lang>
eos
end
end
@@ -57,16 +57,26 @@ eos
def example(output)
"<div class=\"bd-example\" data-example-id=\"#{@options[:id]}\">\n#{output}\n</div>"
end
-
+
def remove_holderjs(code)
code = code.gsub(/data-src="holder.js.+?"/, 'src="..."')
end
+ def remove_example_classes(code)
+ # Find `bd-` classes and remove them from the highlighted code. Because of how this regex works, it will also
+ # remove classes that are after the `bd-` class. While this is a bug, I left it because it can be helpful too.
+ # To fix the bug, replace `(?=")` with `(?=("|\ ))`.
+ code = code.gsub(/(?!class=".)\ *?bd-.+?(?=")/, "")
+ # Find empty class attributes after the previous regex and remove those too.
+ code = code.gsub(/\ class=""/, "")
+ end
+
def render_rouge(code)
require 'rouge'
formatter = Rouge::Formatters::HTML.new(line_numbers: @options[:linenos], wrap: false)
lexer = Rouge::Lexer.find_fancy(@lang, code) || Rouge::Lexers::PlainText
code = remove_holderjs(code)
+ code = remove_example_classes(code)
code = formatter.format(lexer.lex(code))
"<div class=\"highlight\"><pre>#{code}</pre></div>"
end