diff --git a/README.asciidoc b/README.asciidoc index b0ebc68c53f8..0bcd011be5b8 100644 --- a/README.asciidoc +++ b/README.asciidoc @@ -238,8 +238,6 @@ To force *all* versions of the documentation to be rebuilt (not just the calcula @elasticmachine, run elasticsearch-ci/docs rebuild ---------------------------- - - [[config]] == Adding new docs or new branches @@ -276,6 +274,23 @@ want to build a version called "4.2" but have it build out of a branch called `branches` list. Everywhere else in `conf.yaml`, continue to use `branch-for-4.2`. +[[run-tests]] +== Run tests + +When developing new features or fixing bugs in the build process, run the test suite locally with: + +[source,bash] +---- +make +---- + +Alternatively, run just the Asciidoctor tests with: + +[source,bash] +---- +make asciidoctor_check +---- + [[asciidoc-guide]] = Asciidoc Guide diff --git a/integtest/spec/helper/console_alternative_examples.rb b/integtest/spec/helper/console_alternative_examples.rb index 8048eabafaab..5a2c346214c3 100644 --- a/integtest/spec/helper/console_alternative_examples.rb +++ b/integtest/spec/helper/console_alternative_examples.rb @@ -47,7 +47,7 @@ module ConsoleExamples it 'contains the js listing followed by the csharp listing' do expect(body).to include(<<~HTML.strip)
-
+
Copy to clipboard
const result = await client.search({
           body: { query: 'foo bar' } 
         })
@@ -58,7 +58,7 @@ module ConsoleExamples it 'contains the csharp listing followed by the default listing' do expect(body).to include(<<~HTML.strip)
-
+
Copy to clipboard
var searchResponse = _client.Search<Project>(s => s
             .Query(q => q
                 .QueryString(m => m
@@ -74,7 +74,7 @@ module ConsoleExamples
     it 'contains the default listing followed by the console widget' do
       expect(body).to include(<<~HTML.strip)
         
-
+
Copy to clipboard
GET /_search
         {
             "query": "foo bar" 
diff --git a/resources/asciidoctor/lib/docbook_compat/convert_listing.rb b/resources/asciidoctor/lib/docbook_compat/convert_listing.rb
index 3be679bc25d4..9b25d7abed4d 100644
--- a/resources/asciidoctor/lib/docbook_compat/convert_listing.rb
+++ b/resources/asciidoctor/lib/docbook_compat/convert_listing.rb
@@ -50,9 +50,11 @@ def convert_listing_body(node)
     def convert_listing_body_with_language(node, lang)
       extra_classes = node.roles.empty? ? '' : " #{node.roles.join ' '}"
       pre_classes = "programlisting prettyprint lang-#{lang}#{extra_classes}"
+      c_cla = '"console_code_copy" title="Copy to clipboard" data-track="cta"'
+      span = 'Copy to clipboard'
       [
         %(
), - %(
), + %(
#{span}
), %(
#{node.content || ''}
), %(
), ].join "\n" diff --git a/resources/asciidoctor/spec/docbook_compat_spec.rb b/resources/asciidoctor/spec/docbook_compat_spec.rb index 2790fced2f6a..43088ca64944 100644 --- a/resources/asciidoctor/spec/docbook_compat_spec.rb +++ b/resources/asciidoctor/spec/docbook_compat_spec.rb @@ -995,7 +995,7 @@ # It is important that there isn't any extra space around the
 tags
       expect(converted).to include(<<~HTML)
         
-
+
Copy to clipboard
cpanm Search::Elasticsearch
HTML @@ -1184,7 +1184,7 @@ it 'the role is included as a class' do expect(converted).to include(<<~HTML)
-
+
Copy to clipboard
cpanm Search::Elasticsearch
HTML diff --git a/resources/web/style/code.pcss b/resources/web/style/code.pcss index cea09130cb2c..580bd76c8f70 100644 --- a/resources/web/style/code.pcss +++ b/resources/web/style/code.pcss @@ -83,4 +83,18 @@ .alternative { display: none; } + + /* Hide "Copy to Clipboard" text */ + .visually-hidden { + position: absolute; + width: 1px; + height: 1px; + margin: -1px; + padding: 0; + border: 0; + overflow: hidden; + clip: rect(0, 0, 0, 0); + clip-path: inset(50%); + white-space: nowrap; /* Avoid line breaks */ + } }