diff --git a/.rubocop_todo/gitlab/json.yml b/.rubocop_todo/gitlab/json.yml index ec48c04f3ed..799d90f0048 100644 --- a/.rubocop_todo/gitlab/json.yml +++ b/.rubocop_todo/gitlab/json.yml @@ -54,16 +54,6 @@ Gitlab/Json: - 'app/models/merge_request_diff_commit.rb' - 'app/presenters/packages/composer/packages_presenter.rb' - 'app/presenters/projects/security/configuration_presenter.rb' - - 'app/services/bulk_imports/lfs_objects_export_service.rb' - - 'app/services/ci/pipeline_artifacts/coverage_report_service.rb' - - 'app/services/ci/pipeline_artifacts/create_code_quality_mr_diff_report_service.rb' - - 'app/services/ci/pipeline_trigger_service.rb' - - 'app/services/ci/register_job_service.rb' - - 'app/services/google_cloud/create_service_accounts_service.rb' - - 'app/services/google_cloud/setup_cloudsql_instance_service.rb' - - 'app/services/merge_requests/add_context_service.rb' - - 'app/services/projects/lfs_pointers/lfs_download_link_list_service.rb' - - 'app/services/service_ping/submit_service.rb' - 'app/workers/google_cloud/create_cloudsql_instance_worker.rb' - 'config/initializers/rack_multipart_patch.rb' - 'db/migrate/20210305031822_create_dast_site_profile_variables.rb' diff --git a/Gemfile b/Gemfile index 056310e591e..7901320f28f 100644 --- a/Gemfile +++ b/Gemfile @@ -176,7 +176,7 @@ gem 'typhoeus', '~> 1.4.0' # Used with Elasticsearch to support http keep-alive # Markdown and HTML processing gem 'html-pipeline', '~> 2.13.2' -gem 'deckar01-task_list', '2.3.1' +gem 'deckar01-task_list', '2.3.2' gem 'gitlab-markup', '~> 1.8.0' gem 'github-markup', '~> 1.7.0', require: 'github/markup' gem 'commonmarker', '~> 0.23.6' diff --git a/Gemfile.checksum b/Gemfile.checksum index d3bd3b4045f..c5fad96428c 100644 --- a/Gemfile.checksum +++ b/Gemfile.checksum @@ -97,7 +97,7 @@ {"name":"danger-gitlab","version":"8.0.0","platform":"ruby","checksum":"497dd7d0f6513913de651019223d8058cf494df10acbd17de92b175dfa04a3a8"}, {"name":"database_cleaner","version":"1.7.0","platform":"ruby","checksum":"bdf833c197afac7054015bcde2567c3834c366bbfe6a377c30151ca984b32016"}, {"name":"dead_end","version":"3.1.1","platform":"ruby","checksum":"1011df7f7c0149be004e11cbbc37747760227c55305cd902fd3c06e1394b2f5b"}, -{"name":"deckar01-task_list","version":"2.3.1","platform":"ruby","checksum":"205a08c22a8f05c063d43c452aeada4214b58fdce1e55e92ec709e2cfb9e7ca1"}, +{"name":"deckar01-task_list","version":"2.3.2","platform":"ruby","checksum":"5a19092548d24309d8b2c2704d64cdc08a4a615823c9a722f4142edec1de8805"}, {"name":"declarative","version":"0.0.20","platform":"ruby","checksum":"8021dd6cb17ab2b61233c56903d3f5a259c5cf43c80ff332d447d395b17d9ff9"}, {"name":"declarative-option","version":"0.1.0","platform":"ruby","checksum":"17508349f51c5631e5ad4158c29f78a4b2de618abffa066d76c11953705f91bc"}, {"name":"declarative_policy","version":"1.1.0","platform":"ruby","checksum":"9af4cf299ade03f2bbf63908f2ce6a117d132fc714c39a128596667fb13331cb"}, diff --git a/Gemfile.lock b/Gemfile.lock index 82232f1c4b1..9a21b223d3e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -321,7 +321,7 @@ GEM gitlab (~> 4.2, >= 4.2.0) database_cleaner (1.7.0) dead_end (3.1.1) - deckar01-task_list (2.3.1) + deckar01-task_list (2.3.2) html-pipeline declarative (0.0.20) declarative-option (0.1.0) @@ -1584,7 +1584,7 @@ DEPENDENCIES crystalball (~> 0.7.0) cvss-suite (~> 3.0.1) database_cleaner (~> 1.7.0) - deckar01-task_list (= 2.3.1) + deckar01-task_list (= 2.3.2) declarative_policy (~> 1.1.0) default_value_for (~> 3.4.0) deprecation_toolkit (~> 1.5.1) diff --git a/app/assets/javascripts/deploy_tokens/components/new_deploy_token.vue b/app/assets/javascripts/deploy_tokens/components/new_deploy_token.vue index b585b6f9579..81d74c64124 100644 --- a/app/assets/javascripts/deploy_tokens/components/new_deploy_token.vue +++ b/app/assets/javascripts/deploy_tokens/components/new_deploy_token.vue @@ -233,13 +233,7 @@ export default { :description="$options.translations.addTokenNameDescription" label-for="deploy_token_name" > - + e - knative.make_errored!(_('Kubernetes error: %{error_code}') % { error_code: e.error_code }) - rescue StandardError - knative.make_errored!(_('Failed to update.')) - end - - private - - attr_reader :cluster, :platform, :kubeclient, :knative - - def serverless_domain_cluster - knative&.serverless_domain_cluster - end - - def configure_certificates - create_or_update_istio_cert_and_key - set_gateway_wildcard_https(MTLS_RESOURCE) - end - - def create_or_update_istio_cert_and_key - name = OpenSSL::X509::Name.parse("CN=#{knative.hostname}") - - key = OpenSSL::PKey::RSA.new(2048) - - cert = OpenSSL::X509::Certificate.new - cert.version = 2 - cert.serial = 0 - cert.not_before = Time.current - cert.not_after = Time.current + 1000.years - - cert.public_key = key.public_key - cert.subject = name - cert.issuer = name - cert.sign(key, OpenSSL::Digest.new('SHA256')) - - serverless_domain_cluster.update!( - key: key.to_pem, - certificate: cert.to_pem - ) - - kubeclient.create_or_update_secret(istio_ca_certs_resource) - kubeclient.create_or_update_secret(istio_certs_resource) - end - - def istio_ca_certs_resource - Gitlab::Kubernetes::GenericSecret.new( - 'istio-ingressgateway-ca-certs', - { - 'cert.pem': Base64.strict_encode64(serverless_domain_cluster.certificate) - }, - Clusters::Kubernetes::ISTIO_SYSTEM_NAMESPACE - ).generate - end - - def istio_certs_resource - Gitlab::Kubernetes::TlsSecret.new( - 'istio-ingressgateway-certs', - serverless_domain_cluster.certificate, - serverless_domain_cluster.key, - Clusters::Kubernetes::ISTIO_SYSTEM_NAMESPACE - ).generate - end - - def set_gateway_wildcard_https(tls_resource) - gateway_resource = gateway - gateway_resource.spec.servers.each do |server| - next unless server.hosts == ['*'] && server.port.name == 'https' - - server.tls = tls_resource - end - kubeclient.update_gateway(gateway_resource) - end - - def configure_passthrough - set_gateway_wildcard_https(PASSTHROUGH_RESOURCE) - end - - def gateway - kubeclient.get_gateway('knative-ingress-gateway', Clusters::Kubernetes::KNATIVE_SERVING_NAMESPACE) - end - end - end -end diff --git a/app/services/git/base_hooks_service.rb b/app/services/git/base_hooks_service.rb index 269637805ad..968d45bbcdb 100644 --- a/app/services/git/base_hooks_service.rb +++ b/app/services/git/base_hooks_service.rb @@ -53,11 +53,11 @@ module Git def create_pipelines return unless params.fetch(:create_pipelines, true) - Ci::CreatePipelineService - .new(project, current_user, pipeline_params) - .execute!(:push, pipeline_options) - rescue Ci::CreatePipelineService::CreateError => ex - log_pipeline_errors(ex) + if ::Feature.enabled?(:refactored_create_pipeline_execution_method, project) + create_pipeline_refactored + else + create_pipeline_legacy + end end def execute_project_hooks @@ -148,14 +148,14 @@ module Git {} end - def log_pipeline_errors(exception) + def log_pipeline_errors(error_message) data = { class: self.class.name, correlation_id: Labkit::Correlation::CorrelationId.current_id.to_s, project_id: project.id, project_path: project.full_path, message: "Error creating pipeline", - errors: exception.to_s, + errors: error_message, pipeline_params: sanitized_pipeline_params } @@ -175,5 +175,21 @@ module Git Gitlab::IntegrationsLogger end end + + def create_pipeline_refactored + response = Ci::CreatePipelineService + .new(project, current_user, pipeline_params) + .execute(:push, **pipeline_options) + + log_pipeline_errors(response.message) unless response.payload.persisted? + end + + def create_pipeline_legacy + Ci::CreatePipelineService + .new(project, current_user, pipeline_params) + .execute!(:push, pipeline_options) + rescue Ci::CreatePipelineService::CreateError => ex + log_pipeline_errors(ex.to_s) # Stringifying the ex here as I removed stringifying in log_pipeline_errors. + end end end diff --git a/app/services/google_cloud/create_service_accounts_service.rb b/app/services/google_cloud/create_service_accounts_service.rb index 9617161b8e9..ca0aa7c91df 100644 --- a/app/services/google_cloud/create_service_accounts_service.rb +++ b/app/services/google_cloud/create_service_accounts_service.rb @@ -10,8 +10,8 @@ module GoogleCloud service_accounts_service.add_for_project( environment_name, service_account.project_id, - service_account.to_json, - service_account_key.to_json, + Gitlab::Json.dump(service_account), + Gitlab::Json.dump(service_account_key), ProtectedBranch.protected?(project, environment_name) || ProtectedTag.protected?(project, environment_name) ) diff --git a/app/services/google_cloud/setup_cloudsql_instance_service.rb b/app/services/google_cloud/setup_cloudsql_instance_service.rb index 10237f83b37..40184b927ad 100644 --- a/app/services/google_cloud/setup_cloudsql_instance_service.rb +++ b/app/services/google_cloud/setup_cloudsql_instance_service.rb @@ -13,7 +13,7 @@ module GoogleCloud get_instance_response = google_api_client.get_cloudsql_instance(gcp_project_id, instance_name) if get_instance_response.state != INSTANCE_STATE_RUNNABLE - return error("CloudSQL instance not RUNNABLE: #{get_instance_response.to_json}") + return error("CloudSQL instance not RUNNABLE: #{Gitlab::Json.dump(get_instance_response)}") end save_instance_ci_vars(get_instance_response) @@ -42,7 +42,7 @@ module GoogleCloud success rescue Google::Apis::Error => err - error(message: err.to_json) + error(message: Gitlab::Json.dump(err)) end private @@ -97,7 +97,7 @@ module GoogleCloud database_response = google_api_client.create_cloudsql_database(gcp_project_id, instance_name, database_name) if database_response.status != OPERATION_STATE_DONE - return error("Database creation failed: #{database_response.to_json}") + return error("Database creation failed: #{Gitlab::Json.dump(database_response)}") end success @@ -109,7 +109,7 @@ module GoogleCloud user_response = google_api_client.create_cloudsql_user(gcp_project_id, instance_name, username, password) if user_response.status != OPERATION_STATE_DONE - return error("User creation failed: #{user_response.to_json}") + return error("User creation failed: #{Gitlab::Json.dump(user_response)}") end success diff --git a/app/services/merge_requests/add_context_service.rb b/app/services/merge_requests/add_context_service.rb index 7b441ddf5e4..2ce6073050e 100644 --- a/app/services/merge_requests/add_context_service.rb +++ b/app/services/merge_requests/add_context_service.rb @@ -65,7 +65,7 @@ module MergeRequests sha: sha, authored_date: Gitlab::Database.sanitize_timestamp(commit_hash[:authored_date]), committed_date: Gitlab::Database.sanitize_timestamp(commit_hash[:committed_date]), - trailers: commit_hash.fetch(:trailers, {}).to_json + trailers: Gitlab::Json.dump(commit_hash.fetch(:trailers, {})) ) end end diff --git a/app/services/projects/lfs_pointers/lfs_download_link_list_service.rb b/app/services/projects/lfs_pointers/lfs_download_link_list_service.rb index c82ed97203f..c91103f897f 100644 --- a/app/services/projects/lfs_pointers/lfs_download_link_list_service.rb +++ b/app/services/projects/lfs_pointers/lfs_download_link_list_service.rb @@ -95,10 +95,12 @@ module Projects end def request_body(oids) - { + body = { operation: DOWNLOAD_ACTION, objects: oids.map { |oid, size| { oid: oid, size: size } } - }.to_json + } + + Gitlab::Json.dump(body) end def headers diff --git a/app/services/service_ping/submit_service.rb b/app/services/service_ping/submit_service.rb index 7fd0fb10b4b..da2a51562f8 100644 --- a/app/services/service_ping/submit_service.rb +++ b/app/services/service_ping/submit_service.rb @@ -63,7 +63,7 @@ module ServicePing def submit_payload(payload, path: USAGE_DATA_PATH) Gitlab::HTTP.post( URI.join(base_url, path), - body: payload.to_json, + body: Gitlab::Json.dump(payload), allow_local_requests: true, headers: { 'Content-type' => 'application/json' } ) diff --git a/app/views/import/_githubish_status.html.haml b/app/views/import/_githubish_status.html.haml index 9ea52a8f82f..e92db09aaf1 100644 --- a/app/views/import/_githubish_status.html.haml +++ b/app/views/import/_githubish_status.html.haml @@ -4,7 +4,7 @@ - filterable = local_assigns.fetch(:filterable, true) - paginatable = local_assigns.fetch(:paginatable, false) - default_namespace_path = (local_assigns[:default_namespace] || current_user.namespace).full_path -- provider_title = Gitlab::ImportSources.title(provider) +- provider_title = Gitlab::ImportSources.title(local_assigns.fetch(:provider)) - optional_stages = local_assigns.fetch(:optional_stages, []) - header_title _("New project"), new_project_path diff --git a/app/views/layouts/_img_loader.html.haml b/app/views/layouts/_img_loader.html.haml index f6d7d163e6f..979ebeb0a02 100644 --- a/app/views/layouts/_img_loader.html.haml +++ b/app/views/layouts/_img_loader.html.haml @@ -12,6 +12,7 @@ img.src = imgUrl; img.removeAttribute('data-src'); img.classList.remove('lazy'); - img.classList.add('js-lazy-loaded', 'qa-js-lazy-loaded'); + img.classList.add('js-lazy-loaded'); + img.dataset.qa_selector = 'js_lazy_loaded_content'; }); } diff --git a/app/views/profiles/keys/_form.html.haml b/app/views/profiles/keys/_form.html.haml index b37a0d9cc1a..e6d91543585 100644 --- a/app/views/profiles/keys/_form.html.haml +++ b/app/views/profiles/keys/_form.html.haml @@ -5,12 +5,12 @@ .form-group = f.label :key, s_('Profiles|Key'), class: 'label-bold' - = f.text_area :key, class: "form-control gl-form-input js-add-ssh-key-validation-input qa-key-public-key-field", rows: 8, required: true, data: { supported_algorithms: Gitlab::SSHPublicKey.supported_algorithms } + = f.text_area :key, class: "form-control gl-form-input js-add-ssh-key-validation-input", rows: 8, required: true, data: { supported_algorithms: Gitlab::SSHPublicKey.supported_algorithms, qa_selector: 'key_public_key_field' } %p.form-text.text-muted= s_('Profiles|Begins with %{ssh_key_algorithms}.') % { ssh_key_algorithms: ssh_key_allowed_algorithms } .form-row .col.form-group = f.label :title, s_('Profiles|Title'), class: 'label-bold' - = f.text_field :title, class: "form-control gl-form-input input-lg qa-key-title-field", required: true, placeholder: s_('Profiles|Example: MacBook key') + = f.text_field :title, class: "form-control gl-form-input input-lg", required: true, placeholder: s_('Profiles|Example: MacBook key'), data: { qa_selector: 'key_title_field' } %p.form-text.text-muted= s_('Profiles|Key titles are publicly visible.') .form-row @@ -29,4 +29,4 @@ button_options: { class: 'js-add-ssh-key-validation-confirm-submit' }) do = _("Yes, add it") .gl-mt-3 - = f.submit s_('Profiles|Add key'), class: "js-add-ssh-key-validation-original-submit qa-add-key-button", pajamas_button: true + = f.submit s_('Profiles|Add key'), class: "js-add-ssh-key-validation-original-submit", pajamas_button: true, data: { qa_selector: 'add_key_button' } diff --git a/app/views/projects/_last_push.html.haml b/app/views/projects/_last_push.html.haml index 859f065377d..5b493772f0a 100644 --- a/app/views/projects/_last_push.html.haml +++ b/app/views/projects/_last_push.html.haml @@ -16,5 +16,5 @@ - if create_mr_button_from_event?(event) = c.actions do - = render Pajamas::ButtonComponent.new(variant: :confirm, href: create_mr_path_from_push_event(event), button_options: { class: 'qa-create-merge-request' }) do + = render Pajamas::ButtonComponent.new(variant: :confirm, href: create_mr_path_from_push_event(event), button_options: { data: { qa_selector: 'create_merge_request_button' }}) do = _('Create merge request') diff --git a/app/views/projects/blob/_editor.html.haml b/app/views/projects/blob/_editor.html.haml index bd08ab67cd3..a907e175443 100644 --- a/app/views/projects/blob/_editor.html.haml +++ b/app/views/projects/blob/_editor.html.haml @@ -16,7 +16,7 @@ - if current_action?(:new) || current_action?(:create) %span.float-left.gl-mr-3 \/ - = text_field_tag 'file_name', params[:file_name], placeholder: "File name", + = text_field_tag 'file_name', params[:file_name], placeholder: "File name", data: { qa_selector: 'file_name_field' }, required: true, class: 'form-control gl-form-input new-file-name js-file-path-name-input', value: params[:file_name] || (should_suggest_gitlab_ci_yml? ? '.gitlab-ci.yml' : '') = render 'template_selectors' - if should_suggest_gitlab_ci_yml? @@ -38,7 +38,7 @@ .file-editor.code - if Feature.enabled?(:source_editor_toolbar, current_user) #editor-toolbar - .js-edit-mode-pane.qa-editor#editor{ data: { 'editor-loading': true, qa_selector: 'source_editor_preview_container' } }< + .js-edit-mode-pane#editor{ data: { 'editor-loading': true, qa_selector: 'source_editor_preview_container' } }< %pre.editor-loading-content= params[:content] || local_assigns[:blob_data] - if local_assigns[:path] .js-edit-mode-pane#preview.hide diff --git a/app/views/projects/blob/viewers/_loading.html.haml b/app/views/projects/blob/viewers/_loading.html.haml index 9cb934da7c0..d8efaf9ad95 100644 --- a/app/views/projects/blob/viewers/_loading.html.haml +++ b/app/views/projects/blob/viewers/_loading.html.haml @@ -1 +1 @@ -= gl_loading_icon(size: "md", css_class: "qa-spinner gl-my-4") += gl_loading_icon(size: "md", css_class: "gl-my-4", data: { qa_selector: 'spinner_placeholder' }) diff --git a/app/views/projects/branches/_branch.html.haml b/app/views/projects/branches/_branch.html.haml index 52b8d6bc66f..12e9044ad24 100644 --- a/app/views/projects/branches/_branch.html.haml +++ b/app/views/projects/branches/_branch.html.haml @@ -1,19 +1,19 @@ - merged = local_assigns.fetch(:merged, false) - commit = @repository.commit(branch.dereferenced_target) - merge_project = merge_request_source_project_for_project(@project) -%li{ class: "branch-item gl-display-flex! gl-align-items-center! js-branch-item js-branch-#{branch.name}", data: { name: branch.name } } +%li{ class: "branch-item gl-display-flex! gl-align-items-center! js-branch-item js-branch-#{branch.name}", data: { name: branch.name, qa_selector: 'branch_container', qa_name: branch.name } } .branch-info .gl-display-flex.gl-align-items-center = sprite_icon('branch', size: 12, css_class: 'gl-flex-shrink-0') - = link_to project_tree_path(@project, branch.name), class: 'item-title str-truncated-100 ref-name gl-ml-3 qa-branch-name' do + = link_to project_tree_path(@project, branch.name), class: 'item-title str-truncated-100 ref-name gl-ml-3', data: { qa_selector: 'branch_link' } do = branch.name = clipboard_button(text: branch.name, title: _("Copy branch name")) - if branch.name == @repository.root_ref - = gl_badge_tag s_('DefaultBranchLabel|default'), { variant: :info, size: :sm }, { class: 'gl-ml-2' } + = gl_badge_tag s_('DefaultBranchLabel|default'), { variant: :info, size: :sm }, { class: 'gl-ml-2', data: { qa_selector: 'badge_content' } } - elsif merged - = gl_badge_tag s_('Branches|merged'), { variant: :info, size: :sm }, { class: 'gl-ml-2', title: s_('Branches|Merged into %{default_branch}') % { default_branch: @repository.root_ref }, data: { toggle: 'tooltip', container: 'body' } } + = gl_badge_tag s_('Branches|merged'), { variant: :info, size: :sm }, { class: 'gl-ml-2', title: s_('Branches|Merged into %{default_branch}') % { default_branch: @repository.root_ref }, data: { toggle: 'tooltip', container: 'body', qa_selector: 'badge_content' } } - if protected_branch?(@project, branch) - = gl_badge_tag s_('Branches|protected'), { variant: :success, size: :sm }, { class: 'gl-ml-2' } + = gl_badge_tag s_('Branches|protected'), { variant: :success, size: :sm }, { class: 'gl-ml-2', data: { qa_selector: 'badge_content' } } = render_if_exists 'projects/branches/diverged_from_upstream', branch: branch diff --git a/app/views/projects/branches/_panel.html.haml b/app/views/projects/branches/_panel.html.haml index 6ca5aaf061e..a1f93d21647 100644 --- a/app/views/projects/branches/_panel.html.haml +++ b/app/views/projects/branches/_panel.html.haml @@ -11,7 +11,7 @@ - c.header do = panel_title - c.body do - %ul.content-list.all-branches.qa-all-branches + %ul.content-list.all-branches{ data: { qa_selector: 'all_branches_container' } } - branches.first(overview_max_branches).each do |branch| = render "projects/branches/branch", branch: branch, merged: project.repository.merged_to_root_ref?(branch), commit_status: @branch_pipeline_statuses[branch.name], show_commit_status: @branch_pipeline_statuses.any? - if branches.size > overview_max_branches diff --git a/app/views/projects/branches/index.html.haml b/app/views/projects/branches/index.html.haml index df01900dd1b..f053ce9ced3 100644 --- a/app/views/projects/branches/index.html.haml +++ b/app/views/projects/branches/index.html.haml @@ -14,13 +14,14 @@ - if can? current_user, :push_code, @project = link_to project_merged_branches_path(@project), - class: 'gl-button btn btn-danger btn-danger-secondary has-tooltip qa-delete-merged-branches', + class: 'gl-button btn btn-danger btn-danger-secondary has-tooltip', title: s_("Branches|Delete all branches that are merged into '%{default_branch}'") % { default_branch: @project.repository.root_ref }, method: :delete, aria: { label: s_('Branches|Delete merged branches') }, data: { confirm: s_('Branches|Deleting the merged branches cannot be undone. Are you sure?'), confirm_btn_variant: 'danger', - container: 'body' } do + container: 'body', + qa_selector: 'delete_merged_branches_link' } do = s_('Branches|Delete merged branches') = link_to new_project_branch_path(@project), class: 'gl-button btn btn-confirm' do = s_('Branches|New branch') diff --git a/app/views/projects/empty.html.haml b/app/views/projects/empty.html.haml index 6f2e135f9d3..03158412d5e 100644 --- a/app/views/projects/empty.html.haml +++ b/app/views/projects/empty.html.haml @@ -20,7 +20,7 @@ %p = _('You can get started by cloning the repository or start adding files to it with one of the following options.') -.project-buttons.qa-quick-actions +.project-buttons{ data: { qa_selector: 'quick_actions_container' } } .project-clone-holder.d-block.d-md-none.gl-mt-3.gl-mr-3 = render "shared/mobile_clone_panel" diff --git a/app/views/projects/mirrors/_authentication_method.html.haml b/app/views/projects/mirrors/_authentication_method.html.haml index 4b549aaf1cd..54e1f1a8b20 100644 --- a/app/views/projects/mirrors/_authentication_method.html.haml +++ b/app/views/projects/mirrors/_authentication_method.html.haml @@ -5,10 +5,10 @@ = f.label :auth_method, _('Authentication method'), class: 'label-bold' = f.select :auth_method, options_for_select(auth_options, mirror.auth_method), - {}, { class: "custom-select gl-form-select js-mirror-auth-type qa-authentication-method" } + {}, { class: "custom-select gl-form-select js-mirror-auth-type", data: { qa_selector: 'authentication_method_field' } } = f.hidden_field :auth_method, value: "password", class: "js-hidden-mirror-auth-type" .form-group .well-password-auth.collapse.js-well-password-auth = f.label :password, _("Password"), class: "label-bold" - = f.password_field :password, class: 'form-control gl-form-input qa-password js-mirror-password-field', autocomplete: 'off' + = f.password_field :password, class: 'form-control gl-form-input js-mirror-password-field', autocomplete: 'off', data: { qa_selector: 'password_field' } diff --git a/app/views/projects/mirrors/_disabled_mirror_badge.html.haml b/app/views/projects/mirrors/_disabled_mirror_badge.html.haml index 86e54acecc4..1834627c705 100644 --- a/app/views/projects/mirrors/_disabled_mirror_badge.html.haml +++ b/app/views/projects/mirrors/_disabled_mirror_badge.html.haml @@ -1,2 +1,2 @@ -%span.qa-disabled-mirror-badge.rspec-disabled-mirror-badge{ data: { toggle: 'tooltip', html: 'true' }, title: _('Disabled mirrors can only be enabled by instance owners. It is recommended that you delete them.') } +%span.rspec-disabled-mirror-badge{ data: { toggle: 'tooltip', html: 'true' }, title: _('Disabled mirrors can only be enabled by instance owners. It is recommended that you delete them.') } = gl_badge_tag _('Disabled'), variant: :warning diff --git a/app/views/projects/mirrors/_mirror_repos.html.haml b/app/views/projects/mirrors/_mirror_repos.html.haml index c98f88fa31e..f4e57450aa1 100644 --- a/app/views/projects/mirrors/_mirror_repos.html.haml +++ b/app/views/projects/mirrors/_mirror_repos.html.haml @@ -21,7 +21,7 @@ .form-group.has-feedback = label_tag :url, _('Git repository URL'), class: 'label-light' - = text_field_tag :url, nil, class: 'form-control gl-form-input js-mirror-url js-repo-url qa-mirror-repository-url-input', placeholder: _('Input the remote repository URL'), required: true, pattern: "(#{protocols}):\/\/.+", autocomplete: 'new-password' + = text_field_tag :url, nil, class: 'form-control gl-form-input js-mirror-url js-repo-url', placeholder: _('Input the remote repository URL'), required: true, pattern: "(#{protocols}):\/\/.+", autocomplete: 'new-password', data: { qa_selector: 'mirror_repository_url_field' } = render 'projects/mirrors/instructions' @@ -35,7 +35,7 @@ = link_to _('Learn more.'), help_page_path('user/project/repository/mirror/index.md', anchor: 'mirror-only-protected-branches'), target: '_blank', rel: 'noopener noreferrer' .panel-footer - = f.submit _('Mirror repository'), class: 'js-mirror-submit qa-mirror-repository-button', name: :update_remote_mirror, pajamas_button: true + = f.submit _('Mirror repository'), class: 'js-mirror-submit', name: :update_remote_mirror, pajamas_button: true, data: { qa_selector: 'mirror_repository_button' } - else = render Pajamas::AlertComponent.new(dismissible: false) do |c| = c.body do diff --git a/app/views/projects/mirrors/_mirror_repos_form.html.haml b/app/views/projects/mirrors/_mirror_repos_form.html.haml index 34b7c75debf..1322e677d5a 100644 --- a/app/views/projects/mirrors/_mirror_repos_form.html.haml +++ b/app/views/projects/mirrors/_mirror_repos_form.html.haml @@ -1,7 +1,7 @@ .form-group = label_tag :mirror_direction, _('Mirror direction'), class: 'label-light' .select-wrapper - = select_tag :mirror_direction, options_for_select([[_('Push'), 'push']]), class: 'form-control gl-form-select select-control js-mirror-direction qa-mirror-direction', disabled: true + = select_tag :mirror_direction, options_for_select([[_('Push'), 'push']]), class: 'form-control gl-form-select select-control js-mirror-direction', disabled: true, data: { qa_selector: 'mirror_direction_field' } = sprite_icon('chevron-down', css_class: "gl-icon gl-absolute gl-top-3 gl-right-3 gl-text-gray-200") = render partial: "projects/mirrors/mirror_repos_push", locals: { f: f } diff --git a/app/views/projects/mirrors/_mirror_repos_list.html.haml b/app/views/projects/mirrors/_mirror_repos_list.html.haml index 2dbcbd659c8..fb8133e6de8 100644 --- a/app/views/projects/mirrors/_mirror_repos_list.html.haml +++ b/app/views/projects/mirrors/_mirror_repos_list.html.haml @@ -25,17 +25,17 @@ = render_if_exists 'projects/mirrors/table_pull_row' - @project.remote_mirrors.each_with_index do |mirror, index| - next if mirror.new_record? - %tr.rspec-mirrored-repository-row{ class: ('bg-secondary' if mirror.disabled?), data: { qa_selector: 'mirrored_repository_row' } } - %td{ data: { qa_selector: 'mirror_repository_url_cell' } }= mirror.safe_url || _('Invalid URL') + %tr.rspec-mirrored-repository-row{ class: ('bg-secondary' if mirror.disabled?), data: { qa_selector: 'mirrored_repository_row_container' } } + %td{ data: { qa_selector: 'mirror_repository_url_content' } }= mirror.safe_url || _('Invalid URL') %td= _('Push') %td = mirror.last_update_started_at.present? ? time_ago_with_tooltip(mirror.last_update_started_at) : _('Never') - %td{ data: { qa_selector: 'mirror_last_update_at_cell' } }= mirror.last_update_at.present? ? time_ago_with_tooltip(mirror.last_update_at) : _('Never') + %td{ data: { qa_selector: 'mirror_last_update_at_content' } }= mirror.last_update_at.present? ? time_ago_with_tooltip(mirror.last_update_at) : _('Never') %td - if mirror.disabled? = render 'projects/mirrors/disabled_mirror_badge' - if mirror.last_error.present? - = gl_badge_tag _('Error'), { variant: :danger }, { data: { toggle: 'tooltip', html: 'true', qa_selector: 'mirror_error_badge' }, title: html_escape(mirror.last_error.try(:strip)) } + = gl_badge_tag _('Error'), { variant: :danger }, { data: { toggle: 'tooltip', html: 'true', qa_selector: 'mirror_error_badge_content' }, title: html_escape(mirror.last_error.try(:strip)) } %td.gl-display-flex - if mirror_settings_enabled .btn-group.mirror-actions-group{ role: 'group' } @@ -44,4 +44,4 @@ = render 'shared/remote_mirror_update_button', remote_mirror: mirror = render Pajamas::ButtonComponent.new(variant: :danger, icon: 'remove', - button_options: { class: 'js-delete-mirror qa-delete-mirror rspec-delete-mirror', title: _('Remove'), data: { mirror_id: mirror.id, toggle: 'tooltip', container: 'body' } }) + button_options: { class: 'js-delete-mirror rspec-delete-mirror', title: _('Remove'), data: { mirror_id: mirror.id, toggle: 'tooltip', container: 'body' } }) diff --git a/app/views/projects/pipelines/_info.html.haml b/app/views/projects/pipelines/_info.html.haml index 6f56aea7bd2..7c4b0a5fdb9 100644 --- a/app/views/projects/pipelines/_info.html.haml +++ b/app/views/projects/pipelines/_info.html.haml @@ -19,7 +19,7 @@ = s_("Pipelines|(queued for %{queued_duration})") % { queued_duration: time_interval_in_words(@pipeline.queued_duration)} - if has_pipeline_badges?(@pipeline) - .well-segment.qa-pipeline-badges + .well-segment .icon-container = sprite_icon('flag', css_class: 'gl-top-0!') - if @pipeline.schedule? diff --git a/app/views/projects/protected_branches/shared/_dropdown.html.haml b/app/views/projects/protected_branches/shared/_dropdown.html.haml index d5111bd8be5..c5dbf8991cd 100644 --- a/app/views/projects/protected_branches/shared/_dropdown.html.haml +++ b/app/views/projects/protected_branches/shared/_dropdown.html.haml @@ -3,14 +3,16 @@ = f.hidden_field(:name) = dropdown_tag(_('Select branch or create wildcard'), - options: { toggle_class: "js-protected-branch-select js-filter-submit wide monospace qa-protected-branch-select #{toggle_classes}", + options: { toggle_class: "js-protected-branch-select js-filter-submit wide monospace #{toggle_classes}", filter: true, - dropdown_class: "dropdown-menu-selectable git-revision-dropdown qa-protected-branch-dropdown", + dropdown_class: "dropdown-menu-selectable git-revision-dropdown", + dropdown_qa_selector: "protected_branch_dropdown_content", placeholder: _("Search protected branches"), footer_content: true, data: { show_no: true, show_any: true, show_upcoming: true, selected: params[:protected_branch_name], - project_id: @project.try(:id) } }) do + project_id: @project.try(:id), + qa_selector: "protected_branch_dropdown" } }) do %ul.dropdown-footer-list %li diff --git a/app/views/projects/protected_branches/shared/_index.html.haml b/app/views/projects/protected_branches/shared/_index.html.haml index 1d60791eae2..c204508d355 100644 --- a/app/views/projects/protected_branches/shared/_index.html.haml +++ b/app/views/projects/protected_branches/shared/_index.html.haml @@ -4,7 +4,7 @@ .settings-header %h4.settings-title.js-settings-toggle.js-settings-toggle-trigger-only = s_("ProtectedBranch|Protected branches") - = render Pajamas::ButtonComponent.new(button_options: { class: 'js-settings-toggle qa-expand-protected-branches' }) do + = render Pajamas::ButtonComponent.new(button_options: { class: 'js-settings-toggle' }) do = expanded ? _('Collapse') : _('Expand') %p = s_("ProtectedBranch|Keep stable branches secure and force developers to use merge requests.") diff --git a/app/views/projects/settings/ci_cd/show.html.haml b/app/views/projects/settings/ci_cd/show.html.haml index c4f589f3f91..1b35de85145 100644 --- a/app/views/projects/settings/ci_cd/show.html.haml +++ b/app/views/projects/settings/ci_cd/show.html.haml @@ -57,7 +57,7 @@ .settings-content #js-artifacts-settings-app{ data: { full_path: @project.full_path, help_page_path: help_page_path('ci/pipelines/job_artifacts', anchor: 'keep-artifacts-from-most-recent-successful-jobs') } } -%section.qa-variables-settings.settings.no-animate#js-cicd-variables-settings{ class: ('expanded' if expanded), data: { qa_selector: 'variables_settings_content' } } +%section.settings.no-animate#js-cicd-variables-settings{ class: ('expanded' if expanded), data: { qa_selector: 'variables_settings_content' } } .settings-header = render 'ci/variables/header', expanded: expanded .settings-content diff --git a/app/views/projects/snippets/show.html.haml b/app/views/projects/snippets/show.html.haml index 7c4492fb901..58e86ebffa0 100644 --- a/app/views/projects/snippets/show.html.haml +++ b/app/views/projects/snippets/show.html.haml @@ -3,7 +3,7 @@ - breadcrumb_title @snippet.to_reference - page_title "#{@snippet.title} (#{@snippet.to_reference})", _("Snippets") -#js-snippet-view{ data: {'qa-selector': 'snippet_view', 'snippet-gid': @snippet.to_global_id, 'report-abuse-path': snippet_report_abuse_path(@snippet), 'can-report-spam': @snippet.submittable_as_spam_by?(current_user).to_s } } +#js-snippet-view{ data: { 'snippet-gid': @snippet.to_global_id, 'report-abuse-path': snippet_report_abuse_path(@snippet), 'can-report-spam': @snippet.submittable_as_spam_by?(current_user).to_s } } .gl-px-0.gl-py-2 = render 'award_emoji/awards_block', awardable: @snippet, inline: true, api_awards_path: project_snippets_award_api_path(@snippet) diff --git a/app/views/shared/empty_states/_snippets.html.haml b/app/views/shared/empty_states/_snippets.html.haml index a006a3bc0a4..e34166bac6c 100644 --- a/app/views/shared/empty_states/_snippets.html.haml +++ b/app/views/shared/empty_states/_snippets.html.haml @@ -2,8 +2,8 @@ .row.empty-state .col-12 - .svg-content - = image_tag 'illustrations/snippets_empty.svg', data: { qa_selector: 'svg_content' } + .svg-content{ data: { qa_selector: 'svg_content' } } + = image_tag 'illustrations/snippets_empty.svg' .text-content.gl-text-center.gl-pt-0 - if current_user %h4 diff --git a/app/views/shared/issuable/_sidebar.html.haml b/app/views/shared/issuable/_sidebar.html.haml index 4199b7e870b..7adc38f833f 100644 --- a/app/views/shared/issuable/_sidebar.html.haml +++ b/app/views/shared/issuable/_sidebar.html.haml @@ -20,7 +20,7 @@ .js-issuable-todo{ data: { project_path: issuable_sidebar[:project_full_path], iid: issuable_sidebar[:iid], id: issuable_sidebar[:id] } } = form_for issuable_type, url: issuable_sidebar[:issuable_json_path], remote: true, html: { class: 'issuable-context-form inline-update js-issuable-update' } do |f| - .block.assignee.qa-assignee-block{ class: "#{'gl-mt-3' if !signed_in && moved_sidebar_enabled}", data: { qa_selector: 'assignee_block_container' } } + .block.assignee{ class: "#{'gl-mt-3' if !signed_in && moved_sidebar_enabled}", data: { qa_selector: 'assignee_block_container' } } = render "shared/issuable/sidebar_assignees", issuable_sidebar: issuable_sidebar, assignees: assignees, signed_in: signed_in - if issuable_sidebar[:supports_severity] diff --git a/app/views/snippets/show.html.haml b/app/views/snippets/show.html.haml index 47ccc449e1b..bb43c3c6274 100644 --- a/app/views/snippets/show.html.haml +++ b/app/views/snippets/show.html.haml @@ -12,7 +12,7 @@ - content_for :prefetch_asset_tags do - webpack_preload_asset_tag('monaco', prefetch: true) -#js-snippet-view{ data: {'qa-selector': 'snippet_view', 'snippet-gid': @snippet.to_global_id, 'report-abuse-path': snippet_report_abuse_path(@snippet), 'can-report-spam': @snippet.submittable_as_spam_by?(current_user).to_s } } +#js-snippet-view{ data: { 'snippet-gid': @snippet.to_global_id, 'report-abuse-path': snippet_report_abuse_path(@snippet), 'can-report-spam': @snippet.submittable_as_spam_by?(current_user).to_s } } .row-content-block.top-block.content-component-block.gl-px-0.gl-py-2 = render 'award_emoji/awards_block', awardable: @snippet, inline: true diff --git a/app/workers/cluster_configure_istio_worker.rb b/app/workers/cluster_configure_istio_worker.rb index 0def66b7381..8bf723d89f7 100644 --- a/app/workers/cluster_configure_istio_worker.rb +++ b/app/workers/cluster_configure_istio_worker.rb @@ -1,5 +1,8 @@ # frozen_string_literal: true +# DEPRECATED +# +# To be removed by https://gitlab.com/gitlab-org/gitlab/-/issues/366573 class ClusterConfigureIstioWorker # rubocop:disable Scalability/IdempotentWorker include ApplicationWorker @@ -10,9 +13,5 @@ class ClusterConfigureIstioWorker # rubocop:disable Scalability/IdempotentWorker worker_has_external_dependencies! - def perform(cluster_id) - Clusters::Cluster.find_by_id(cluster_id).try do |cluster| - Clusters::Kubernetes::ConfigureIstioIngressService.new(cluster: cluster).execute - end - end + def perform(cluster_id); end end diff --git a/app/workers/run_pipeline_schedule_worker.rb b/app/workers/run_pipeline_schedule_worker.rb index 35e3e633c70..e967513ba7a 100644 --- a/app/workers/run_pipeline_schedule_worker.rb +++ b/app/workers/run_pipeline_schedule_worker.rb @@ -21,13 +21,12 @@ class RunPipelineScheduleWorker # rubocop:disable Scalability/IdempotentWorker end def run_pipeline_schedule(schedule, user) - Ci::CreatePipelineService.new(schedule.project, - user, - ref: schedule.ref) - .execute!(:schedule, ignore_skip_ci: true, save_on_errors: false, schedule: schedule) - rescue Ci::CreatePipelineService::CreateError => e - # This is a user operation error such as corrupted .gitlab-ci.yml. Log the error for debugging purpose. - log_extra_metadata_on_done(:pipeline_creation_error, e) + if ::Feature.enabled?(:refactored_create_pipeline_execution_method, schedule.project) + create_pipeline_refactored(schedule, user) + else + create_pipeline_legacy(schedule, user) + end + rescue StandardError => e error(schedule, e) end @@ -57,4 +56,24 @@ class RunPipelineScheduleWorker # rubocop:disable Scalability/IdempotentWorker Gitlab::Metrics.counter(:pipeline_schedule_creation_failed_total, "Counter of failed attempts of pipeline schedule creation") end + + def create_pipeline_refactored(schedule, user) + response = Ci::CreatePipelineService + .new(schedule.project, user, ref: schedule.ref) + .execute(:schedule, ignore_skip_ci: true, save_on_errors: false, schedule: schedule) + + return response if response.payload.persisted? + + # This is a user operation error such as corrupted .gitlab-ci.yml. Log the error for debugging purpose. + log_extra_metadata_on_done(:pipeline_creation_error, response.message) + end + + def create_pipeline_legacy(schedule, user) + Ci::CreatePipelineService + .new(schedule.project, user, ref: schedule.ref) + .execute!(:schedule, ignore_skip_ci: true, save_on_errors: false, schedule: schedule) + rescue Ci::CreatePipelineService::CreateError => e + # This is a user operation error such as corrupted .gitlab-ci.yml. Log the error for debugging purpose. + log_extra_metadata_on_done(:pipeline_creation_error, e) + end end diff --git a/config/feature_flags/development/refactored_create_pipeline_execution_method.yml b/config/feature_flags/development/refactored_create_pipeline_execution_method.yml new file mode 100644 index 00000000000..9734c7b1e71 --- /dev/null +++ b/config/feature_flags/development/refactored_create_pipeline_execution_method.yml @@ -0,0 +1,8 @@ +--- +name: refactored_create_pipeline_execution_method +introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/98965 +rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/378257 +milestone: '15.6' +type: development +group: group::pipeline execution +default_enabled: false diff --git a/doc/administration/geo/replication/troubleshooting.md b/doc/administration/geo/replication/troubleshooting.md index 0931a551b23..e46f3b40046 100644 --- a/doc/administration/geo/replication/troubleshooting.md +++ b/doc/administration/geo/replication/troubleshooting.md @@ -317,7 +317,6 @@ sudo gitlab-rake gitlab:geo:check to gather the following, basic troubleshooting information. WARNING: - Commands that change data can cause damage if not run correctly or under the right conditions. Always run commands in a test environment first and have a backup instance ready to restore. #### Get the number of verification failed repositories @@ -855,7 +854,6 @@ therefore short-circuited. `last_sync_failure` is now set to `The file is missin examples, but things generally work the same for the other types. WARNING: - Commands that change data can cause damage if not run correctly or under the right conditions. Always run commands in a test environment first and have a backup instance ready to restore. #### The Replicator diff --git a/doc/administration/operations/rails_console.md b/doc/administration/operations/rails_console.md index f818d2d1a3c..efaf480c6df 100644 --- a/doc/administration/operations/rails_console.md +++ b/doc/administration/operations/rails_console.md @@ -736,7 +736,6 @@ ApplicationSetting.current ### Open object in `irb` WARNING: - Commands that change data can cause damage if not run correctly or under the right conditions. Always run commands in a test environment first and have a backup instance ready to restore. Sometimes it is easier to go through a method if you are in the context of the object. You can shim into the namespace of `Object` to let you open `irb` in the context of any object: diff --git a/doc/api/deployments.md b/doc/api/deployments.md index 3984bfe0eeb..daf2b635855 100644 --- a/doc/api/deployments.md +++ b/doc/api/deployments.md @@ -23,7 +23,7 @@ GET /projects/:id/deployments | `updated_after` | datetime | no | Return deployments updated after the specified date. Expected in ISO 8601 format (`2019-03-15T08:00:00Z`). | | `updated_before` | datetime | no | Return deployments updated before the specified date. Expected in ISO 8601 format (`2019-03-15T08:00:00Z`). | | `environment` | string | no | The [name of the environment](../ci/environments/index.md) to filter deployments by. | -| `status` | string | no | The status to filter deployments by. One of `created`, `running`, `success`, `failed`, `canceled`, `blocked`. +| `status` | string | no | The status to filter deployments by. One of `created`, `running`, `success`, `failed`, `canceled`, or `blocked`. ```shell curl --header "PRIVATE-TOKEN: " "https://gitlab.example.com/api/v4/projects/1/deployments" @@ -487,7 +487,11 @@ curl --request "DELETE" --header "PRIVATE-TOKEN: " "https://g Example responses: ```json -{ "message": "202 Accepted" } +{ "message": "204 Deployment destroyed" } +``` + +```json +{ "message": "403 Forbidden" } ``` ```json diff --git a/doc/api/feature_flag_user_lists.md b/doc/api/feature_flag_user_lists.md index ef65da64668..ca4ca755d08 100644 --- a/doc/api/feature_flag_user_lists.md +++ b/doc/api/feature_flag_user_lists.md @@ -70,8 +70,8 @@ POST /projects/:id/feature_flags_user_lists | Attribute | Type | Required | Description | | ------------------- | ---------------- | ---------- | ---------------------------------------------------------------------------------------| | `id` | integer/string | yes | The ID or [URL-encoded path of the project](index.md#namespaced-path-encoding). | -| `name` | string | yes | The name of the feature flag. | -| `user_xids` | string | yes | A comma-separated list of user IDs. | +| `name` | string | yes | The name of the list. | +| `user_xids` | string | yes | A comma-separated list of external user IDs. | ```shell curl "https://gitlab.example.com/api/v4/projects/1/feature_flags_user_lists" \ @@ -142,8 +142,8 @@ PUT /projects/:id/feature_flags_user_lists/:iid | ------------------- | ---------------- | ---------- | ---------------------------------------------------------------------------------------| | `id` | integer/string | yes | The ID or [URL-encoded path of the project](index.md#namespaced-path-encoding). | | `iid` | integer/string | yes | The internal ID of the project's feature flag user list. | -| `name` | string | no | The name of the feature flag. | -| `user_xids` | string | no | A comma-separated list of user IDs. | +| `name` | string | no | The name of the list. | +| `user_xids` | string | no | A comma-separated list of external user IDs. | ```shell curl "https://gitlab.example.com/api/v4/projects/1/feature_flags_user_lists/1" \ diff --git a/doc/api/feature_flags.md b/doc/api/feature_flags.md index c4d766a6319..55eb62f9a0d 100644 --- a/doc/api/feature_flags.md +++ b/doc/api/feature_flags.md @@ -151,7 +151,7 @@ POST /projects/:id/feature_flags | `strategies:name` | JSON | no | The strategy name. Can be `default`, `gradualRolloutUserId`, `userWithId`, or `gitlabUserList`. In [GitLab 13.5](https://gitlab.com/gitlab-org/gitlab/-/issues/36380) and later, can be [`flexibleRollout`](https://docs.getunleash.io/user_guide/activation_strategy#gradual-rollout). | | `strategies:parameters` | JSON | no | The strategy parameters. | | `strategies:scopes` | JSON | no | The scopes for the strategy. | -| `strategies:scopes:environment_scope` | string | no | The environment spec for the scope. | +| `strategies:scopes:environment_scope` | string | no | The environment scope of the scope. | ```shell curl "https://gitlab.example.com/api/v4/projects/1/feature_flags" \ @@ -213,8 +213,8 @@ PUT /projects/:id/feature_flags/:feature_flag_name | `strategies:name` | JSON | no | The strategy name. | | `strategies:parameters` | JSON | no | The strategy parameters. | | `strategies:scopes` | JSON | no | The scopes for the strategy. | -| `strategies:scopes:id` | JSON | no | The scopes ID. | -| `strategies:scopes:environment_scope` | string | no | The environment spec for the scope. | +| `strategies:scopes:id` | JSON | no | The environment scope ID. | +| `strategies:scopes:environment_scope` | string | no | The environment scope of the scope. | ```shell curl "https://gitlab.example.com/api/v4/projects/1/feature_flags/awesome_feature" \ diff --git a/doc/api/graphql/reference/index.md b/doc/api/graphql/reference/index.md index 8555d8c6789..432f338b5af 100644 --- a/doc/api/graphql/reference/index.md +++ b/doc/api/graphql/reference/index.md @@ -18081,6 +18081,7 @@ Counts of requirements by their state. | Name | Type | Description | | ---- | ---- | ----------- | +| `assignRunner` | [`Boolean!`](#boolean) | Indicates the user can perform `assign_runner` on this resource. | | `deleteRunner` | [`Boolean!`](#boolean) | Indicates the user can perform `delete_runner` on this resource. | | `readRunner` | [`Boolean!`](#boolean) | Indicates the user can perform `read_runner` on this resource. | | `updateRunner` | [`Boolean!`](#boolean) | Indicates the user can perform `update_runner` on this resource. | diff --git a/doc/ci/pipelines/job_artifacts.md b/doc/ci/pipelines/job_artifacts.md index 33a9069240b..20818f35327 100644 --- a/doc/ci/pipelines/job_artifacts.md +++ b/doc/ci/pipelines/job_artifacts.md @@ -396,7 +396,19 @@ a project, you can disable this behavior to save space: You can disable this behavior for all projects on a self-managed instance in the [instance's CI/CD settings](../../user/admin_area/settings/continuous_integration.md#keep-the-latest-artifacts-for-all-jobs-in-the-latest-successful-pipelines). -## Troubleshooting job artifacts +## Troubleshooting + +### Job does not retrieve certain artifacts + +By default, jobs fetch all artifacts from previous stages, but jobs using `dependencies` +or `needs` do not fetch artifacts from all jobs by default. + +If you use these keywords, artifacts are fetched from only a subset of jobs. Review +the keyword reference for information on how to fetch artifacts with these keywords: + +- [`dependencies`](../yaml/index.md#dependencies) +- [`needs`](../yaml/index.md#needs) +- [`needs:artifacts`](../yaml/index.md#needsartifacts) ### Error message `No files to upload` diff --git a/doc/development/gitlab_flavored_markdown/specification_guide/index.md b/doc/development/gitlab_flavored_markdown/specification_guide/index.md index 95d06907aa6..e64c145b3a3 100644 --- a/doc/development/gitlab_flavored_markdown/specification_guide/index.md +++ b/doc/development/gitlab_flavored_markdown/specification_guide/index.md @@ -34,7 +34,7 @@ info: To determine the technical writer assigned to the Stage/Group associated w against the official specification. - They support [snapshot testing](#markdown-snapshot-testing) of GitLab internal GLFM processing logic. This is accomplished by automatically - generating YAML ["example snapshot files"](#example-snapshot-files) + generating YAML ["example snapshot files"](#output-example-snapshot-files) which are used as fixtures to drive automated testing within the GitLab app. - There are [various scripts and logic](#scripts) which are used to accomplish the above goals. @@ -104,13 +104,13 @@ serve as input to automated conformance tests. It is Here are the HTML-rendered versions of the specifications: -- [GitLab Flavored Markdown (GLFM) specification](https://gitlab.com/gitlab-org/gitlab/-/blob/master/glfm_specification/output/spec.html), which extends the: +- [GitLab Flavored Markdown (GLFM) specification](https://gitlab.com/gitlab-org/gitlab/-/blob/master/glfm_specification/output_spec/spec.html), which extends the: - [GitHub Flavored Markdown (GFM) specification](https://github.github.com/gfm/) (rendered from the [source `spec.txt` for GFM specification](https://github.com/github/cmark-gfm/blob/master/test/spec.txt)), which extends the: - [CommonMark specification](https://spec.commonmark.org/0.30/) (rendered from the [source `spec.txt` for CommonMark specification](https://github.com/commonmark/commonmark-spec/blob/master/spec.txt)) NOTE: The creation of the -[HTML-rendered version of the GitLab Flavored Markdown (GLFM) specification](https://gitlab.com/gitlab-org/gitlab/-/blob/master/glfm_specification/output/spec.html) +[HTML-rendered version of the GitLab Flavored Markdown (GLFM) specification](https://gitlab.com/gitlab-org/gitlab/-/blob/master/glfm_specification/output_spec/spec.html) file is still pending. However, GLFM has more complex parsing, rendering, and testing requirements than @@ -177,7 +177,7 @@ In this context, it should not be confused with other similar or related meaning _example_, such as [RSpec examples](https://relishapp.com/rspec/rspec-core/docs/example-groups/basic-structure-describe-it). -See the section on the [`glfm_official_specification_examples.md`](#glfm_official_specification_examplesmd) file +See the section on the [`glfm_official_specification.md`](#glfm_official_specificationmd) file for more details on the backtick-delimited Markdown+HTML example syntax. ### Parsers and renderers @@ -341,7 +341,7 @@ The GitLab [Markdown API](../../../api/markdown.md) generates HTML for a given Markdown string using this method. The Markdown specified in the [Markdown examples](#markdown-examples) is used to automatically generate HTML in -[`glfm_specification/example_snapshots/html.yml`](#glfm_specificationexample_snapshotshtmlyml) via +[`glfm_specification/output_example_snapshots/html.yml`](#htmlyml) via [`update-example-snapshots.rb`](#update-example-snapshotsrb-script). These examples are used when running [Markdown snapshot testing](#markdown-snapshot-testing). @@ -353,7 +353,7 @@ in the ProseMirror WYSIWYG editor. Just like static HTML, the Markdown specified in the [Markdown examples](#markdown-examples) is used to automatically generate HTML in -[`glfm_specification/example_snapshots/html.yml`](#glfm_specificationexample_snapshotshtmlyml) via +[`glfm_specification/output_example_snapshots/html.yml`](#htmlyml) via [`update-example-snapshots.rb`](#update-example-snapshotsrb-script). These examples are used when running [Markdown snapshot testing](#markdown-snapshot-testing). @@ -387,10 +387,10 @@ Here are more details on the sources of canonical HTML examples: version of [`spec.txt`](#spectxt). 1. For the examples which are part of the GLFM [_official specification_](#official-specifications), the canonical HTML is manually maintained and curated via the examples contained in the - [`glfm_official_specification_examples.md`](#glfm_official_specification_examplesmd) [input specification file](#input-specification-files). + [`glfm_official_specification.md`](#glfm_official_specificationmd) [input specification file](#input-specification-files). 1. For the examples which are part of the GLFM [_internal extensions_](#internal-extensions), the canonical HTML **is never specified**, and **must be left empty in all examples** contained in - the [`glfm_internal_extension_examples.md`](#glfm_internal_extension_examplesmd) [input specification file](#input-specification-files). + the [`glfm_internal_extensions.md`](#glfm_internal_extensionsmd) [input specification file](#input-specification-files). ### Canonicalization of HTML @@ -401,7 +401,7 @@ or HTML elements, to support specific appearance and behavioral requirements. Neither the backend nor the frontend rendering logic can directly render the clean, basic HTML which is necessary to perform comparison to the [canonical HTML](#canonical-html) when running [Markdown conformance testing](#markdown-conformance-testing) -for the [GLFM official specification examples](#glfm_official_specification_examplesmd). +for the [GLFM official specification examples](#glfm_official_specificationmd). Nor should they be able to, because: @@ -443,7 +443,7 @@ Fixture-based normalization should be used whenever possible, because it is simp understand than regex-based normalization. The [Markdown snapshot testing](#markdown-snapshot-testing) uses RSpec to generate the -[example snapshot files](#example-snapshot-files). RSpec enables you to: +[example snapshot files](#output-example-snapshot-files). RSpec enables you to: - Use the same powerful fixture support and helpers as all the rest of the GitLab RSpec suite. - Use fixtures to control the state of the database when the example snapshots are generated. @@ -575,10 +575,10 @@ The documentation on the implementation is split into three sections: 1. [Scripts](#scripts). 1. [Specification files](#specification-files). -1. [Example snapshot files](#example-snapshot-files): +1. [Example snapshot files](#output-example-snapshot-files): These YAML files are used as input data or fixtures to drive the various tests, and are located under - `glfm_specification/example_snapshots`. All example snapshot files are automatically + `glfm_specification/output_example_snapshots`. All example snapshot files are automatically generated based on the specification files and the implementation of the parsers and renderers. However, they can also be directly edited if necessary, such as to test-drive an incomplete implementation. @@ -620,8 +620,8 @@ end subgraph input:
input specification files C[ghfm_spec_v_0.29.md] --> A D[glfm_intro.md] --> A - E[glfm_official_specification_examples.md] --> A - F[glfm_internal_extension_examples.md] --> A + E[glfm_official_specification.md] --> A + F[glfm_internal_extensions.md] --> A end subgraph output:
GLFM specification files A --> G[spec.txt] @@ -646,7 +646,7 @@ script, which expects canonical HTML, against the GitLab renderer implementation `scripts/glfm/run-spec-tests.sh` is a convenience shell script which runs conformance specs via the CommonMark standard `spec_tests.py` script, -which uses the `glfm_specification/output/spec.txt` file and `scripts/glfm/canonicalize-html.rb` +which uses the `glfm_specification/output_spec/spec.txt` file and `scripts/glfm/canonicalize-html.rb` helper script to test the GLFM renderer implementations' support for rendering Markdown specification examples to canonical HTML. @@ -672,9 +672,9 @@ end #### `update-example-snapshots.rb` script The `scripts/glfm/update-example-snapshots.rb` script uses the GLFM -`glfm_specification/output/spec.txt` specification file and the +`glfm_specification/output_spec/spec.txt` specification file and the `glfm_specification/input/gitlab_flavored_markdown/glfm_example_status.yml` -file to create and update the [example snapshot](#example-snapshot-files) +file to create and update the [example snapshot](#output-example-snapshot-files) YAML files: ```mermaid @@ -746,7 +746,7 @@ runs the [`update-specification.rb`](#update-specificationrb-script). It fails with an exception and non-zero return code if running these scripts results in any diffs to the generated and committed [output specification files](#output-specification-files) or -[example snapshot files](#example-snapshot-files). +[example snapshot files](#output-example-snapshot-files). This script is run via the `glfm-verify` CI job to ensure that all changes to the [input specification files](#input-specification-files) @@ -766,12 +766,16 @@ subcategories based on their usage and purpose: [`ghfm_spec_v_0.29.md`](#github-flavored-markdown-specification) specification. - `gitlab_flavored_markdown`: Contains all `glfm_*` files. - `*.md` [input specification files](#input-specification-files), - which represent the GLFM specification itself. + which represent the source of truth for the GLFM specification and all associated examples. - `*.yml` [input specification configuration files](#input-specification-configuration-files), which control various aspects of the automated GLFM scripts and processes. - - `output`: Contains [output specification files](#output-specification-files), - which are automatically generated from the + - `output_spec`: Contains the `spec.txt` and `spec.html` [output specification files](#output-specification-files), + which represent the [GLFM official specification](#official-specifications), and are automatically generated from the input files by running the [`update-specification.rb`](#update-specificationrb-script) script. + - `output_example_snapshots`: Contains [output example snapshot files](#output-example-snapshot-files). + which are used to drive [snapshot testing](#markdown-snapshot-testing), and are automatically generated from the + input files by running the [`update-specification.rb`](#update-specificationrb-script) + and [`scripts/glfm/update-example-snapshots.rb`](#update-example-snapshotsrb-script) scripts. #### Input specification files @@ -790,31 +794,22 @@ is a copy of the official latest [GFM `spec.txt`](https://github.com/github/cmar - When it is downloaded, the version number is added to the filename. - The extension is changed from `*.txt` to `*.md` so that it can be handled better by Markdown editors. +It currently contains additional **Introduction** and **Appendix** prose-only header sections which do not +contain any examples. + +All header sections which contain examples are expected to be contained within a contiguous file section +which is delimited by: + +1. The beginning of the second H1 header (the first one after the **Introduction** section) +1. An `` HTML comment line. + NOTE: For extra clarity, this file uses the `ghfm` acronym in its name instead of `gfm`, as explained in the [Acronyms section](#acronyms-glfm-ghfm-gfm-commonmark). -##### `glfm_intro.md` +##### `glfm_official_specification.md` -[`glfm_specification/input/gitlab_flavored_markdown/glfm_intro.md`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/glfm_specification/input/gitlab_flavored_markdown/glfm_intro.md) -is the GitLab-specific version of the prose in the introduction section of the GLFM specification. - -- It is manually updated. -- The `update-specification.rb` script inserts it into the generated GLFM `spec.txt` to replace - the GitHub-specific GFM version of the introductory section. - -##### `glfm_canonical_examples.txt` - -The `glfm_canonical_examples.txt` file is deprecated and no longer exists. It has been replaced by two files: - -- [`glfm_official_specification_examples.md`](#glfm_official_specification_examplesmd) - which contains the [GLFM official specification](#official-specifications) examples. -- [`glfm_internal_extension_examples.md`](#glfm_internal_extension_examplesmd) - which contains the [GLFM internal extension](#internal-extensions) examples. - -##### `glfm_official_specification_examples.md` - -[`glfm_specification/input/gitlab_flavored_markdown/glfm_official_specification_examples.md`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/glfm_specification/input/gitlab_flavored_markdown/glfm_official_specification_examples.md) +[`glfm_specification/input/gitlab_flavored_markdown/glfm_official_specification.md`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/glfm_specification/input/gitlab_flavored_markdown/glfm_official_specification.md) consists of the manually updated Markdown+HTML examples for the [GLFM official specification](#official-specifications), and their associated documentation and descriptions. @@ -832,7 +827,12 @@ consists of the manually updated Markdown+HTML examples for the - `H3` header sections must be nested within `H2` header sections. They cannot be nested directly within `H1` header sections. -`glfm_specification/input/gitlab_flavored_markdown/glfm_official_specification_examples.md` sample entries: +It _may_ contain additional prose-only header sections which do not contain any examples. + +All header sections which contain examples _must_ be contained within a contiguous file section which +is delimited by `` and `` HTML comment lines. + +`glfm_specification/input/gitlab_flavored_markdown/glfm_official_specification.md` sample entries: @@ -864,13 +864,13 @@ bold -##### `glfm_internal_extension_examples.md` +##### `glfm_internal_extensions.md` -[`glfm_specification/input/gitlab_flavored_markdown/glfm_internal_extension_examples.md`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/glfm_specification/input/gitlab_flavored_markdown/glfm_internal_extension_examples.md) +[`glfm_specification/input/gitlab_flavored_markdown/glfm_internal_extensions.md`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/glfm_specification/input/gitlab_flavored_markdown/glfm_internal_extensions.md) consists of the manually updated Markdown examples for the [GLFM internal extensions](#internal-extensions), and their associated documentation and descriptions. -Its general format is identical to [`glfm_official_specification_examples.md`](#glfm_official_specification_examplesmd), +Its general format is identical to [`glfm_official_specification.md`](#glfm_official_specificationmd), consisting of `H1`, `H2`, or `H3` sections containing [Markdown examples](#markdown-examples) in the [standard backtick-delimited `spec.txt` format](#various-markdown-specifications). @@ -878,7 +878,12 @@ However, as described in the [canonical HTML section](#canonical-html), only the example is specified, and the HTML portion is left empty, because internal extension examples are never used for [Markdown conformance testing](#markdown-conformance-testing). -`glfm_specification/input/gitlab_flavored_markdown/glfm_official_specification_examples.md` sample entries: +It _may_ contain additional prose-only header sections which do not contain any examples. + +All header sections which contain examples _must_ be contained within a contiguous file section which +is delimited by `` and `` HTML comment lines. + +`glfm_specification/input/gitlab_flavored_markdown/glfm_official_specification.md` sample entries: NOTE: All lines in this example are prefixed with a `|` character. This prefix helps avoid false @@ -908,7 +913,7 @@ See the main [specification files](#specification-files) section for more contex All of the manually curated example names in the configuration files must correspond to an existing [Markdown example](#markdown-examples) name found in -[`example_snapshots/examples_index.yml`](#glfm_specificationexample_snapshotsexamples_indexyml), +[`output_example_snapshots/examples_index.yml`](#examples_indexyml), which is automatically generated based on the [input specification files](#input-specification-files). If there is an invalid reference to an example name that does not exist, the @@ -943,16 +948,16 @@ controls the behavior of the [scripts](#scripts) and [tests](#types-of-markdown- The following optional entries are supported for each example. They all default to `false`: - `skip_update_example_snapshots`: When true, skips any addition or update of any this example's entries - in the [`glfm_specification/example_snapshots/html.yml`](#glfm_specificationexample_snapshotshtmlyml) file - or the [`glfm_specification/example_snapshots/prosemirror_json.yml`](#glfm_specificationexample_snapshotsprosemirror_jsonyml) file. + in the [`glfm_specification/output_example_snapshots/html.yml`](#htmlyml) file + or the [`glfm_specification/output_example_snapshots/prosemirror_json.yml`](#prosemirror_jsonyml) file. If this value is truthy, then no other `skip_update_example_snapshot_*` entries can be truthy, and an error is raised if any of them are. - `skip_update_example_snapshot_html_static`: When true, skips addition or update of this example's [static HTML](#static-html) - entry in the [`glfm_specification/example_snapshots/html.yml`](#glfm_specificationexample_snapshotshtmlyml) file. + entry in the [`glfm_specification/output_example_snapshots/html.yml`](#htmlyml) file. - `skip_update_example_snapshot_html_wysiwyg`: When true, skips addition or update of this example's [WYSIWYG HTML](#wysiwyg-html) - entry in the [`glfm_specification/example_snapshots/html.yml`](#glfm_specificationexample_snapshotshtmlyml) file. + entry in the [`glfm_specification/output_example_snapshots/html.yml`](#htmlyml) file. - `skip_update_example_snapshot_prosemirror_json`: When true, skips addition or update of this example's - entry in the [`glfm_specification/example_snapshots/prosemirror_json.yml`](#glfm_specificationexample_snapshotsprosemirror_jsonyml) file. + entry in the [`glfm_specification/output_example_snapshots/prosemirror_json.yml`](#prosemirror_jsonyml) file. - `skip_running_conformance_static_tests`: When true, skips running the [Markdown conformance tests](#markdown-conformance-testing) of the [static HTML](#static-html) for this example. - `skip_running_conformance_wysiwyg_tests`: When true, skips running the [Markdown conformance tests](#markdown-conformance-testing) @@ -962,7 +967,7 @@ The following optional entries are supported for each example. They all default - `skip_running_snapshot_wysiwyg_html_tests`: When true, skips running the [Markdown snapshot tests](#markdown-snapshot-testing) of the [WYSIWYG HTML](#wysiwyg-html) for this example. - `skip_running_snapshot_prosemirror_json_tests`: When true, skips running the [Markdown snapshot tests](#markdown-snapshot-testing) - of the [ProseMirror JSON](#glfm_specificationexample_snapshotsprosemirror_jsonyml) for this example. + of the [ProseMirror JSON](#prosemirror_jsonyml) for this example. `glfm_specification/input/gitlab_flavored_markdown/glfm_example_status.yml` sample entry: @@ -1033,9 +1038,9 @@ or [environment-variable-based normalization](#environment-variable-based-normal snapshot: 07_01_00_href: *07_01_00_href 07_01_00_id: *07_01_00_id - wysiwyg: - 07_01_00_href: *07_01_00_href - 07_01_00_id: *07_01_00_id + wysiwyg: + 07_01_00_href: *07_01_00_href + 07_01_00_id: *07_01_00_id prosemirror_json: 07_01_00_href: *07_01_00_href 07_01_00_id: *07_01_00_id @@ -1093,36 +1098,66 @@ move or copy a hosted version of the rendered HTML `spec.html` version to anothe ##### spec.txt -[`glfm_specification/output/spec.txt`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/glfm_specification/output/spec.txt) +[`glfm_specification/output_spec/spec.txt`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/glfm_specification/output_spec/spec.txt) is a Markdown specification file, in the standard format with prose and Markdown + canonical HTML examples. -It also serves as input for other scripts such as `update-example-snapshots.rb` -and `run-spec-tests.sh`. +It also serves as input for other scripts such as +`run-spec-tests.sh`. It is generated or updated by the `update-specification.rb` script, using the [input specification files](#input-specification-files) as input. See the [`update-specification.rb` script section](#update-specificationrb-script) for a diagram and more description on this process. +NOTE: +Even though `spec.txt` is a Markdown file, it is named with a `*.txt` extension +for consistency with the GFM and CommonMark specifications. All other GLFM +Markdown files are named with a `*.md` extension for compatibility with +various editors to enable Markdown formatting and syntax highlighting. + ##### spec.html -[`glfm_specification/output/spec.html`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/glfm_specification/output/spec.html) +[`glfm_specification/output_spec/spec.html`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/glfm_specification/output_spec/spec.html) is an HTML file, rendered based on `spec.txt`. It is -also generated (or updated) by the `update-specification.rb` script at the same time as +generated (or updated) by the `update-specification.rb` script at the same time as `spec.txt`. It corresponds to the HTML-rendered versions of the "GitHub Flavored Markdown" (GFM) [specification](https://github.github.com/gfm/) -and the [CommonMark specification](https://spec.commonmark.org/0.30/). +and the [CommonMark specification](https://spec.commonmark.org/0.30/), but only +contains GitLab Flavored Markdown (GLFM) examples. -### Example snapshot files +NOTE: -The `example_snapshots` directory contains files which are generated by the -`update-example-snapshots.rb` script based off of the files in the -`glfm_specification/input` directory. They are used as fixtures to drive the -various Markdown snapshot tests. +The formatting of this HTML is currently not identical to the GFM and CommonMark +HTML-rendered specification. It is only the raw output of running `spec.txt` through +the GitLab Markdown renderer. Properly formatting the HTML will require +duplicating or reusing the Lua script and template from the CommonMark project: +[CommonMark Makefile](https://github.com/commonmark/commonmark-spec/blob/master/Makefile#L11) + +#### Output example snapshot files + +The `output_example_snapshots` directory contains files which are generated by the +`update-specification.rb` and `update-example-snapshots.rb` scripts based off of the files in the +`glfm_specification/input` directory. + +The `output-specification.rb` script generates +`output_snapshot_examples/glfm_snapshot_spec.md` and `output_snapshot_examples/glfm_snapshot_spec.html`. +These files are Markdown specification files containing examples generated based on input files, +similar to the `output_spec/spec.txt` and `output_spec/spec.html`, with the following differences: + +1. They contain a superset of _all_ examples from + the Commonmark, GitHub Flavored Markdown, and GitLab Flavored Markdown specifications, whereas + `spec.*` only contains the GLFM specification. This is to provide a single place to refer to + all examples when working with [snapshot testing](#markdown-snapshot-testing). +1. They contain _only_ header sections which contain examples. They do not contain any prose-only + sections which do not contain examples. + +The `update-example-snapshots.rb` script generates the various +`output_snapshot_examples/*.yml` files, which +are used as fixtures to drive the [snapshot testing](#markdown-snapshot-testing). After the entire GLFM implementation is complete for both backend (Ruby) and frontend (JavaScript), all of these YAML files can be automatically generated. @@ -1131,9 +1166,47 @@ key in `glfm_specification/input/gitlab_flavored_markdown/glfm_example_status.ym can be used to disable automatic generation of some examples. They can instead be manually edited as necessary to help drive the implementations. -#### `glfm_specification/example_snapshots/examples_index.yml` +##### `glfm_snapshot_spec.md` -[`glfm_specification/example_snapshots/examples_index.yml`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/glfm_specification/example_snapshots/examples_index.yml) +[`glfm_specification/output_example_snapshots/glfm_snapshot_spec.md`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/glfm_specification/output_example_snapshots/glfm_snapshot_spec.md) +is a Markdown file, containing standard Markdown + canonical HTML examples like [`spec.txt`](#spectxt). + +It is generated or updated by the `update-specification.rb` script, using the +[input specification files](#input-specification-files) as input. +See the [`update-specification.rb` script section](#update-specificationrb-script) +for a diagram and more description on this process. It also serves as input for other +scripts such as `update-example-snapshots.rb`. + +It is similar to [`spec.txt`](#spectxt), with the following differences: + +1. [`spec.txt`](#spectxt) contains only examples for GitLab Flavored Markdown, but + `glfm_snapshot_spec.md` also contains the full superset of examples from the + "GitHub Flavored Markdown" (GFM)[specification](https://github.github.com/gfm/) + and the [CommonMark specification](https://spec.commonmark.org/0.30/) specifications. +1. [`spec.txt`](#spectxt) represents the full GLFM specification, including additional header sections + containing only explanatory prose and no examples, but `glfm_snapshot_spec.md` consists of only + header sections which contain examples. This is because its purpose is to serve as input for + the other [`output example snapshot files`](#output-example-snapshot-files) - it is not intended + to serve as an actual [specification file](#output-specification-files) + like [`spec.txt`](#spectxt) or [`spec.html`](#spechtml). + +##### `glfm_snapshot_spec.html` + +[`glfm_specification/output_snapshot_examples/glfm_snapshot_spec.html`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/glfm_specification/output_snapshot_examples/glfm_snapshot_spec.html) +is an HTML file, rendered based on `glfm_snapshot_spec.md`. It is +generated (or updated) by the `update-specification.rb` script at the same time as +`glfm_snapshot_spec.md`. + +NOTE: +The formatting of this HTML is currently not identical to the GFM and CommonMark +HTML-rendered specification. It is only the raw output of running `glfm_snapshot_spec.md` through +the GitLab Markdown renderer. Properly formatting the HTML will require +duplicating or reusing the Lua script and template from the CommonMark project: +[CommonMark Makefile](https://github.com/commonmark/commonmark-spec/blob/master/Makefile#L11) + +##### `examples_index.yml` + +[`glfm_specification/output_example_snapshots/examples_index.yml`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/glfm_specification/output_example_snapshots/examples_index.yml) is the main list of all CommonMark, GFM, and GLFM example names, each with a uniquely identifying name. @@ -1142,9 +1215,9 @@ CommonMark, GFM, and GLFM example names, each with a uniquely identifying name. - For CommonMark and GFM examples, these sections originally came from the GFM `spec.txt`. - For GLFM examples, it is generated from - [`glfm_official_specification_examples.md`](#glfm_official_specification_examplesmd) and [`glfm_internal_extension_examples.md`](#glfm_internal_extension_examplesmd). + [`glfm_official_specification.md`](#glfm_official_specificationmd) and [`glfm_internal_extensions.md`](#glfm_internal_extensionsmd). - It also contains extra metadata about each example, such as: - 1. `spec_txt_example_position` - The position of the example in the generated GLFM `spec.txt` file. + 1. `spec_example_position` - The position of the example in the generated GLFM `spec.txt` file. - This value is the index order of each individual Markdown + HTML5 example in the file. It is _not_ the line number in the file. - This value can be used to locate the example in the rendered `spec.html` file, because the standard @@ -1159,49 +1232,49 @@ CommonMark, GFM, and GLFM example names, each with a uniquely identifying name. examples where multiple examples exist for the same Section 7 subsection are added to the end of the sub-section. -`glfm_specification/example_snapshots/examples_index.yml` sample entries: +`examples_index.yml` sample entries: ```yaml 02_01_00_preliminaries_characters_and_lines_1: - spec_txt_example_position: 1 + spec_example_position: 1 source_specification: commonmark 03_01_00_blocks_and_inlines_precedence_1: - spec_txt_example_position: 12 + spec_example_position: 12 source_specification: commonmark 05_03_00_container_blocks_task_list_items_1: - spec_txt_example_position: 279 + spec_example_position: 279 source_specification: github 06_04_00_inlines_emphasis_and_strong_emphasis_1: - spec_txt_example_position: 360 + spec_example_position: 360 source_specification: github 07_01_00_audio_link_1: - spec_txt_example_position: 301 + spec_example_position: 301 source_specification: gitlab ``` -#### `glfm_specification/example_snapshots/markdown.yml` +##### `markdown.yml` -[`glfm_specification/example_snapshots/markdown.yml`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/glfm_specification/example_snapshots/markdown.yml) contains the original Markdown -for each entry in `glfm_specification/example_snapshots/examples_index.yml` +[`glfm_specification/output_example_snapshots/markdown.yml`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/glfm_specification/output_example_snapshots/markdown.yml) contains the original Markdown +for each entry in `glfm_specification/output_example_snapshots/examples_index.yml`: - For CommonMark and GFM Markdown, it is generated (or updated) from the standard GFM `spec.txt` using the `update-example-snapshots.rb` script. - For GLFM, it is generated (or updated) from the - [`glfm_official_specification_examples.md`](#glfm_official_specification_examplesmd) and [`glfm_internal_extension_examples.md`](#glfm_internal_extension_examplesmd) + [`glfm_official_specification.md`](#glfm_official_specificationmd) and [`glfm_internal_extensions.md`](#glfm_internal_extensionsmd) input specification files. -`glfm_specification/example_snapshots/markdown.yml` sample entry: +`glfm_specification/output_example_snapshots/markdown.yml` sample entry: ```yaml 06_04_00_inlines_emphasis_and_strong_emphasis_1: | *foo bar* ``` -#### `glfm_specification/example_snapshots/html.yml` +##### `html.yml` -[`glfm_specification/example_snapshots/html.yml`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/glfm_specification/example_snapshots/html.yml) -contains the HTML for each entry in `glfm_specification/example_snapshots/examples_index.yml` +[`glfm_specification/output_example_snapshots/html.yml`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/glfm_specification/output_example_snapshots/html.yml) +contains the HTML for each entry in `glfm_specification/output_example_snapshots/examples_index.yml`: Three types of entries exist, with different HTML for each: @@ -1209,16 +1282,16 @@ Three types of entries exist, with different HTML for each: - The ["Canonical"](#canonicalization-of-html) HTML. - For CommonMark and GFM examples, the HTML comes from the examples in `spec.txt`. - For [GLFM official specification](#official-specifications) examples, it is generated/updated from - [`glfm_official_specification_examples.md`](#glfm_official_specification_examplesmd). + [`glfm_official_specification.md`](#glfm_official_specificationmd). - **Static** - This is the static (backend (Ruby)-generated) HTML for each entry in - `glfm_specification/example_snapshots/examples_index.yml`. + `glfm_specification/output_example_snapshots/examples_index.yml`. - It is generated/updated from backend [Markdown API](../../../api/markdown.md) (or the underlying internal classes) via the `update-example-snapshots.rb` script, but can be manually updated for static examples with incomplete implementations. - **WYSIWYG** - The WYSIWYG (frontend, JavaScript-generated) HTML for each entry in - `glfm_specification/example_snapshots/examples_index.yml`. + `glfm_specification/output_example_snapshots/examples_index.yml`. - It is generated (or updated) from the frontend Content Editor implementation via the `update-example-snapshots.rb` script. It can be manually updated for WYSIWYG examples with incomplete implementations. @@ -1226,7 +1299,7 @@ Three types of entries exist, with different HTML for each: Any exceptions or failures which occur when generating HTML are replaced with an `Error - check implementation` value. -`glfm_specification/example_snapshots/html.yml` sample entry: +`glfm_specification/output_example_snapshots/html.yml` sample entry: ```yaml 06_04_00_inlines_emphasis_and_strong_emphasis_1: @@ -1242,16 +1315,16 @@ NOTE: The actual `static` or `WYSIWYG` entries may differ from the example `html.yml`, depending on how the implementations evolve. -#### `glfm_specification/example_snapshots/prosemirror_json.yml` +##### `prosemirror_json.yml` -[`glfm_specification/example_snapshots/prosemirror_json.yml`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/glfm_specification/example_snapshots/prosemirror_json.yml) -contains the ProseMirror JSON for each entry in `glfm_specification/example_snapshots/examples_index.yml` +[`glfm_specification/output_example_snapshots/prosemirror_json.yml`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/glfm_specification/output_example_snapshots/prosemirror_json.yml) +contains the ProseMirror JSON for each entry in `glfm_specification/output_example_snapshots/examples_index.yml` - It is generated (or updated) from the frontend code via the `update-example-snapshots.rb` script, but can be manually updated for examples with incomplete implementations. - Any exceptions or failures when generating are replaced with a `Error - check implementation` value. -`glfm_specification/example_snapshots/prosemirror_json.yml` sample entry: +`glfm_specification/output_example_snapshots/prosemirror_json.yml` sample entry: ```yaml 06_04_00_inlines_emphasis_and_strong_emphasis_1: |- @@ -1291,13 +1364,13 @@ This section describes how the scripts can be used to manage the GLFM specificat 1. If you are working on an in-progress feature or bug, make any necessary manual updates to the [input specification files](#input-specification-files). This may include: 1. Updating the canonical Markdown or HTML examples in - [`glfm_official_specification_examples.md`](#glfm_official_specification_examplesmd) or [`glfm_internal_extension_examples.md`](#glfm_internal_extension_examplesmd). + [`glfm_official_specification.md`](#glfm_official_specificationmd) or [`glfm_internal_extensions.md`](#glfm_internal_extensionsmd). 1. Updating `glfm_specification/input/gitlab_flavored_markdown/glfm_example_status.yml` to reflect the current status of the examples or tests. 1. Run [`update-specification.rb`](#update-specificationrb-script) to update the `spec.txt` to reflect any changes which were made to the [input specification files](#input-specification-files). 1. Visually inspect and confirm any resulting changes to the [output specification files](#output-specification-files). -1. Run [`update-example-snapshots.rb`](#update-example-snapshotsrb-script) to update the [example snapshot files](#example-snapshot-files). -1. Visually inspect and confirm any resulting changes to the [example snapshot files](#example-snapshot-files). +1. Run [`update-example-snapshots.rb`](#update-example-snapshotsrb-script) to update the [example snapshot files](#output-example-snapshot-files). +1. Visually inspect and confirm any resulting changes to the [example snapshot files](#output-example-snapshot-files). 1. Run [`run-snapshot-tests.sh`](#run-snapshot-testssh-script) as a convenience script to run all relevant frontend (RSpec) and backend (Jest) tests which use the example snapshots. 1. Any frontend or backend snapshot test may also be run individually. 1. All frontend and backend tests are also run as part of the continuous integration suite, as they normally are. -1. Commit any changes to the [input specification files](#input-specification-files), [output specification files](#output-specification-files), or [example snapshot files](#example-snapshot-files). +1. Commit any changes to the [input specification files](#input-specification-files), [output specification files](#output-specification-files), or [example snapshot files](#output-example-snapshot-files). diff --git a/doc/user/discussions/index.md b/doc/user/discussions/index.md index ce1b85fbc76..40a118e3f23 100644 --- a/doc/user/discussions/index.md +++ b/doc/user/discussions/index.md @@ -44,8 +44,9 @@ You can quickly see which comments involve you, because mentions for yourself (the user currently signed in) are highlighted in a different color. -Avoid mentioning `@all` in issues and merge requests, because it sends an email notification -to all the members of that project's group. This might be interpreted as spam. +Avoid mentioning `@all` in issues and merge requests. It sends an email notification +to all members of that project's parent group, not only the participants of the project, +and may be interpreted as spam. Notifications and mentions can be disabled in [a group's settings](../group/manage.md#disable-email-notifications). diff --git a/doc/user/group/manage.md b/doc/user/group/manage.md index bb76101556e..730691a89e8 100644 --- a/doc/user/group/manage.md +++ b/doc/user/group/manage.md @@ -823,7 +823,6 @@ Group.find_by_sql("SELECT * FROM namespaces WHERE name LIKE '%oup'") If transferring a group doesn't work through the UI or API, you may want to attempt the transfer in a [Rails console session](../../administration/operations/rails_console.md#starting-a-rails-console-session): WARNING: - Commands that change data can cause damage if not run correctly or under the right conditions. Always run commands in a test environment first and have a backup instance ready to restore. ```ruby @@ -855,7 +854,6 @@ At times, a group deletion may get stuck. If needed, in a [Rails console session you can attempt to delete a group using the following command: WARNING: - Commands that change data can cause damage if not run correctly or under the right conditions. Always run commands in a test environment first and have a backup instance ready to restore. ```ruby diff --git a/doc/user/infrastructure/iac/troubleshooting.md b/doc/user/infrastructure/iac/troubleshooting.md index a1eecb909fb..3921c6a7dc8 100644 --- a/doc/user/infrastructure/iac/troubleshooting.md +++ b/doc/user/infrastructure/iac/troubleshooting.md @@ -121,3 +121,13 @@ To resolve this, ensure that: - If you have set the `TF_HTTP_PASSWORD` CI/CD variable, make sure that you either: - Set the same value as `TF_PASSWORD` - Remove `TF_HTTP_PASSWORD` variable if your CI/CD job does not explicitly use it. + +### Enable Developer role access to destructive commands + +To permit a user with the Developer role to run destructive commands, you need a workaround: + +1. [Create a project access token](../../project/settings/project_access_tokens.md#create-a-project-access-token) with `api` scope. +1. Add `TF_USERNAME` and `TF_PASSWORD` to your CI/CD variables: + 1. Set the value of `TF_USERNAME` to the username of your project access token. + 1. Set the value of `TF_PASSWORD` to the password of your project access token. + 1. Optional. Protect the variables to make them only available in pipelines that run on protected branches or protected tags. diff --git a/doc/user/project/integrations/slack.md b/doc/user/project/integrations/slack.md index a1bff1ea920..17dd5652196 100644 --- a/doc/user/project/integrations/slack.md +++ b/doc/user/project/integrations/slack.md @@ -134,7 +134,6 @@ To disable notifications for all projects that have Slack integration enabled, [start a rails console session](../../../administration/operations/rails_console.md#starting-a-rails-console-session) and use a script similar to the following: WARNING: - Commands that change data can cause damage if not run correctly or under the right conditions. Always run commands in a test environment first and have a backup instance ready to restore. ```ruby diff --git a/doc/user/project/repository/mirror/index.md b/doc/user/project/repository/mirror/index.md index 4ce162ac95e..2b578977bd2 100644 --- a/doc/user/project/repository/mirror/index.md +++ b/doc/user/project/repository/mirror/index.md @@ -326,7 +326,6 @@ repository mirroring, mirroring breaks when people leave the company. Use this script to migrate disparate mirroring users and tokens into a single service account: WARNING: - Commands that change data can cause damage if not run correctly or under the right conditions. Always run commands in a test environment first and have a backup instance ready to restore. ```ruby diff --git a/doc/user/project/repository/push_rules.md b/doc/user/project/repository/push_rules.md index d7ceb0ae131..bb9dc43d822 100644 --- a/doc/user/project/repository/push_rules.md +++ b/doc/user/project/repository/push_rules.md @@ -304,7 +304,6 @@ For example, to enable **Check whether the commit author is a GitLab user** and and create a filter for allowing commits from a specific email domain only through rails console: WARNING: - Commands that change data can cause damage if not run correctly or under the right conditions. Always run commands in a test environment first and have a backup instance ready to restore. ``` ruby diff --git a/doc/user/project/working_with_projects.md b/doc/user/project/working_with_projects.md index 709bc63e72b..067a0303277 100644 --- a/doc/user/project/working_with_projects.md +++ b/doc/user/project/working_with_projects.md @@ -516,7 +516,6 @@ If a project or repository has been updated but the state is not reflected in th You can do so through [a Rails console session](../../administration/operations/rails_console.md#starting-a-rails-console-session) and one of the following: WARNING: - Commands that change data can cause damage if not run correctly or under the right conditions. Always run commands in a test environment first and have a backup instance ready to restore. ```ruby @@ -546,7 +545,6 @@ end If a project cannot be deleted, you can attempt to delete it through [Rails console](../../administration/operations/rails_console.md#starting-a-rails-console-session). WARNING: - Commands that change data can cause damage if not run correctly or under the right conditions. Always run commands in a test environment first and have a backup instance ready to restore. ```ruby @@ -571,7 +569,6 @@ To toggle a specific feature, you can [start a Rails console session](../../admi and run the following function: WARNING: - Commands that change data can cause damage if not run correctly or under the right conditions. Always run commands in a test environment first and have a backup instance ready to restore. ```ruby diff --git a/glfm_specification/input/gitlab_flavored_markdown/glfm_internal_extension_examples.md b/glfm_specification/input/gitlab_flavored_markdown/glfm_internal_extensions.md similarity index 98% rename from glfm_specification/input/gitlab_flavored_markdown/glfm_internal_extension_examples.md rename to glfm_specification/input/gitlab_flavored_markdown/glfm_internal_extensions.md index 171a8e430d3..d2b94806826 100644 --- a/glfm_specification/input/gitlab_flavored_markdown/glfm_internal_extension_examples.md +++ b/glfm_specification/input/gitlab_flavored_markdown/glfm_internal_extensions.md @@ -1,3 +1,4 @@ + # GitLab Internal Extension Markdown ## Audio @@ -109,3 +110,4 @@ also requires an EE license enabling the `group_wikis` feature: .

group-wikis-test-file

```````````````````````````````` + diff --git a/glfm_specification/input/gitlab_flavored_markdown/glfm_intro.md b/glfm_specification/input/gitlab_flavored_markdown/glfm_intro.md deleted file mode 100644 index b5351bf37de..00000000000 --- a/glfm_specification/input/gitlab_flavored_markdown/glfm_intro.md +++ /dev/null @@ -1,3 +0,0 @@ -# Introduction - -TODO: Write a GitLab-specific version of the GitHub Flavored Markdown intro section. diff --git a/glfm_specification/input/gitlab_flavored_markdown/glfm_official_specification_examples.md b/glfm_specification/input/gitlab_flavored_markdown/glfm_official_specification.md similarity index 96% rename from glfm_specification/input/gitlab_flavored_markdown/glfm_official_specification_examples.md rename to glfm_specification/input/gitlab_flavored_markdown/glfm_official_specification.md index f2b62b1a4ac..e45ae62309d 100644 --- a/glfm_specification/input/gitlab_flavored_markdown/glfm_official_specification_examples.md +++ b/glfm_specification/input/gitlab_flavored_markdown/glfm_official_specification.md @@ -1,7 +1,12 @@ +# Introduction + +TODO: Write a GitLab-specific version of the GitHub Flavored Markdown intro section. + + # GitLab Official Specification Markdown Currently, only some of the GitLab-specific markdown features are -listed in this section. We will eventually add all +listed in this section. We may eventually add all GitLab-specific features currently listed as supported in the [user-facing documentation for GitLab Flavored Markdown](https://docs.gitlab.com/ee/user/markdown.html). @@ -275,3 +280,4 @@ A table of contents can be indented with up to three spaces.

Heading 1

```````````````````````````````` + diff --git a/glfm_specification/example_snapshots/examples_index.yml b/glfm_specification/output_example_snapshots/examples_index.yml similarity index 70% rename from glfm_specification/example_snapshots/examples_index.yml rename to glfm_specification/output_example_snapshots/examples_index.yml index c0739912399..45d10679a71 100644 --- a/glfm_specification/example_snapshots/examples_index.yml +++ b/glfm_specification/output_example_snapshots/examples_index.yml @@ -1,2086 +1,2086 @@ --- 02_01_00__preliminaries__tabs__001: - spec_txt_example_position: 1 + spec_example_position: 1 source_specification: commonmark 02_01_00__preliminaries__tabs__002: - spec_txt_example_position: 2 + spec_example_position: 2 source_specification: commonmark 02_01_00__preliminaries__tabs__003: - spec_txt_example_position: 3 + spec_example_position: 3 source_specification: commonmark 02_01_00__preliminaries__tabs__004: - spec_txt_example_position: 4 + spec_example_position: 4 source_specification: commonmark 02_01_00__preliminaries__tabs__005: - spec_txt_example_position: 5 + spec_example_position: 5 source_specification: commonmark 02_01_00__preliminaries__tabs__006: - spec_txt_example_position: 6 + spec_example_position: 6 source_specification: commonmark 02_01_00__preliminaries__tabs__007: - spec_txt_example_position: 7 + spec_example_position: 7 source_specification: commonmark 02_01_00__preliminaries__tabs__008: - spec_txt_example_position: 8 + spec_example_position: 8 source_specification: commonmark 02_01_00__preliminaries__tabs__009: - spec_txt_example_position: 9 + spec_example_position: 9 source_specification: commonmark 02_01_00__preliminaries__tabs__010: - spec_txt_example_position: 10 + spec_example_position: 10 source_specification: commonmark 02_01_00__preliminaries__tabs__011: - spec_txt_example_position: 11 + spec_example_position: 11 source_specification: commonmark 03_01_00__blocks_and_inlines__precedence__001: - spec_txt_example_position: 12 + spec_example_position: 12 source_specification: commonmark 04_01_00__leaf_blocks__thematic_breaks__001: - spec_txt_example_position: 13 + spec_example_position: 13 source_specification: commonmark 04_01_00__leaf_blocks__thematic_breaks__002: - spec_txt_example_position: 14 + spec_example_position: 14 source_specification: commonmark 04_01_00__leaf_blocks__thematic_breaks__003: - spec_txt_example_position: 15 + spec_example_position: 15 source_specification: commonmark 04_01_00__leaf_blocks__thematic_breaks__004: - spec_txt_example_position: 16 + spec_example_position: 16 source_specification: commonmark 04_01_00__leaf_blocks__thematic_breaks__005: - spec_txt_example_position: 17 + spec_example_position: 17 source_specification: commonmark 04_01_00__leaf_blocks__thematic_breaks__006: - spec_txt_example_position: 18 + spec_example_position: 18 source_specification: commonmark 04_01_00__leaf_blocks__thematic_breaks__007: - spec_txt_example_position: 19 + spec_example_position: 19 source_specification: commonmark 04_01_00__leaf_blocks__thematic_breaks__008: - spec_txt_example_position: 20 + spec_example_position: 20 source_specification: commonmark 04_01_00__leaf_blocks__thematic_breaks__009: - spec_txt_example_position: 21 + spec_example_position: 21 source_specification: commonmark 04_01_00__leaf_blocks__thematic_breaks__010: - spec_txt_example_position: 22 + spec_example_position: 22 source_specification: commonmark 04_01_00__leaf_blocks__thematic_breaks__011: - spec_txt_example_position: 23 + spec_example_position: 23 source_specification: commonmark 04_01_00__leaf_blocks__thematic_breaks__012: - spec_txt_example_position: 24 + spec_example_position: 24 source_specification: commonmark 04_01_00__leaf_blocks__thematic_breaks__013: - spec_txt_example_position: 25 + spec_example_position: 25 source_specification: commonmark 04_01_00__leaf_blocks__thematic_breaks__014: - spec_txt_example_position: 26 + spec_example_position: 26 source_specification: commonmark 04_01_00__leaf_blocks__thematic_breaks__015: - spec_txt_example_position: 27 + spec_example_position: 27 source_specification: commonmark 04_01_00__leaf_blocks__thematic_breaks__016: - spec_txt_example_position: 28 + spec_example_position: 28 source_specification: commonmark 04_01_00__leaf_blocks__thematic_breaks__017: - spec_txt_example_position: 29 + spec_example_position: 29 source_specification: commonmark 04_01_00__leaf_blocks__thematic_breaks__018: - spec_txt_example_position: 30 + spec_example_position: 30 source_specification: commonmark 04_01_00__leaf_blocks__thematic_breaks__019: - spec_txt_example_position: 31 + spec_example_position: 31 source_specification: commonmark 04_02_00__leaf_blocks__atx_headings__001: - spec_txt_example_position: 32 + spec_example_position: 32 source_specification: commonmark 04_02_00__leaf_blocks__atx_headings__002: - spec_txt_example_position: 33 + spec_example_position: 33 source_specification: commonmark 04_02_00__leaf_blocks__atx_headings__003: - spec_txt_example_position: 34 + spec_example_position: 34 source_specification: commonmark 04_02_00__leaf_blocks__atx_headings__004: - spec_txt_example_position: 35 + spec_example_position: 35 source_specification: commonmark 04_02_00__leaf_blocks__atx_headings__005: - spec_txt_example_position: 36 + spec_example_position: 36 source_specification: commonmark 04_02_00__leaf_blocks__atx_headings__006: - spec_txt_example_position: 37 + spec_example_position: 37 source_specification: commonmark 04_02_00__leaf_blocks__atx_headings__007: - spec_txt_example_position: 38 + spec_example_position: 38 source_specification: commonmark 04_02_00__leaf_blocks__atx_headings__008: - spec_txt_example_position: 39 + spec_example_position: 39 source_specification: commonmark 04_02_00__leaf_blocks__atx_headings__009: - spec_txt_example_position: 40 + spec_example_position: 40 source_specification: commonmark 04_02_00__leaf_blocks__atx_headings__010: - spec_txt_example_position: 41 + spec_example_position: 41 source_specification: commonmark 04_02_00__leaf_blocks__atx_headings__011: - spec_txt_example_position: 42 + spec_example_position: 42 source_specification: commonmark 04_02_00__leaf_blocks__atx_headings__012: - spec_txt_example_position: 43 + spec_example_position: 43 source_specification: commonmark 04_02_00__leaf_blocks__atx_headings__013: - spec_txt_example_position: 44 + spec_example_position: 44 source_specification: commonmark 04_02_00__leaf_blocks__atx_headings__014: - spec_txt_example_position: 45 + spec_example_position: 45 source_specification: commonmark 04_02_00__leaf_blocks__atx_headings__015: - spec_txt_example_position: 46 + spec_example_position: 46 source_specification: commonmark 04_02_00__leaf_blocks__atx_headings__016: - spec_txt_example_position: 47 + spec_example_position: 47 source_specification: commonmark 04_02_00__leaf_blocks__atx_headings__017: - spec_txt_example_position: 48 + spec_example_position: 48 source_specification: commonmark 04_02_00__leaf_blocks__atx_headings__018: - spec_txt_example_position: 49 + spec_example_position: 49 source_specification: commonmark 04_03_00__leaf_blocks__setext_headings__001: - spec_txt_example_position: 50 + spec_example_position: 50 source_specification: commonmark 04_03_00__leaf_blocks__setext_headings__002: - spec_txt_example_position: 51 + spec_example_position: 51 source_specification: commonmark 04_03_00__leaf_blocks__setext_headings__003: - spec_txt_example_position: 52 + spec_example_position: 52 source_specification: commonmark 04_03_00__leaf_blocks__setext_headings__004: - spec_txt_example_position: 53 + spec_example_position: 53 source_specification: commonmark 04_03_00__leaf_blocks__setext_headings__005: - spec_txt_example_position: 54 + spec_example_position: 54 source_specification: commonmark 04_03_00__leaf_blocks__setext_headings__006: - spec_txt_example_position: 55 + spec_example_position: 55 source_specification: commonmark 04_03_00__leaf_blocks__setext_headings__007: - spec_txt_example_position: 56 + spec_example_position: 56 source_specification: commonmark 04_03_00__leaf_blocks__setext_headings__008: - spec_txt_example_position: 57 + spec_example_position: 57 source_specification: commonmark 04_03_00__leaf_blocks__setext_headings__009: - spec_txt_example_position: 58 + spec_example_position: 58 source_specification: commonmark 04_03_00__leaf_blocks__setext_headings__010: - spec_txt_example_position: 59 + spec_example_position: 59 source_specification: commonmark 04_03_00__leaf_blocks__setext_headings__011: - spec_txt_example_position: 60 + spec_example_position: 60 source_specification: commonmark 04_03_00__leaf_blocks__setext_headings__012: - spec_txt_example_position: 61 + spec_example_position: 61 source_specification: commonmark 04_03_00__leaf_blocks__setext_headings__013: - spec_txt_example_position: 62 + spec_example_position: 62 source_specification: commonmark 04_03_00__leaf_blocks__setext_headings__014: - spec_txt_example_position: 63 + spec_example_position: 63 source_specification: commonmark 04_03_00__leaf_blocks__setext_headings__015: - spec_txt_example_position: 64 + spec_example_position: 64 source_specification: commonmark 04_03_00__leaf_blocks__setext_headings__016: - spec_txt_example_position: 65 + spec_example_position: 65 source_specification: commonmark 04_03_00__leaf_blocks__setext_headings__017: - spec_txt_example_position: 66 + spec_example_position: 66 source_specification: commonmark 04_03_00__leaf_blocks__setext_headings__018: - spec_txt_example_position: 67 + spec_example_position: 67 source_specification: commonmark 04_03_00__leaf_blocks__setext_headings__019: - spec_txt_example_position: 68 + spec_example_position: 68 source_specification: commonmark 04_03_00__leaf_blocks__setext_headings__020: - spec_txt_example_position: 69 + spec_example_position: 69 source_specification: commonmark 04_03_00__leaf_blocks__setext_headings__021: - spec_txt_example_position: 70 + spec_example_position: 70 source_specification: commonmark 04_03_00__leaf_blocks__setext_headings__022: - spec_txt_example_position: 71 + spec_example_position: 71 source_specification: commonmark 04_03_00__leaf_blocks__setext_headings__023: - spec_txt_example_position: 72 + spec_example_position: 72 source_specification: commonmark 04_03_00__leaf_blocks__setext_headings__024: - spec_txt_example_position: 73 + spec_example_position: 73 source_specification: commonmark 04_03_00__leaf_blocks__setext_headings__025: - spec_txt_example_position: 74 + spec_example_position: 74 source_specification: commonmark 04_03_00__leaf_blocks__setext_headings__026: - spec_txt_example_position: 75 + spec_example_position: 75 source_specification: commonmark 04_03_00__leaf_blocks__setext_headings__027: - spec_txt_example_position: 76 + spec_example_position: 76 source_specification: commonmark 04_04_00__leaf_blocks__indented_code_blocks__001: - spec_txt_example_position: 77 + spec_example_position: 77 source_specification: commonmark 04_04_00__leaf_blocks__indented_code_blocks__002: - spec_txt_example_position: 78 + spec_example_position: 78 source_specification: commonmark 04_04_00__leaf_blocks__indented_code_blocks__003: - spec_txt_example_position: 79 + spec_example_position: 79 source_specification: commonmark 04_04_00__leaf_blocks__indented_code_blocks__004: - spec_txt_example_position: 80 + spec_example_position: 80 source_specification: commonmark 04_04_00__leaf_blocks__indented_code_blocks__005: - spec_txt_example_position: 81 + spec_example_position: 81 source_specification: commonmark 04_04_00__leaf_blocks__indented_code_blocks__006: - spec_txt_example_position: 82 + spec_example_position: 82 source_specification: commonmark 04_04_00__leaf_blocks__indented_code_blocks__007: - spec_txt_example_position: 83 + spec_example_position: 83 source_specification: commonmark 04_04_00__leaf_blocks__indented_code_blocks__008: - spec_txt_example_position: 84 + spec_example_position: 84 source_specification: commonmark 04_04_00__leaf_blocks__indented_code_blocks__009: - spec_txt_example_position: 85 + spec_example_position: 85 source_specification: commonmark 04_04_00__leaf_blocks__indented_code_blocks__010: - spec_txt_example_position: 86 + spec_example_position: 86 source_specification: commonmark 04_04_00__leaf_blocks__indented_code_blocks__011: - spec_txt_example_position: 87 + spec_example_position: 87 source_specification: commonmark 04_04_00__leaf_blocks__indented_code_blocks__012: - spec_txt_example_position: 88 + spec_example_position: 88 source_specification: commonmark 04_05_00__leaf_blocks__fenced_code_blocks__001: - spec_txt_example_position: 89 + spec_example_position: 89 source_specification: commonmark 04_05_00__leaf_blocks__fenced_code_blocks__002: - spec_txt_example_position: 90 + spec_example_position: 90 source_specification: commonmark 04_05_00__leaf_blocks__fenced_code_blocks__003: - spec_txt_example_position: 91 + spec_example_position: 91 source_specification: commonmark 04_05_00__leaf_blocks__fenced_code_blocks__004: - spec_txt_example_position: 92 + spec_example_position: 92 source_specification: commonmark 04_05_00__leaf_blocks__fenced_code_blocks__005: - spec_txt_example_position: 93 + spec_example_position: 93 source_specification: commonmark 04_05_00__leaf_blocks__fenced_code_blocks__006: - spec_txt_example_position: 94 + spec_example_position: 94 source_specification: commonmark 04_05_00__leaf_blocks__fenced_code_blocks__007: - spec_txt_example_position: 95 + spec_example_position: 95 source_specification: commonmark 04_05_00__leaf_blocks__fenced_code_blocks__008: - spec_txt_example_position: 96 + spec_example_position: 96 source_specification: commonmark 04_05_00__leaf_blocks__fenced_code_blocks__009: - spec_txt_example_position: 97 + spec_example_position: 97 source_specification: commonmark 04_05_00__leaf_blocks__fenced_code_blocks__010: - spec_txt_example_position: 98 + spec_example_position: 98 source_specification: commonmark 04_05_00__leaf_blocks__fenced_code_blocks__011: - spec_txt_example_position: 99 + spec_example_position: 99 source_specification: commonmark 04_05_00__leaf_blocks__fenced_code_blocks__012: - spec_txt_example_position: 100 + spec_example_position: 100 source_specification: commonmark 04_05_00__leaf_blocks__fenced_code_blocks__013: - spec_txt_example_position: 101 + spec_example_position: 101 source_specification: commonmark 04_05_00__leaf_blocks__fenced_code_blocks__014: - spec_txt_example_position: 102 + spec_example_position: 102 source_specification: commonmark 04_05_00__leaf_blocks__fenced_code_blocks__015: - spec_txt_example_position: 103 + spec_example_position: 103 source_specification: commonmark 04_05_00__leaf_blocks__fenced_code_blocks__016: - spec_txt_example_position: 104 + spec_example_position: 104 source_specification: commonmark 04_05_00__leaf_blocks__fenced_code_blocks__017: - spec_txt_example_position: 105 + spec_example_position: 105 source_specification: commonmark 04_05_00__leaf_blocks__fenced_code_blocks__018: - spec_txt_example_position: 106 + spec_example_position: 106 source_specification: commonmark 04_05_00__leaf_blocks__fenced_code_blocks__019: - spec_txt_example_position: 107 + spec_example_position: 107 source_specification: commonmark 04_05_00__leaf_blocks__fenced_code_blocks__020: - spec_txt_example_position: 108 + spec_example_position: 108 source_specification: commonmark 04_05_00__leaf_blocks__fenced_code_blocks__021: - spec_txt_example_position: 109 + spec_example_position: 109 source_specification: commonmark 04_05_00__leaf_blocks__fenced_code_blocks__022: - spec_txt_example_position: 110 + spec_example_position: 110 source_specification: commonmark 04_05_00__leaf_blocks__fenced_code_blocks__023: - spec_txt_example_position: 111 + spec_example_position: 111 source_specification: commonmark 04_05_00__leaf_blocks__fenced_code_blocks__024: - spec_txt_example_position: 112 + spec_example_position: 112 source_specification: commonmark 04_05_00__leaf_blocks__fenced_code_blocks__025: - spec_txt_example_position: 113 + spec_example_position: 113 source_specification: commonmark 04_05_00__leaf_blocks__fenced_code_blocks__026: - spec_txt_example_position: 114 + spec_example_position: 114 source_specification: commonmark 04_05_00__leaf_blocks__fenced_code_blocks__027: - spec_txt_example_position: 115 + spec_example_position: 115 source_specification: commonmark 04_05_00__leaf_blocks__fenced_code_blocks__028: - spec_txt_example_position: 116 + spec_example_position: 116 source_specification: commonmark 04_05_00__leaf_blocks__fenced_code_blocks__029: - spec_txt_example_position: 117 + spec_example_position: 117 source_specification: commonmark 04_06_00__leaf_blocks__html_blocks__001: - spec_txt_example_position: 118 + spec_example_position: 118 source_specification: commonmark 04_06_00__leaf_blocks__html_blocks__002: - spec_txt_example_position: 119 + spec_example_position: 119 source_specification: commonmark 04_06_00__leaf_blocks__html_blocks__003: - spec_txt_example_position: 120 + spec_example_position: 120 source_specification: commonmark 04_06_00__leaf_blocks__html_blocks__004: - spec_txt_example_position: 121 + spec_example_position: 121 source_specification: commonmark 04_06_00__leaf_blocks__html_blocks__005: - spec_txt_example_position: 122 + spec_example_position: 122 source_specification: commonmark 04_06_00__leaf_blocks__html_blocks__006: - spec_txt_example_position: 123 + spec_example_position: 123 source_specification: commonmark 04_06_00__leaf_blocks__html_blocks__007: - spec_txt_example_position: 124 + spec_example_position: 124 source_specification: commonmark 04_06_00__leaf_blocks__html_blocks__008: - spec_txt_example_position: 125 + spec_example_position: 125 source_specification: commonmark 04_06_00__leaf_blocks__html_blocks__009: - spec_txt_example_position: 126 + spec_example_position: 126 source_specification: commonmark 04_06_00__leaf_blocks__html_blocks__010: - spec_txt_example_position: 127 + spec_example_position: 127 source_specification: commonmark 04_06_00__leaf_blocks__html_blocks__011: - spec_txt_example_position: 128 + spec_example_position: 128 source_specification: commonmark 04_06_00__leaf_blocks__html_blocks__012: - spec_txt_example_position: 129 + spec_example_position: 129 source_specification: commonmark 04_06_00__leaf_blocks__html_blocks__013: - spec_txt_example_position: 130 + spec_example_position: 130 source_specification: commonmark 04_06_00__leaf_blocks__html_blocks__014: - spec_txt_example_position: 131 + spec_example_position: 131 source_specification: commonmark 04_06_00__leaf_blocks__html_blocks__015: - spec_txt_example_position: 132 + spec_example_position: 132 source_specification: commonmark 04_06_00__leaf_blocks__html_blocks__016: - spec_txt_example_position: 133 + spec_example_position: 133 source_specification: commonmark 04_06_00__leaf_blocks__html_blocks__017: - spec_txt_example_position: 134 + spec_example_position: 134 source_specification: commonmark 04_06_00__leaf_blocks__html_blocks__018: - spec_txt_example_position: 135 + spec_example_position: 135 source_specification: commonmark 04_06_00__leaf_blocks__html_blocks__019: - spec_txt_example_position: 136 + spec_example_position: 136 source_specification: commonmark 04_06_00__leaf_blocks__html_blocks__020: - spec_txt_example_position: 137 + spec_example_position: 137 source_specification: commonmark 04_06_00__leaf_blocks__html_blocks__021: - spec_txt_example_position: 138 + spec_example_position: 138 source_specification: commonmark 04_06_00__leaf_blocks__html_blocks__022: - spec_txt_example_position: 139 + spec_example_position: 139 source_specification: commonmark 04_06_00__leaf_blocks__html_blocks__023: - spec_txt_example_position: 140 + spec_example_position: 140 source_specification: commonmark 04_06_00__leaf_blocks__html_blocks__024: - spec_txt_example_position: 141 + spec_example_position: 141 source_specification: commonmark 04_06_00__leaf_blocks__html_blocks__025: - spec_txt_example_position: 142 + spec_example_position: 142 source_specification: commonmark 04_06_00__leaf_blocks__html_blocks__026: - spec_txt_example_position: 143 + spec_example_position: 143 source_specification: commonmark 04_06_00__leaf_blocks__html_blocks__027: - spec_txt_example_position: 144 + spec_example_position: 144 source_specification: commonmark 04_06_00__leaf_blocks__html_blocks__028: - spec_txt_example_position: 145 + spec_example_position: 145 source_specification: commonmark 04_06_00__leaf_blocks__html_blocks__029: - spec_txt_example_position: 146 + spec_example_position: 146 source_specification: commonmark 04_06_00__leaf_blocks__html_blocks__030: - spec_txt_example_position: 147 + spec_example_position: 147 source_specification: commonmark 04_06_00__leaf_blocks__html_blocks__031: - spec_txt_example_position: 148 + spec_example_position: 148 source_specification: commonmark 04_06_00__leaf_blocks__html_blocks__032: - spec_txt_example_position: 149 + spec_example_position: 149 source_specification: commonmark 04_06_00__leaf_blocks__html_blocks__033: - spec_txt_example_position: 150 + spec_example_position: 150 source_specification: commonmark 04_06_00__leaf_blocks__html_blocks__034: - spec_txt_example_position: 151 + spec_example_position: 151 source_specification: commonmark 04_06_00__leaf_blocks__html_blocks__035: - spec_txt_example_position: 152 + spec_example_position: 152 source_specification: commonmark 04_06_00__leaf_blocks__html_blocks__036: - spec_txt_example_position: 153 + spec_example_position: 153 source_specification: commonmark 04_06_00__leaf_blocks__html_blocks__037: - spec_txt_example_position: 154 + spec_example_position: 154 source_specification: commonmark 04_06_00__leaf_blocks__html_blocks__038: - spec_txt_example_position: 155 + spec_example_position: 155 source_specification: commonmark 04_06_00__leaf_blocks__html_blocks__039: - spec_txt_example_position: 156 + spec_example_position: 156 source_specification: commonmark 04_06_00__leaf_blocks__html_blocks__040: - spec_txt_example_position: 157 + spec_example_position: 157 source_specification: commonmark 04_06_00__leaf_blocks__html_blocks__041: - spec_txt_example_position: 158 + spec_example_position: 158 source_specification: commonmark 04_06_00__leaf_blocks__html_blocks__042: - spec_txt_example_position: 159 + spec_example_position: 159 source_specification: commonmark 04_06_00__leaf_blocks__html_blocks__043: - spec_txt_example_position: 160 + spec_example_position: 160 source_specification: commonmark 04_07_00__leaf_blocks__link_reference_definitions__001: - spec_txt_example_position: 161 + spec_example_position: 161 source_specification: commonmark 04_07_00__leaf_blocks__link_reference_definitions__002: - spec_txt_example_position: 162 + spec_example_position: 162 source_specification: commonmark 04_07_00__leaf_blocks__link_reference_definitions__003: - spec_txt_example_position: 163 + spec_example_position: 163 source_specification: commonmark 04_07_00__leaf_blocks__link_reference_definitions__004: - spec_txt_example_position: 164 + spec_example_position: 164 source_specification: commonmark 04_07_00__leaf_blocks__link_reference_definitions__005: - spec_txt_example_position: 165 + spec_example_position: 165 source_specification: commonmark 04_07_00__leaf_blocks__link_reference_definitions__006: - spec_txt_example_position: 166 + spec_example_position: 166 source_specification: commonmark 04_07_00__leaf_blocks__link_reference_definitions__007: - spec_txt_example_position: 167 + spec_example_position: 167 source_specification: commonmark 04_07_00__leaf_blocks__link_reference_definitions__008: - spec_txt_example_position: 168 + spec_example_position: 168 source_specification: commonmark 04_07_00__leaf_blocks__link_reference_definitions__009: - spec_txt_example_position: 169 + spec_example_position: 169 source_specification: commonmark 04_07_00__leaf_blocks__link_reference_definitions__010: - spec_txt_example_position: 170 + spec_example_position: 170 source_specification: commonmark 04_07_00__leaf_blocks__link_reference_definitions__011: - spec_txt_example_position: 171 + spec_example_position: 171 source_specification: commonmark 04_07_00__leaf_blocks__link_reference_definitions__012: - spec_txt_example_position: 172 + spec_example_position: 172 source_specification: commonmark 04_07_00__leaf_blocks__link_reference_definitions__013: - spec_txt_example_position: 173 + spec_example_position: 173 source_specification: commonmark 04_07_00__leaf_blocks__link_reference_definitions__014: - spec_txt_example_position: 174 + spec_example_position: 174 source_specification: commonmark 04_07_00__leaf_blocks__link_reference_definitions__015: - spec_txt_example_position: 175 + spec_example_position: 175 source_specification: commonmark 04_07_00__leaf_blocks__link_reference_definitions__016: - spec_txt_example_position: 176 + spec_example_position: 176 source_specification: commonmark 04_07_00__leaf_blocks__link_reference_definitions__017: - spec_txt_example_position: 177 + spec_example_position: 177 source_specification: commonmark 04_07_00__leaf_blocks__link_reference_definitions__018: - spec_txt_example_position: 178 + spec_example_position: 178 source_specification: commonmark 04_07_00__leaf_blocks__link_reference_definitions__019: - spec_txt_example_position: 179 + spec_example_position: 179 source_specification: commonmark 04_07_00__leaf_blocks__link_reference_definitions__020: - spec_txt_example_position: 180 + spec_example_position: 180 source_specification: commonmark 04_07_00__leaf_blocks__link_reference_definitions__021: - spec_txt_example_position: 181 + spec_example_position: 181 source_specification: commonmark 04_07_00__leaf_blocks__link_reference_definitions__022: - spec_txt_example_position: 182 + spec_example_position: 182 source_specification: commonmark 04_07_00__leaf_blocks__link_reference_definitions__023: - spec_txt_example_position: 183 + spec_example_position: 183 source_specification: commonmark 04_07_00__leaf_blocks__link_reference_definitions__024: - spec_txt_example_position: 184 + spec_example_position: 184 source_specification: commonmark 04_07_00__leaf_blocks__link_reference_definitions__025: - spec_txt_example_position: 185 + spec_example_position: 185 source_specification: commonmark 04_07_00__leaf_blocks__link_reference_definitions__026: - spec_txt_example_position: 186 + spec_example_position: 186 source_specification: commonmark 04_07_00__leaf_blocks__link_reference_definitions__027: - spec_txt_example_position: 187 + spec_example_position: 187 source_specification: commonmark 04_07_00__leaf_blocks__link_reference_definitions__028: - spec_txt_example_position: 188 + spec_example_position: 188 source_specification: commonmark 04_08_00__leaf_blocks__paragraphs__001: - spec_txt_example_position: 189 + spec_example_position: 189 source_specification: commonmark 04_08_00__leaf_blocks__paragraphs__002: - spec_txt_example_position: 190 + spec_example_position: 190 source_specification: commonmark 04_08_00__leaf_blocks__paragraphs__003: - spec_txt_example_position: 191 + spec_example_position: 191 source_specification: commonmark 04_08_00__leaf_blocks__paragraphs__004: - spec_txt_example_position: 192 + spec_example_position: 192 source_specification: commonmark 04_08_00__leaf_blocks__paragraphs__005: - spec_txt_example_position: 193 + spec_example_position: 193 source_specification: commonmark 04_08_00__leaf_blocks__paragraphs__006: - spec_txt_example_position: 194 + spec_example_position: 194 source_specification: commonmark 04_08_00__leaf_blocks__paragraphs__007: - spec_txt_example_position: 195 + spec_example_position: 195 source_specification: commonmark 04_08_00__leaf_blocks__paragraphs__008: - spec_txt_example_position: 196 + spec_example_position: 196 source_specification: commonmark 04_09_00__leaf_blocks__blank_lines__001: - spec_txt_example_position: 197 + spec_example_position: 197 source_specification: commonmark 04_10_00__leaf_blocks__tables_extension__001: - spec_txt_example_position: 198 + spec_example_position: 198 source_specification: github 04_10_00__leaf_blocks__tables_extension__002: - spec_txt_example_position: 199 + spec_example_position: 199 source_specification: github 04_10_00__leaf_blocks__tables_extension__003: - spec_txt_example_position: 200 + spec_example_position: 200 source_specification: github 04_10_00__leaf_blocks__tables_extension__004: - spec_txt_example_position: 201 + spec_example_position: 201 source_specification: github 04_10_00__leaf_blocks__tables_extension__005: - spec_txt_example_position: 202 + spec_example_position: 202 source_specification: github 04_10_00__leaf_blocks__tables_extension__006: - spec_txt_example_position: 203 + spec_example_position: 203 source_specification: github 04_10_00__leaf_blocks__tables_extension__007: - spec_txt_example_position: 204 + spec_example_position: 204 source_specification: github 04_10_00__leaf_blocks__tables_extension__008: - spec_txt_example_position: 205 + spec_example_position: 205 source_specification: github 05_01_00__container_blocks__block_quotes__001: - spec_txt_example_position: 206 + spec_example_position: 206 source_specification: commonmark 05_01_00__container_blocks__block_quotes__002: - spec_txt_example_position: 207 + spec_example_position: 207 source_specification: commonmark 05_01_00__container_blocks__block_quotes__003: - spec_txt_example_position: 208 + spec_example_position: 208 source_specification: commonmark 05_01_00__container_blocks__block_quotes__004: - spec_txt_example_position: 209 + spec_example_position: 209 source_specification: commonmark 05_01_00__container_blocks__block_quotes__005: - spec_txt_example_position: 210 + spec_example_position: 210 source_specification: commonmark 05_01_00__container_blocks__block_quotes__006: - spec_txt_example_position: 211 + spec_example_position: 211 source_specification: commonmark 05_01_00__container_blocks__block_quotes__007: - spec_txt_example_position: 212 + spec_example_position: 212 source_specification: commonmark 05_01_00__container_blocks__block_quotes__008: - spec_txt_example_position: 213 + spec_example_position: 213 source_specification: commonmark 05_01_00__container_blocks__block_quotes__009: - spec_txt_example_position: 214 + spec_example_position: 214 source_specification: commonmark 05_01_00__container_blocks__block_quotes__010: - spec_txt_example_position: 215 + spec_example_position: 215 source_specification: commonmark 05_01_00__container_blocks__block_quotes__011: - spec_txt_example_position: 216 + spec_example_position: 216 source_specification: commonmark 05_01_00__container_blocks__block_quotes__012: - spec_txt_example_position: 217 + spec_example_position: 217 source_specification: commonmark 05_01_00__container_blocks__block_quotes__013: - spec_txt_example_position: 218 + spec_example_position: 218 source_specification: commonmark 05_01_00__container_blocks__block_quotes__014: - spec_txt_example_position: 219 + spec_example_position: 219 source_specification: commonmark 05_01_00__container_blocks__block_quotes__015: - spec_txt_example_position: 220 + spec_example_position: 220 source_specification: commonmark 05_01_00__container_blocks__block_quotes__016: - spec_txt_example_position: 221 + spec_example_position: 221 source_specification: commonmark 05_01_00__container_blocks__block_quotes__017: - spec_txt_example_position: 222 + spec_example_position: 222 source_specification: commonmark 05_01_00__container_blocks__block_quotes__018: - spec_txt_example_position: 223 + spec_example_position: 223 source_specification: commonmark 05_01_00__container_blocks__block_quotes__019: - spec_txt_example_position: 224 + spec_example_position: 224 source_specification: commonmark 05_01_00__container_blocks__block_quotes__020: - spec_txt_example_position: 225 + spec_example_position: 225 source_specification: commonmark 05_01_00__container_blocks__block_quotes__021: - spec_txt_example_position: 226 + spec_example_position: 226 source_specification: commonmark 05_01_00__container_blocks__block_quotes__022: - spec_txt_example_position: 227 + spec_example_position: 227 source_specification: commonmark 05_01_00__container_blocks__block_quotes__023: - spec_txt_example_position: 228 + spec_example_position: 228 source_specification: commonmark 05_01_00__container_blocks__block_quotes__024: - spec_txt_example_position: 229 + spec_example_position: 229 source_specification: commonmark 05_01_00__container_blocks__block_quotes__025: - spec_txt_example_position: 230 + spec_example_position: 230 source_specification: commonmark 05_02_00__container_blocks__list_items__001: - spec_txt_example_position: 231 + spec_example_position: 231 source_specification: commonmark 05_02_00__container_blocks__list_items__002: - spec_txt_example_position: 232 + spec_example_position: 232 source_specification: commonmark 05_02_00__container_blocks__list_items__003: - spec_txt_example_position: 233 + spec_example_position: 233 source_specification: commonmark 05_02_00__container_blocks__list_items__004: - spec_txt_example_position: 234 + spec_example_position: 234 source_specification: commonmark 05_02_00__container_blocks__list_items__005: - spec_txt_example_position: 235 + spec_example_position: 235 source_specification: commonmark 05_02_00__container_blocks__list_items__006: - spec_txt_example_position: 236 + spec_example_position: 236 source_specification: commonmark 05_02_00__container_blocks__list_items__007: - spec_txt_example_position: 237 + spec_example_position: 237 source_specification: commonmark 05_02_00__container_blocks__list_items__008: - spec_txt_example_position: 238 + spec_example_position: 238 source_specification: commonmark 05_02_00__container_blocks__list_items__009: - spec_txt_example_position: 239 + spec_example_position: 239 source_specification: commonmark 05_02_00__container_blocks__list_items__010: - spec_txt_example_position: 240 + spec_example_position: 240 source_specification: commonmark 05_02_00__container_blocks__list_items__011: - spec_txt_example_position: 241 + spec_example_position: 241 source_specification: commonmark 05_02_00__container_blocks__list_items__012: - spec_txt_example_position: 242 + spec_example_position: 242 source_specification: commonmark 05_02_00__container_blocks__list_items__013: - spec_txt_example_position: 243 + spec_example_position: 243 source_specification: commonmark 05_02_00__container_blocks__list_items__014: - spec_txt_example_position: 244 + spec_example_position: 244 source_specification: commonmark 05_02_00__container_blocks__list_items__015: - spec_txt_example_position: 245 + spec_example_position: 245 source_specification: commonmark 05_02_00__container_blocks__list_items__016: - spec_txt_example_position: 246 + spec_example_position: 246 source_specification: commonmark 05_02_00__container_blocks__list_items__017: - spec_txt_example_position: 247 + spec_example_position: 247 source_specification: commonmark 05_02_00__container_blocks__list_items__018: - spec_txt_example_position: 248 + spec_example_position: 248 source_specification: commonmark 05_02_00__container_blocks__list_items__019: - spec_txt_example_position: 249 + spec_example_position: 249 source_specification: commonmark 05_02_00__container_blocks__list_items__020: - spec_txt_example_position: 250 + spec_example_position: 250 source_specification: commonmark 05_02_00__container_blocks__list_items__021: - spec_txt_example_position: 251 + spec_example_position: 251 source_specification: commonmark 05_02_00__container_blocks__list_items__022: - spec_txt_example_position: 252 + spec_example_position: 252 source_specification: commonmark 05_02_00__container_blocks__list_items__023: - spec_txt_example_position: 253 + spec_example_position: 253 source_specification: commonmark 05_02_00__container_blocks__list_items__024: - spec_txt_example_position: 254 + spec_example_position: 254 source_specification: commonmark 05_02_00__container_blocks__list_items__025: - spec_txt_example_position: 255 + spec_example_position: 255 source_specification: commonmark 05_02_00__container_blocks__list_items__026: - spec_txt_example_position: 256 + spec_example_position: 256 source_specification: commonmark 05_02_00__container_blocks__list_items__027: - spec_txt_example_position: 257 + spec_example_position: 257 source_specification: commonmark 05_02_00__container_blocks__list_items__028: - spec_txt_example_position: 258 + spec_example_position: 258 source_specification: commonmark 05_02_00__container_blocks__list_items__029: - spec_txt_example_position: 259 + spec_example_position: 259 source_specification: commonmark 05_02_00__container_blocks__list_items__030: - spec_txt_example_position: 260 + spec_example_position: 260 source_specification: commonmark 05_02_00__container_blocks__list_items__031: - spec_txt_example_position: 261 + spec_example_position: 261 source_specification: commonmark 05_02_00__container_blocks__list_items__032: - spec_txt_example_position: 262 + spec_example_position: 262 source_specification: commonmark 05_02_00__container_blocks__list_items__033: - spec_txt_example_position: 263 + spec_example_position: 263 source_specification: commonmark 05_02_00__container_blocks__list_items__034: - spec_txt_example_position: 264 + spec_example_position: 264 source_specification: commonmark 05_02_00__container_blocks__list_items__035: - spec_txt_example_position: 265 + spec_example_position: 265 source_specification: commonmark 05_02_00__container_blocks__list_items__036: - spec_txt_example_position: 266 + spec_example_position: 266 source_specification: commonmark 05_02_00__container_blocks__list_items__037: - spec_txt_example_position: 267 + spec_example_position: 267 source_specification: commonmark 05_02_00__container_blocks__list_items__038: - spec_txt_example_position: 268 + spec_example_position: 268 source_specification: commonmark 05_02_00__container_blocks__list_items__039: - spec_txt_example_position: 269 + spec_example_position: 269 source_specification: commonmark 05_02_00__container_blocks__list_items__040: - spec_txt_example_position: 270 + spec_example_position: 270 source_specification: commonmark 05_02_00__container_blocks__list_items__041: - spec_txt_example_position: 271 + spec_example_position: 271 source_specification: commonmark 05_02_00__container_blocks__list_items__042: - spec_txt_example_position: 272 + spec_example_position: 272 source_specification: commonmark 05_02_00__container_blocks__list_items__043: - spec_txt_example_position: 273 + spec_example_position: 273 source_specification: commonmark 05_02_00__container_blocks__list_items__044: - spec_txt_example_position: 274 + spec_example_position: 274 source_specification: commonmark 05_02_00__container_blocks__list_items__045: - spec_txt_example_position: 275 + spec_example_position: 275 source_specification: commonmark 05_02_00__container_blocks__list_items__046: - spec_txt_example_position: 276 + spec_example_position: 276 source_specification: commonmark 05_02_00__container_blocks__list_items__047: - spec_txt_example_position: 277 + spec_example_position: 277 source_specification: commonmark 05_02_00__container_blocks__list_items__048: - spec_txt_example_position: 278 + spec_example_position: 278 source_specification: commonmark 05_04_00__container_blocks__lists__001: - spec_txt_example_position: 281 + spec_example_position: 281 source_specification: commonmark 05_04_00__container_blocks__lists__002: - spec_txt_example_position: 282 + spec_example_position: 282 source_specification: commonmark 05_04_00__container_blocks__lists__003: - spec_txt_example_position: 283 + spec_example_position: 283 source_specification: commonmark 05_04_00__container_blocks__lists__004: - spec_txt_example_position: 284 + spec_example_position: 284 source_specification: commonmark 05_04_00__container_blocks__lists__005: - spec_txt_example_position: 285 + spec_example_position: 285 source_specification: commonmark 05_04_00__container_blocks__lists__006: - spec_txt_example_position: 286 + spec_example_position: 286 source_specification: commonmark 05_04_00__container_blocks__lists__007: - spec_txt_example_position: 287 + spec_example_position: 287 source_specification: commonmark 05_04_00__container_blocks__lists__008: - spec_txt_example_position: 288 + spec_example_position: 288 source_specification: commonmark 05_04_00__container_blocks__lists__009: - spec_txt_example_position: 289 + spec_example_position: 289 source_specification: commonmark 05_04_00__container_blocks__lists__010: - spec_txt_example_position: 290 + spec_example_position: 290 source_specification: commonmark 05_04_00__container_blocks__lists__011: - spec_txt_example_position: 291 + spec_example_position: 291 source_specification: commonmark 05_04_00__container_blocks__lists__012: - spec_txt_example_position: 292 + spec_example_position: 292 source_specification: commonmark 05_04_00__container_blocks__lists__013: - spec_txt_example_position: 293 + spec_example_position: 293 source_specification: commonmark 05_04_00__container_blocks__lists__014: - spec_txt_example_position: 294 + spec_example_position: 294 source_specification: commonmark 05_04_00__container_blocks__lists__015: - spec_txt_example_position: 295 + spec_example_position: 295 source_specification: commonmark 05_04_00__container_blocks__lists__016: - spec_txt_example_position: 296 + spec_example_position: 296 source_specification: commonmark 05_04_00__container_blocks__lists__017: - spec_txt_example_position: 297 + spec_example_position: 297 source_specification: commonmark 05_04_00__container_blocks__lists__018: - spec_txt_example_position: 298 + spec_example_position: 298 source_specification: commonmark 05_04_00__container_blocks__lists__019: - spec_txt_example_position: 299 + spec_example_position: 299 source_specification: commonmark 05_04_00__container_blocks__lists__020: - spec_txt_example_position: 300 + spec_example_position: 300 source_specification: commonmark 05_04_00__container_blocks__lists__021: - spec_txt_example_position: 301 + spec_example_position: 301 source_specification: commonmark 05_04_00__container_blocks__lists__022: - spec_txt_example_position: 302 + spec_example_position: 302 source_specification: commonmark 05_04_00__container_blocks__lists__023: - spec_txt_example_position: 303 + spec_example_position: 303 source_specification: commonmark 05_04_00__container_blocks__lists__024: - spec_txt_example_position: 304 + spec_example_position: 304 source_specification: commonmark 05_04_00__container_blocks__lists__025: - spec_txt_example_position: 305 + spec_example_position: 305 source_specification: commonmark 05_04_00__container_blocks__lists__026: - spec_txt_example_position: 306 + spec_example_position: 306 source_specification: commonmark 06_01_00__inlines__001: - spec_txt_example_position: 307 + spec_example_position: 307 source_specification: commonmark 06_02_00__inlines__backslash_escapes__001: - spec_txt_example_position: 308 + spec_example_position: 308 source_specification: commonmark 06_02_00__inlines__backslash_escapes__002: - spec_txt_example_position: 309 + spec_example_position: 309 source_specification: commonmark 06_02_00__inlines__backslash_escapes__003: - spec_txt_example_position: 310 + spec_example_position: 310 source_specification: commonmark 06_02_00__inlines__backslash_escapes__004: - spec_txt_example_position: 311 + spec_example_position: 311 source_specification: commonmark 06_02_00__inlines__backslash_escapes__005: - spec_txt_example_position: 312 + spec_example_position: 312 source_specification: commonmark 06_02_00__inlines__backslash_escapes__006: - spec_txt_example_position: 313 + spec_example_position: 313 source_specification: commonmark 06_02_00__inlines__backslash_escapes__007: - spec_txt_example_position: 314 + spec_example_position: 314 source_specification: commonmark 06_02_00__inlines__backslash_escapes__008: - spec_txt_example_position: 315 + spec_example_position: 315 source_specification: commonmark 06_02_00__inlines__backslash_escapes__009: - spec_txt_example_position: 316 + spec_example_position: 316 source_specification: commonmark 06_02_00__inlines__backslash_escapes__010: - spec_txt_example_position: 317 + spec_example_position: 317 source_specification: commonmark 06_02_00__inlines__backslash_escapes__011: - spec_txt_example_position: 318 + spec_example_position: 318 source_specification: commonmark 06_02_00__inlines__backslash_escapes__012: - spec_txt_example_position: 319 + spec_example_position: 319 source_specification: commonmark 06_02_00__inlines__backslash_escapes__013: - spec_txt_example_position: 320 + spec_example_position: 320 source_specification: commonmark 06_03_00__inlines__entity_and_numeric_character_references__001: - spec_txt_example_position: 321 + spec_example_position: 321 source_specification: commonmark 06_03_00__inlines__entity_and_numeric_character_references__002: - spec_txt_example_position: 322 + spec_example_position: 322 source_specification: commonmark 06_03_00__inlines__entity_and_numeric_character_references__003: - spec_txt_example_position: 323 + spec_example_position: 323 source_specification: commonmark 06_03_00__inlines__entity_and_numeric_character_references__004: - spec_txt_example_position: 324 + spec_example_position: 324 source_specification: commonmark 06_03_00__inlines__entity_and_numeric_character_references__005: - spec_txt_example_position: 325 + spec_example_position: 325 source_specification: commonmark 06_03_00__inlines__entity_and_numeric_character_references__006: - spec_txt_example_position: 326 + spec_example_position: 326 source_specification: commonmark 06_03_00__inlines__entity_and_numeric_character_references__007: - spec_txt_example_position: 327 + spec_example_position: 327 source_specification: commonmark 06_03_00__inlines__entity_and_numeric_character_references__008: - spec_txt_example_position: 328 + spec_example_position: 328 source_specification: commonmark 06_03_00__inlines__entity_and_numeric_character_references__009: - spec_txt_example_position: 329 + spec_example_position: 329 source_specification: commonmark 06_03_00__inlines__entity_and_numeric_character_references__010: - spec_txt_example_position: 330 + spec_example_position: 330 source_specification: commonmark 06_03_00__inlines__entity_and_numeric_character_references__011: - spec_txt_example_position: 331 + spec_example_position: 331 source_specification: commonmark 06_03_00__inlines__entity_and_numeric_character_references__012: - spec_txt_example_position: 332 + spec_example_position: 332 source_specification: commonmark 06_03_00__inlines__entity_and_numeric_character_references__013: - spec_txt_example_position: 333 + spec_example_position: 333 source_specification: commonmark 06_03_00__inlines__entity_and_numeric_character_references__014: - spec_txt_example_position: 334 + spec_example_position: 334 source_specification: commonmark 06_03_00__inlines__entity_and_numeric_character_references__015: - spec_txt_example_position: 335 + spec_example_position: 335 source_specification: commonmark 06_03_00__inlines__entity_and_numeric_character_references__016: - spec_txt_example_position: 336 + spec_example_position: 336 source_specification: commonmark 06_03_00__inlines__entity_and_numeric_character_references__017: - spec_txt_example_position: 337 + spec_example_position: 337 source_specification: commonmark 06_04_00__inlines__code_spans__001: - spec_txt_example_position: 338 + spec_example_position: 338 source_specification: commonmark 06_04_00__inlines__code_spans__002: - spec_txt_example_position: 339 + spec_example_position: 339 source_specification: commonmark 06_04_00__inlines__code_spans__003: - spec_txt_example_position: 340 + spec_example_position: 340 source_specification: commonmark 06_04_00__inlines__code_spans__004: - spec_txt_example_position: 341 + spec_example_position: 341 source_specification: commonmark 06_04_00__inlines__code_spans__005: - spec_txt_example_position: 342 + spec_example_position: 342 source_specification: commonmark 06_04_00__inlines__code_spans__006: - spec_txt_example_position: 343 + spec_example_position: 343 source_specification: commonmark 06_04_00__inlines__code_spans__007: - spec_txt_example_position: 344 + spec_example_position: 344 source_specification: commonmark 06_04_00__inlines__code_spans__008: - spec_txt_example_position: 345 + spec_example_position: 345 source_specification: commonmark 06_04_00__inlines__code_spans__009: - spec_txt_example_position: 346 + spec_example_position: 346 source_specification: commonmark 06_04_00__inlines__code_spans__010: - spec_txt_example_position: 347 + spec_example_position: 347 source_specification: commonmark 06_04_00__inlines__code_spans__011: - spec_txt_example_position: 348 + spec_example_position: 348 source_specification: commonmark 06_04_00__inlines__code_spans__012: - spec_txt_example_position: 349 + spec_example_position: 349 source_specification: commonmark 06_04_00__inlines__code_spans__013: - spec_txt_example_position: 350 + spec_example_position: 350 source_specification: commonmark 06_04_00__inlines__code_spans__014: - spec_txt_example_position: 351 + spec_example_position: 351 source_specification: commonmark 06_04_00__inlines__code_spans__015: - spec_txt_example_position: 352 + spec_example_position: 352 source_specification: commonmark 06_04_00__inlines__code_spans__016: - spec_txt_example_position: 353 + spec_example_position: 353 source_specification: commonmark 06_04_00__inlines__code_spans__017: - spec_txt_example_position: 354 + spec_example_position: 354 source_specification: commonmark 06_04_00__inlines__code_spans__018: - spec_txt_example_position: 355 + spec_example_position: 355 source_specification: commonmark 06_04_00__inlines__code_spans__019: - spec_txt_example_position: 356 + spec_example_position: 356 source_specification: commonmark 06_04_00__inlines__code_spans__020: - spec_txt_example_position: 357 + spec_example_position: 357 source_specification: commonmark 06_04_00__inlines__code_spans__021: - spec_txt_example_position: 358 + spec_example_position: 358 source_specification: commonmark 06_04_00__inlines__code_spans__022: - spec_txt_example_position: 359 + spec_example_position: 359 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__001: - spec_txt_example_position: 360 + spec_example_position: 360 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__002: - spec_txt_example_position: 361 + spec_example_position: 361 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__003: - spec_txt_example_position: 362 + spec_example_position: 362 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__004: - spec_txt_example_position: 363 + spec_example_position: 363 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__005: - spec_txt_example_position: 364 + spec_example_position: 364 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__006: - spec_txt_example_position: 365 + spec_example_position: 365 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__007: - spec_txt_example_position: 366 + spec_example_position: 366 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__008: - spec_txt_example_position: 367 + spec_example_position: 367 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__009: - spec_txt_example_position: 368 + spec_example_position: 368 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__010: - spec_txt_example_position: 369 + spec_example_position: 369 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__011: - spec_txt_example_position: 370 + spec_example_position: 370 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__012: - spec_txt_example_position: 371 + spec_example_position: 371 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__013: - spec_txt_example_position: 372 + spec_example_position: 372 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__014: - spec_txt_example_position: 373 + spec_example_position: 373 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__015: - spec_txt_example_position: 374 + spec_example_position: 374 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__016: - spec_txt_example_position: 375 + spec_example_position: 375 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__017: - spec_txt_example_position: 376 + spec_example_position: 376 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__018: - spec_txt_example_position: 377 + spec_example_position: 377 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__019: - spec_txt_example_position: 378 + spec_example_position: 378 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__020: - spec_txt_example_position: 379 + spec_example_position: 379 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__021: - spec_txt_example_position: 380 + spec_example_position: 380 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__022: - spec_txt_example_position: 381 + spec_example_position: 381 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__023: - spec_txt_example_position: 382 + spec_example_position: 382 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__024: - spec_txt_example_position: 383 + spec_example_position: 383 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__025: - spec_txt_example_position: 384 + spec_example_position: 384 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__026: - spec_txt_example_position: 385 + spec_example_position: 385 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__027: - spec_txt_example_position: 386 + spec_example_position: 386 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__028: - spec_txt_example_position: 387 + spec_example_position: 387 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__029: - spec_txt_example_position: 388 + spec_example_position: 388 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__030: - spec_txt_example_position: 389 + spec_example_position: 389 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__031: - spec_txt_example_position: 390 + spec_example_position: 390 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__032: - spec_txt_example_position: 391 + spec_example_position: 391 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__033: - spec_txt_example_position: 392 + spec_example_position: 392 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__034: - spec_txt_example_position: 393 + spec_example_position: 393 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__035: - spec_txt_example_position: 394 + spec_example_position: 394 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__036: - spec_txt_example_position: 395 + spec_example_position: 395 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__037: - spec_txt_example_position: 396 + spec_example_position: 396 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__038: - spec_txt_example_position: 397 + spec_example_position: 397 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__039: - spec_txt_example_position: 398 + spec_example_position: 398 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__040: - spec_txt_example_position: 399 + spec_example_position: 399 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__041: - spec_txt_example_position: 400 + spec_example_position: 400 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__042: - spec_txt_example_position: 401 + spec_example_position: 401 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__043: - spec_txt_example_position: 402 + spec_example_position: 402 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__044: - spec_txt_example_position: 403 + spec_example_position: 403 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__045: - spec_txt_example_position: 404 + spec_example_position: 404 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__046: - spec_txt_example_position: 405 + spec_example_position: 405 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__047: - spec_txt_example_position: 406 + spec_example_position: 406 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__048: - spec_txt_example_position: 407 + spec_example_position: 407 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__049: - spec_txt_example_position: 408 + spec_example_position: 408 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__050: - spec_txt_example_position: 409 + spec_example_position: 409 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__051: - spec_txt_example_position: 410 + spec_example_position: 410 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__052: - spec_txt_example_position: 411 + spec_example_position: 411 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__053: - spec_txt_example_position: 412 + spec_example_position: 412 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__054: - spec_txt_example_position: 413 + spec_example_position: 413 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__055: - spec_txt_example_position: 414 + spec_example_position: 414 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__056: - spec_txt_example_position: 415 + spec_example_position: 415 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__057: - spec_txt_example_position: 416 + spec_example_position: 416 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__058: - spec_txt_example_position: 417 + spec_example_position: 417 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__059: - spec_txt_example_position: 418 + spec_example_position: 418 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__060: - spec_txt_example_position: 419 + spec_example_position: 419 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__061: - spec_txt_example_position: 420 + spec_example_position: 420 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__062: - spec_txt_example_position: 421 + spec_example_position: 421 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__063: - spec_txt_example_position: 422 + spec_example_position: 422 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__064: - spec_txt_example_position: 423 + spec_example_position: 423 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__065: - spec_txt_example_position: 424 + spec_example_position: 424 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__066: - spec_txt_example_position: 425 + spec_example_position: 425 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__067: - spec_txt_example_position: 426 + spec_example_position: 426 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__068: - spec_txt_example_position: 427 + spec_example_position: 427 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__069: - spec_txt_example_position: 428 + spec_example_position: 428 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__070: - spec_txt_example_position: 429 + spec_example_position: 429 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__071: - spec_txt_example_position: 430 + spec_example_position: 430 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__072: - spec_txt_example_position: 431 + spec_example_position: 431 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__073: - spec_txt_example_position: 432 + spec_example_position: 432 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__074: - spec_txt_example_position: 433 + spec_example_position: 433 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__075: - spec_txt_example_position: 434 + spec_example_position: 434 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__076: - spec_txt_example_position: 435 + spec_example_position: 435 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__077: - spec_txt_example_position: 436 + spec_example_position: 436 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__078: - spec_txt_example_position: 437 + spec_example_position: 437 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__079: - spec_txt_example_position: 438 + spec_example_position: 438 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__080: - spec_txt_example_position: 439 + spec_example_position: 439 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__081: - spec_txt_example_position: 440 + spec_example_position: 440 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__082: - spec_txt_example_position: 441 + spec_example_position: 441 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__083: - spec_txt_example_position: 442 + spec_example_position: 442 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__084: - spec_txt_example_position: 443 + spec_example_position: 443 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__085: - spec_txt_example_position: 444 + spec_example_position: 444 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__086: - spec_txt_example_position: 445 + spec_example_position: 445 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__087: - spec_txt_example_position: 446 + spec_example_position: 446 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__088: - spec_txt_example_position: 447 + spec_example_position: 447 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__089: - spec_txt_example_position: 448 + spec_example_position: 448 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__090: - spec_txt_example_position: 449 + spec_example_position: 449 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__091: - spec_txt_example_position: 450 + spec_example_position: 450 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__092: - spec_txt_example_position: 451 + spec_example_position: 451 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__093: - spec_txt_example_position: 452 + spec_example_position: 452 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__094: - spec_txt_example_position: 453 + spec_example_position: 453 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__095: - spec_txt_example_position: 454 + spec_example_position: 454 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__096: - spec_txt_example_position: 455 + spec_example_position: 455 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__097: - spec_txt_example_position: 456 + spec_example_position: 456 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__098: - spec_txt_example_position: 457 + spec_example_position: 457 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__099: - spec_txt_example_position: 458 + spec_example_position: 458 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__100: - spec_txt_example_position: 459 + spec_example_position: 459 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__101: - spec_txt_example_position: 460 + spec_example_position: 460 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__102: - spec_txt_example_position: 461 + spec_example_position: 461 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__103: - spec_txt_example_position: 462 + spec_example_position: 462 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__104: - spec_txt_example_position: 463 + spec_example_position: 463 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__105: - spec_txt_example_position: 464 + spec_example_position: 464 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__106: - spec_txt_example_position: 465 + spec_example_position: 465 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__107: - spec_txt_example_position: 466 + spec_example_position: 466 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__108: - spec_txt_example_position: 467 + spec_example_position: 467 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__109: - spec_txt_example_position: 468 + spec_example_position: 468 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__110: - spec_txt_example_position: 469 + spec_example_position: 469 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__111: - spec_txt_example_position: 470 + spec_example_position: 470 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__112: - spec_txt_example_position: 471 + spec_example_position: 471 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__113: - spec_txt_example_position: 472 + spec_example_position: 472 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__114: - spec_txt_example_position: 473 + spec_example_position: 473 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__115: - spec_txt_example_position: 474 + spec_example_position: 474 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__116: - spec_txt_example_position: 475 + spec_example_position: 475 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__117: - spec_txt_example_position: 476 + spec_example_position: 476 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__118: - spec_txt_example_position: 477 + spec_example_position: 477 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__119: - spec_txt_example_position: 478 + spec_example_position: 478 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__120: - spec_txt_example_position: 479 + spec_example_position: 479 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__121: - spec_txt_example_position: 480 + spec_example_position: 480 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__122: - spec_txt_example_position: 481 + spec_example_position: 481 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__123: - spec_txt_example_position: 482 + spec_example_position: 482 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__124: - spec_txt_example_position: 483 + spec_example_position: 483 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__125: - spec_txt_example_position: 484 + spec_example_position: 484 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__126: - spec_txt_example_position: 485 + spec_example_position: 485 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__127: - spec_txt_example_position: 486 + spec_example_position: 486 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__128: - spec_txt_example_position: 487 + spec_example_position: 487 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__129: - spec_txt_example_position: 488 + spec_example_position: 488 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__130: - spec_txt_example_position: 489 + spec_example_position: 489 source_specification: commonmark 06_05_00__inlines__emphasis_and_strong_emphasis__131: - spec_txt_example_position: 490 + spec_example_position: 490 source_specification: commonmark 06_06_00__inlines__strikethrough_extension__001: - spec_txt_example_position: 491 + spec_example_position: 491 source_specification: github 06_06_00__inlines__strikethrough_extension__002: - spec_txt_example_position: 492 + spec_example_position: 492 source_specification: github 06_07_00__inlines__links__001: - spec_txt_example_position: 493 + spec_example_position: 493 source_specification: commonmark 06_07_00__inlines__links__002: - spec_txt_example_position: 494 + spec_example_position: 494 source_specification: commonmark 06_07_00__inlines__links__003: - spec_txt_example_position: 495 + spec_example_position: 495 source_specification: commonmark 06_07_00__inlines__links__004: - spec_txt_example_position: 496 + spec_example_position: 496 source_specification: commonmark 06_07_00__inlines__links__005: - spec_txt_example_position: 497 + spec_example_position: 497 source_specification: commonmark 06_07_00__inlines__links__006: - spec_txt_example_position: 498 + spec_example_position: 498 source_specification: commonmark 06_07_00__inlines__links__007: - spec_txt_example_position: 499 + spec_example_position: 499 source_specification: commonmark 06_07_00__inlines__links__008: - spec_txt_example_position: 500 + spec_example_position: 500 source_specification: commonmark 06_07_00__inlines__links__009: - spec_txt_example_position: 501 + spec_example_position: 501 source_specification: commonmark 06_07_00__inlines__links__010: - spec_txt_example_position: 502 + spec_example_position: 502 source_specification: commonmark 06_07_00__inlines__links__011: - spec_txt_example_position: 503 + spec_example_position: 503 source_specification: commonmark 06_07_00__inlines__links__012: - spec_txt_example_position: 504 + spec_example_position: 504 source_specification: commonmark 06_07_00__inlines__links__013: - spec_txt_example_position: 505 + spec_example_position: 505 source_specification: commonmark 06_07_00__inlines__links__014: - spec_txt_example_position: 506 + spec_example_position: 506 source_specification: commonmark 06_07_00__inlines__links__015: - spec_txt_example_position: 507 + spec_example_position: 507 source_specification: commonmark 06_07_00__inlines__links__016: - spec_txt_example_position: 508 + spec_example_position: 508 source_specification: commonmark 06_07_00__inlines__links__017: - spec_txt_example_position: 509 + spec_example_position: 509 source_specification: commonmark 06_07_00__inlines__links__018: - spec_txt_example_position: 510 + spec_example_position: 510 source_specification: commonmark 06_07_00__inlines__links__019: - spec_txt_example_position: 511 + spec_example_position: 511 source_specification: commonmark 06_07_00__inlines__links__020: - spec_txt_example_position: 512 + spec_example_position: 512 source_specification: commonmark 06_07_00__inlines__links__021: - spec_txt_example_position: 513 + spec_example_position: 513 source_specification: commonmark 06_07_00__inlines__links__022: - spec_txt_example_position: 514 + spec_example_position: 514 source_specification: commonmark 06_07_00__inlines__links__023: - spec_txt_example_position: 515 + spec_example_position: 515 source_specification: commonmark 06_07_00__inlines__links__024: - spec_txt_example_position: 516 + spec_example_position: 516 source_specification: commonmark 06_07_00__inlines__links__025: - spec_txt_example_position: 517 + spec_example_position: 517 source_specification: commonmark 06_07_00__inlines__links__026: - spec_txt_example_position: 518 + spec_example_position: 518 source_specification: commonmark 06_07_00__inlines__links__027: - spec_txt_example_position: 519 + spec_example_position: 519 source_specification: commonmark 06_07_00__inlines__links__028: - spec_txt_example_position: 520 + spec_example_position: 520 source_specification: commonmark 06_07_00__inlines__links__029: - spec_txt_example_position: 521 + spec_example_position: 521 source_specification: commonmark 06_07_00__inlines__links__030: - spec_txt_example_position: 522 + spec_example_position: 522 source_specification: commonmark 06_07_00__inlines__links__031: - spec_txt_example_position: 523 + spec_example_position: 523 source_specification: commonmark 06_07_00__inlines__links__032: - spec_txt_example_position: 524 + spec_example_position: 524 source_specification: commonmark 06_07_00__inlines__links__033: - spec_txt_example_position: 525 + spec_example_position: 525 source_specification: commonmark 06_07_00__inlines__links__034: - spec_txt_example_position: 526 + spec_example_position: 526 source_specification: commonmark 06_07_00__inlines__links__035: - spec_txt_example_position: 527 + spec_example_position: 527 source_specification: commonmark 06_07_00__inlines__links__036: - spec_txt_example_position: 528 + spec_example_position: 528 source_specification: commonmark 06_07_00__inlines__links__037: - spec_txt_example_position: 529 + spec_example_position: 529 source_specification: commonmark 06_07_00__inlines__links__038: - spec_txt_example_position: 530 + spec_example_position: 530 source_specification: commonmark 06_07_00__inlines__links__039: - spec_txt_example_position: 531 + spec_example_position: 531 source_specification: commonmark 06_07_00__inlines__links__040: - spec_txt_example_position: 532 + spec_example_position: 532 source_specification: commonmark 06_07_00__inlines__links__041: - spec_txt_example_position: 533 + spec_example_position: 533 source_specification: commonmark 06_07_00__inlines__links__042: - spec_txt_example_position: 534 + spec_example_position: 534 source_specification: commonmark 06_07_00__inlines__links__043: - spec_txt_example_position: 535 + spec_example_position: 535 source_specification: commonmark 06_07_00__inlines__links__044: - spec_txt_example_position: 536 + spec_example_position: 536 source_specification: commonmark 06_07_00__inlines__links__045: - spec_txt_example_position: 537 + spec_example_position: 537 source_specification: commonmark 06_07_00__inlines__links__046: - spec_txt_example_position: 538 + spec_example_position: 538 source_specification: commonmark 06_07_00__inlines__links__047: - spec_txt_example_position: 539 + spec_example_position: 539 source_specification: commonmark 06_07_00__inlines__links__048: - spec_txt_example_position: 540 + spec_example_position: 540 source_specification: commonmark 06_07_00__inlines__links__049: - spec_txt_example_position: 541 + spec_example_position: 541 source_specification: commonmark 06_07_00__inlines__links__050: - spec_txt_example_position: 542 + spec_example_position: 542 source_specification: commonmark 06_07_00__inlines__links__051: - spec_txt_example_position: 543 + spec_example_position: 543 source_specification: commonmark 06_07_00__inlines__links__052: - spec_txt_example_position: 544 + spec_example_position: 544 source_specification: commonmark 06_07_00__inlines__links__053: - spec_txt_example_position: 545 + spec_example_position: 545 source_specification: commonmark 06_07_00__inlines__links__054: - spec_txt_example_position: 546 + spec_example_position: 546 source_specification: commonmark 06_07_00__inlines__links__055: - spec_txt_example_position: 547 + spec_example_position: 547 source_specification: commonmark 06_07_00__inlines__links__056: - spec_txt_example_position: 548 + spec_example_position: 548 source_specification: commonmark 06_07_00__inlines__links__057: - spec_txt_example_position: 549 + spec_example_position: 549 source_specification: commonmark 06_07_00__inlines__links__058: - spec_txt_example_position: 550 + spec_example_position: 550 source_specification: commonmark 06_07_00__inlines__links__059: - spec_txt_example_position: 551 + spec_example_position: 551 source_specification: commonmark 06_07_00__inlines__links__060: - spec_txt_example_position: 552 + spec_example_position: 552 source_specification: commonmark 06_07_00__inlines__links__061: - spec_txt_example_position: 553 + spec_example_position: 553 source_specification: commonmark 06_07_00__inlines__links__062: - spec_txt_example_position: 554 + spec_example_position: 554 source_specification: commonmark 06_07_00__inlines__links__063: - spec_txt_example_position: 555 + spec_example_position: 555 source_specification: commonmark 06_07_00__inlines__links__064: - spec_txt_example_position: 556 + spec_example_position: 556 source_specification: commonmark 06_07_00__inlines__links__065: - spec_txt_example_position: 557 + spec_example_position: 557 source_specification: commonmark 06_07_00__inlines__links__066: - spec_txt_example_position: 558 + spec_example_position: 558 source_specification: commonmark 06_07_00__inlines__links__067: - spec_txt_example_position: 559 + spec_example_position: 559 source_specification: commonmark 06_07_00__inlines__links__068: - spec_txt_example_position: 560 + spec_example_position: 560 source_specification: commonmark 06_07_00__inlines__links__069: - spec_txt_example_position: 561 + spec_example_position: 561 source_specification: commonmark 06_07_00__inlines__links__070: - spec_txt_example_position: 562 + spec_example_position: 562 source_specification: commonmark 06_07_00__inlines__links__071: - spec_txt_example_position: 563 + spec_example_position: 563 source_specification: commonmark 06_07_00__inlines__links__072: - spec_txt_example_position: 564 + spec_example_position: 564 source_specification: commonmark 06_07_00__inlines__links__073: - spec_txt_example_position: 565 + spec_example_position: 565 source_specification: commonmark 06_07_00__inlines__links__074: - spec_txt_example_position: 566 + spec_example_position: 566 source_specification: commonmark 06_07_00__inlines__links__075: - spec_txt_example_position: 567 + spec_example_position: 567 source_specification: commonmark 06_07_00__inlines__links__076: - spec_txt_example_position: 568 + spec_example_position: 568 source_specification: commonmark 06_07_00__inlines__links__077: - spec_txt_example_position: 569 + spec_example_position: 569 source_specification: commonmark 06_07_00__inlines__links__078: - spec_txt_example_position: 570 + spec_example_position: 570 source_specification: commonmark 06_07_00__inlines__links__079: - spec_txt_example_position: 571 + spec_example_position: 571 source_specification: commonmark 06_07_00__inlines__links__080: - spec_txt_example_position: 572 + spec_example_position: 572 source_specification: commonmark 06_07_00__inlines__links__081: - spec_txt_example_position: 573 + spec_example_position: 573 source_specification: commonmark 06_07_00__inlines__links__082: - spec_txt_example_position: 574 + spec_example_position: 574 source_specification: commonmark 06_07_00__inlines__links__083: - spec_txt_example_position: 575 + spec_example_position: 575 source_specification: commonmark 06_07_00__inlines__links__084: - spec_txt_example_position: 576 + spec_example_position: 576 source_specification: commonmark 06_07_00__inlines__links__085: - spec_txt_example_position: 577 + spec_example_position: 577 source_specification: commonmark 06_07_00__inlines__links__086: - spec_txt_example_position: 578 + spec_example_position: 578 source_specification: commonmark 06_07_00__inlines__links__087: - spec_txt_example_position: 579 + spec_example_position: 579 source_specification: commonmark 06_08_00__inlines__images__001: - spec_txt_example_position: 580 + spec_example_position: 580 source_specification: commonmark 06_08_00__inlines__images__002: - spec_txt_example_position: 581 + spec_example_position: 581 source_specification: commonmark 06_08_00__inlines__images__003: - spec_txt_example_position: 582 + spec_example_position: 582 source_specification: commonmark 06_08_00__inlines__images__004: - spec_txt_example_position: 583 + spec_example_position: 583 source_specification: commonmark 06_08_00__inlines__images__005: - spec_txt_example_position: 584 + spec_example_position: 584 source_specification: commonmark 06_08_00__inlines__images__006: - spec_txt_example_position: 585 + spec_example_position: 585 source_specification: commonmark 06_08_00__inlines__images__007: - spec_txt_example_position: 586 + spec_example_position: 586 source_specification: commonmark 06_08_00__inlines__images__008: - spec_txt_example_position: 587 + spec_example_position: 587 source_specification: commonmark 06_08_00__inlines__images__009: - spec_txt_example_position: 588 + spec_example_position: 588 source_specification: commonmark 06_08_00__inlines__images__010: - spec_txt_example_position: 589 + spec_example_position: 589 source_specification: commonmark 06_08_00__inlines__images__011: - spec_txt_example_position: 590 + spec_example_position: 590 source_specification: commonmark 06_08_00__inlines__images__012: - spec_txt_example_position: 591 + spec_example_position: 591 source_specification: commonmark 06_08_00__inlines__images__013: - spec_txt_example_position: 592 + spec_example_position: 592 source_specification: commonmark 06_08_00__inlines__images__014: - spec_txt_example_position: 593 + spec_example_position: 593 source_specification: commonmark 06_08_00__inlines__images__015: - spec_txt_example_position: 594 + spec_example_position: 594 source_specification: commonmark 06_08_00__inlines__images__016: - spec_txt_example_position: 595 + spec_example_position: 595 source_specification: commonmark 06_08_00__inlines__images__017: - spec_txt_example_position: 596 + spec_example_position: 596 source_specification: commonmark 06_08_00__inlines__images__018: - spec_txt_example_position: 597 + spec_example_position: 597 source_specification: commonmark 06_08_00__inlines__images__019: - spec_txt_example_position: 598 + spec_example_position: 598 source_specification: commonmark 06_08_00__inlines__images__020: - spec_txt_example_position: 599 + spec_example_position: 599 source_specification: commonmark 06_08_00__inlines__images__021: - spec_txt_example_position: 600 + spec_example_position: 600 source_specification: commonmark 06_08_00__inlines__images__022: - spec_txt_example_position: 601 + spec_example_position: 601 source_specification: commonmark 06_09_00__inlines__autolinks__001: - spec_txt_example_position: 602 + spec_example_position: 602 source_specification: commonmark 06_09_00__inlines__autolinks__002: - spec_txt_example_position: 603 + spec_example_position: 603 source_specification: commonmark 06_09_00__inlines__autolinks__003: - spec_txt_example_position: 604 + spec_example_position: 604 source_specification: commonmark 06_09_00__inlines__autolinks__004: - spec_txt_example_position: 605 + spec_example_position: 605 source_specification: commonmark 06_09_00__inlines__autolinks__005: - spec_txt_example_position: 606 + spec_example_position: 606 source_specification: commonmark 06_09_00__inlines__autolinks__006: - spec_txt_example_position: 607 + spec_example_position: 607 source_specification: commonmark 06_09_00__inlines__autolinks__007: - spec_txt_example_position: 608 + spec_example_position: 608 source_specification: commonmark 06_09_00__inlines__autolinks__008: - spec_txt_example_position: 609 + spec_example_position: 609 source_specification: commonmark 06_09_00__inlines__autolinks__009: - spec_txt_example_position: 610 + spec_example_position: 610 source_specification: commonmark 06_09_00__inlines__autolinks__010: - spec_txt_example_position: 611 + spec_example_position: 611 source_specification: commonmark 06_09_00__inlines__autolinks__011: - spec_txt_example_position: 612 + spec_example_position: 612 source_specification: commonmark 06_09_00__inlines__autolinks__012: - spec_txt_example_position: 613 + spec_example_position: 613 source_specification: commonmark 06_09_00__inlines__autolinks__013: - spec_txt_example_position: 614 + spec_example_position: 614 source_specification: commonmark 06_09_00__inlines__autolinks__014: - spec_txt_example_position: 615 + spec_example_position: 615 source_specification: commonmark 06_09_00__inlines__autolinks__015: - spec_txt_example_position: 616 + spec_example_position: 616 source_specification: commonmark 06_09_00__inlines__autolinks__016: - spec_txt_example_position: 617 + spec_example_position: 617 source_specification: commonmark 06_09_00__inlines__autolinks__017: - spec_txt_example_position: 618 + spec_example_position: 618 source_specification: commonmark 06_09_00__inlines__autolinks__018: - spec_txt_example_position: 619 + spec_example_position: 619 source_specification: commonmark 06_09_00__inlines__autolinks__019: - spec_txt_example_position: 620 + spec_example_position: 620 source_specification: commonmark 06_10_00__inlines__autolinks_extension__001: - spec_txt_example_position: 621 + spec_example_position: 621 source_specification: github 06_10_00__inlines__autolinks_extension__002: - spec_txt_example_position: 622 + spec_example_position: 622 source_specification: github 06_10_00__inlines__autolinks_extension__003: - spec_txt_example_position: 623 + spec_example_position: 623 source_specification: github 06_10_00__inlines__autolinks_extension__004: - spec_txt_example_position: 624 + spec_example_position: 624 source_specification: github 06_10_00__inlines__autolinks_extension__005: - spec_txt_example_position: 625 + spec_example_position: 625 source_specification: github 06_10_00__inlines__autolinks_extension__006: - spec_txt_example_position: 626 + spec_example_position: 626 source_specification: github 06_10_00__inlines__autolinks_extension__007: - spec_txt_example_position: 627 + spec_example_position: 627 source_specification: github 06_10_00__inlines__autolinks_extension__008: - spec_txt_example_position: 628 + spec_example_position: 628 source_specification: github 06_10_00__inlines__autolinks_extension__009: - spec_txt_example_position: 629 + spec_example_position: 629 source_specification: github 06_10_00__inlines__autolinks_extension__010: - spec_txt_example_position: 630 + spec_example_position: 630 source_specification: github 06_10_00__inlines__autolinks_extension__011: - spec_txt_example_position: 631 + spec_example_position: 631 source_specification: github 06_11_00__inlines__raw_html__001: - spec_txt_example_position: 632 + spec_example_position: 632 source_specification: commonmark 06_11_00__inlines__raw_html__002: - spec_txt_example_position: 633 + spec_example_position: 633 source_specification: commonmark 06_11_00__inlines__raw_html__003: - spec_txt_example_position: 634 + spec_example_position: 634 source_specification: commonmark 06_11_00__inlines__raw_html__004: - spec_txt_example_position: 635 + spec_example_position: 635 source_specification: commonmark 06_11_00__inlines__raw_html__005: - spec_txt_example_position: 636 + spec_example_position: 636 source_specification: commonmark 06_11_00__inlines__raw_html__006: - spec_txt_example_position: 637 + spec_example_position: 637 source_specification: commonmark 06_11_00__inlines__raw_html__007: - spec_txt_example_position: 638 + spec_example_position: 638 source_specification: commonmark 06_11_00__inlines__raw_html__008: - spec_txt_example_position: 639 + spec_example_position: 639 source_specification: commonmark 06_11_00__inlines__raw_html__009: - spec_txt_example_position: 640 + spec_example_position: 640 source_specification: commonmark 06_11_00__inlines__raw_html__010: - spec_txt_example_position: 641 + spec_example_position: 641 source_specification: commonmark 06_11_00__inlines__raw_html__011: - spec_txt_example_position: 642 + spec_example_position: 642 source_specification: commonmark 06_11_00__inlines__raw_html__012: - spec_txt_example_position: 643 + spec_example_position: 643 source_specification: commonmark 06_11_00__inlines__raw_html__013: - spec_txt_example_position: 644 + spec_example_position: 644 source_specification: commonmark 06_11_00__inlines__raw_html__014: - spec_txt_example_position: 645 + spec_example_position: 645 source_specification: commonmark 06_11_00__inlines__raw_html__015: - spec_txt_example_position: 646 + spec_example_position: 646 source_specification: commonmark 06_11_00__inlines__raw_html__016: - spec_txt_example_position: 647 + spec_example_position: 647 source_specification: commonmark 06_11_00__inlines__raw_html__017: - spec_txt_example_position: 648 + spec_example_position: 648 source_specification: commonmark 06_11_00__inlines__raw_html__018: - spec_txt_example_position: 649 + spec_example_position: 649 source_specification: commonmark 06_11_00__inlines__raw_html__019: - spec_txt_example_position: 650 + spec_example_position: 650 source_specification: commonmark 06_11_00__inlines__raw_html__020: - spec_txt_example_position: 651 + spec_example_position: 651 source_specification: commonmark 06_11_00__inlines__raw_html__021: - spec_txt_example_position: 652 + spec_example_position: 652 source_specification: commonmark 06_12_00__inlines__disallowed_raw_html_extension__001: - spec_txt_example_position: 653 + spec_example_position: 653 source_specification: github 06_13_00__inlines__hard_line_breaks__001: - spec_txt_example_position: 654 + spec_example_position: 654 source_specification: commonmark 06_13_00__inlines__hard_line_breaks__002: - spec_txt_example_position: 655 + spec_example_position: 655 source_specification: commonmark 06_13_00__inlines__hard_line_breaks__003: - spec_txt_example_position: 656 + spec_example_position: 656 source_specification: commonmark 06_13_00__inlines__hard_line_breaks__004: - spec_txt_example_position: 657 + spec_example_position: 657 source_specification: commonmark 06_13_00__inlines__hard_line_breaks__005: - spec_txt_example_position: 658 + spec_example_position: 658 source_specification: commonmark 06_13_00__inlines__hard_line_breaks__006: - spec_txt_example_position: 659 + spec_example_position: 659 source_specification: commonmark 06_13_00__inlines__hard_line_breaks__007: - spec_txt_example_position: 660 + spec_example_position: 660 source_specification: commonmark 06_13_00__inlines__hard_line_breaks__008: - spec_txt_example_position: 661 + spec_example_position: 661 source_specification: commonmark 06_13_00__inlines__hard_line_breaks__009: - spec_txt_example_position: 662 + spec_example_position: 662 source_specification: commonmark 06_13_00__inlines__hard_line_breaks__010: - spec_txt_example_position: 663 + spec_example_position: 663 source_specification: commonmark 06_13_00__inlines__hard_line_breaks__011: - spec_txt_example_position: 664 + spec_example_position: 664 source_specification: commonmark 06_13_00__inlines__hard_line_breaks__012: - spec_txt_example_position: 665 + spec_example_position: 665 source_specification: commonmark 06_13_00__inlines__hard_line_breaks__013: - spec_txt_example_position: 666 + spec_example_position: 666 source_specification: commonmark 06_13_00__inlines__hard_line_breaks__014: - spec_txt_example_position: 667 + spec_example_position: 667 source_specification: commonmark 06_13_00__inlines__hard_line_breaks__015: - spec_txt_example_position: 668 + spec_example_position: 668 source_specification: commonmark 06_14_00__inlines__soft_line_breaks__001: - spec_txt_example_position: 669 + spec_example_position: 669 source_specification: commonmark 06_14_00__inlines__soft_line_breaks__002: - spec_txt_example_position: 670 + spec_example_position: 670 source_specification: commonmark 06_15_00__inlines__textual_content__001: - spec_txt_example_position: 671 + spec_example_position: 671 source_specification: commonmark 06_15_00__inlines__textual_content__002: - spec_txt_example_position: 672 + spec_example_position: 672 source_specification: commonmark 06_15_00__inlines__textual_content__003: - spec_txt_example_position: 673 + spec_example_position: 673 source_specification: commonmark 07_01_00__gitlab_official_specification_markdown__footnotes__001: - spec_txt_example_position: 674 + spec_example_position: 674 source_specification: gitlab 07_02_00__gitlab_official_specification_markdown__task_list_items__001: - spec_txt_example_position: 675 + spec_example_position: 675 source_specification: gitlab 07_02_00__gitlab_official_specification_markdown__task_list_items__002: - spec_txt_example_position: 676 + spec_example_position: 676 source_specification: gitlab 07_02_00__gitlab_official_specification_markdown__task_list_items__003: - spec_txt_example_position: 677 + spec_example_position: 677 source_specification: gitlab 07_02_00__gitlab_official_specification_markdown__task_list_items__004: - spec_txt_example_position: 678 + spec_example_position: 678 source_specification: gitlab 07_03_00__gitlab_official_specification_markdown__front_matter__001: - spec_txt_example_position: 679 + spec_example_position: 679 source_specification: gitlab 07_03_00__gitlab_official_specification_markdown__front_matter__002: - spec_txt_example_position: 680 + spec_example_position: 680 source_specification: gitlab 07_03_00__gitlab_official_specification_markdown__front_matter__003: - spec_txt_example_position: 681 + spec_example_position: 681 source_specification: gitlab 07_03_00__gitlab_official_specification_markdown__front_matter__004: - spec_txt_example_position: 682 + spec_example_position: 682 source_specification: gitlab 07_03_00__gitlab_official_specification_markdown__front_matter__005: - spec_txt_example_position: 683 + spec_example_position: 683 source_specification: gitlab 07_04_00__gitlab_official_specification_markdown__table_of_contents__001: - spec_txt_example_position: 684 + spec_example_position: 684 source_specification: gitlab 07_04_00__gitlab_official_specification_markdown__table_of_contents__002: - spec_txt_example_position: 685 + spec_example_position: 685 source_specification: gitlab 07_04_00__gitlab_official_specification_markdown__table_of_contents__003: - spec_txt_example_position: 686 + spec_example_position: 686 source_specification: gitlab 07_04_00__gitlab_official_specification_markdown__table_of_contents__004: - spec_txt_example_position: 687 + spec_example_position: 687 source_specification: gitlab 08_01_00__gitlab_internal_extension_markdown__audio__001: - spec_txt_example_position: 688 + spec_example_position: 688 source_specification: gitlab 08_01_00__gitlab_internal_extension_markdown__audio__002: - spec_txt_example_position: 689 + spec_example_position: 689 source_specification: gitlab 08_02_00__gitlab_internal_extension_markdown__video__001: - spec_txt_example_position: 690 + spec_example_position: 690 source_specification: gitlab 08_02_00__gitlab_internal_extension_markdown__video__002: - spec_txt_example_position: 691 + spec_example_position: 691 source_specification: gitlab 08_03_00__gitlab_internal_extension_markdown__markdown_preview_api_request_overrides__001: - spec_txt_example_position: 692 + spec_example_position: 692 source_specification: gitlab 08_03_00__gitlab_internal_extension_markdown__markdown_preview_api_request_overrides__002: - spec_txt_example_position: 693 + spec_example_position: 693 source_specification: gitlab 08_03_00__gitlab_internal_extension_markdown__markdown_preview_api_request_overrides__003: - spec_txt_example_position: 694 + spec_example_position: 694 source_specification: gitlab 08_03_00__gitlab_internal_extension_markdown__markdown_preview_api_request_overrides__004: - spec_txt_example_position: 695 + spec_example_position: 695 source_specification: gitlab 08_03_00__gitlab_internal_extension_markdown__markdown_preview_api_request_overrides__005: - spec_txt_example_position: 696 + spec_example_position: 696 source_specification: gitlab 08_03_00__gitlab_internal_extension_markdown__markdown_preview_api_request_overrides__006: - spec_txt_example_position: 697 + spec_example_position: 697 source_specification: gitlab diff --git a/glfm_specification/example_snapshots/html.yml b/glfm_specification/output_example_snapshots/html.yml similarity index 100% rename from glfm_specification/example_snapshots/html.yml rename to glfm_specification/output_example_snapshots/html.yml diff --git a/glfm_specification/example_snapshots/markdown.yml b/glfm_specification/output_example_snapshots/markdown.yml similarity index 100% rename from glfm_specification/example_snapshots/markdown.yml rename to glfm_specification/output_example_snapshots/markdown.yml diff --git a/glfm_specification/example_snapshots/prosemirror_json.yml b/glfm_specification/output_example_snapshots/prosemirror_json.yml similarity index 100% rename from glfm_specification/example_snapshots/prosemirror_json.yml rename to glfm_specification/output_example_snapshots/prosemirror_json.yml diff --git a/glfm_specification/output/spec.html b/glfm_specification/output_example_snapshots/snapshot_spec.html similarity index 82% rename from glfm_specification/output/spec.html rename to glfm_specification/output_example_snapshots/snapshot_spec.html index e57cd344618..c78d41e1392 100644 --- a/glfm_specification/output/spec.html +++ b/glfm_specification/output_example_snapshots/snapshot_spec.html @@ -3,80 +3,77 @@ version: alpha -

-Introduction

-

TODO: Write a GitLab-specific version of the GitHub Flavored Markdown intro section.

-

+

Preliminaries

-

+

Characters and lines

-

Any sequence of [characters] is a valid CommonMark +

Any sequence of [characters] is a valid CommonMark document.

-

A character is a Unicode code point. Although some +

A character is a Unicode code point. Although some code points (for example, combining accents) do not correspond to characters in an intuitive sense, all code points count as characters for purposes of this spec.

-

This spec does not specify an encoding; it thinks of lines as composed +

This spec does not specify an encoding; it thinks of lines as composed of [characters] rather than bytes. A conforming parser may be limited to a certain encoding.

-

A line is a sequence of zero or more [characters] +

A line is a sequence of zero or more [characters] other than newline (U+000A) or carriage return (U+000D), followed by a [line ending] or by the end of file.

-

A line ending is a newline (U+000A), a carriage return +

A line ending is a newline (U+000A), a carriage return (U+000D) not followed by a newline, or a carriage return and a following newline.

-

A line containing no characters, or a line containing only spaces +

A line containing no characters, or a line containing only spaces (U+0020) or tabs (U+0009), is called a blank line.

-

The following definitions of character classes will be used in this spec:

-

A whitespace character is a space +

The following definitions of character classes will be used in this spec:

+

A whitespace character is a space (U+0020), tab (U+0009), newline (U+000A), line tabulation (U+000B), form feed (U+000C), or carriage return (U+000D).

-

Whitespace is a sequence of one or more [whitespace +

Whitespace is a sequence of one or more [whitespace characters].

-

A Unicode whitespace character is +

A Unicode whitespace character is any code point in the Unicode Zs general category, or a tab (U+0009), carriage return (U+000D), newline (U+000A), or form feed (U+000C).

-

Unicode whitespace is a sequence of one +

Unicode whitespace is a sequence of one or more [Unicode whitespace characters].

-

A space is U+0020.

-

A non-whitespace character is any character +

A space is U+0020.

+

A non-whitespace character is any character that is not a [whitespace character].

-

An ASCII punctuation character +

An ASCII punctuation character is !, ", #, $, %, &, ', (, ), *, +, ,, -, ., / (U+0021–2F), :, ;, <, =, >, ?, @ (U+003A–0040), [, \, ], ^, _, ` (U+005B–0060), {, |, }, or ~ (U+007B–007E).

-

A punctuation character is an [ASCII +

A punctuation character is an [ASCII punctuation character] or anything in the general Unicode categories Pc, Pd, Pe, Pf, Pi, Po, or Ps.

-

+

Tabs

-

Tabs in lines are not expanded to [spaces]. However, +

Tabs in lines are not expanded to [spaces]. However, in contexts where whitespace helps to define block structure, tabs behave as if they were replaced by spaces with a tab stop of 4 characters.

-

Thus, for example, a tab can be used instead of four spaces +

Thus, for example, a tab can be used instead of four spaces in an indented code block. (Note, however, that internal tabs are passed through as literal tabs, not expanded to spaces.)

-
→foo→baz→→bim
+
→foo→baz→→bim
 .
 <pre><code>foo→baz→→bim
 </code></pre>
-
  →foo→baz→→bim
+
  →foo→baz→→bim
 .
 <pre><code>foo→baz→→bim
 </code></pre>
-
    a→a
+
    a→a
     ὐ→a
 .
 <pre><code>a→a
@@ -84,11 +81,11 @@ spaces.)

</code></pre>
-

In the following example, a continuation paragraph of a list +

In the following example, a continuation paragraph of a list item is indented with a tab; this has exactly the same effect as indentation with four spaces would:

-
  - foo
+
  - foo
 
 →bar
 .
@@ -101,7 +98,7 @@ as indentation with four spaces would:

-
- foo
+
- foo
 
 →→bar
 .
@@ -114,7 +111,7 @@ as indentation with four spaces would:

</ul>
-

Normally the > that begins a block quote may be followed +

Normally the > that begins a block quote may be followed optionally by a space, which is not considered part of the content. In the following case > is followed by a tab, which is treated as if it were expanded into three spaces. @@ -123,7 +120,7 @@ delimiter, foo is considered to be indented six spaces inside the block quote context, so we get an indented code block starting with two spaces.

-
>→→foo
+
>→→foo
 .
 <blockquote>
 <pre><code>  foo
@@ -132,7 +129,7 @@ code block starting with two spaces.

-
-→→foo
+
-→→foo
 .
 <ul>
 <li>
@@ -143,7 +140,7 @@ code block starting with two spaces.

-
    foo
+
    foo
 →bar
 .
 <pre><code>foo
@@ -152,7 +149,7 @@ code block starting with two spaces.

-
 - foo
+
 - foo
    - bar
 → - baz
 .
@@ -170,36 +167,36 @@ code block starting with two spaces.

-
#→Foo
+
#→Foo
 .
 <h1>Foo</h1>
-
*→*→*→
+
*→*→*→
 .
 <hr />
-

+

Insecure characters

-

For security reasons, the Unicode character U+0000 must be replaced +

For security reasons, the Unicode character U+0000 must be replaced with the REPLACEMENT CHARACTER (U+FFFD).

-

+

Blocks and inlines

-

We can think of a document as a sequence of +

We can think of a document as a sequence of blocks---structural elements like paragraphs, block quotations, lists, headings, rules, and code blocks. Some blocks (like block quotes and list items) contain other blocks; others (like headings and paragraphs) contain inline content---text, links, emphasized text, images, code spans, and so on.

-

+

Precedence

-

Indicators of block structure always take precedence over indicators +

Indicators of block structure always take precedence over indicators of inline structure. So, for example, the following is a list with two items, not a list with one item containing a code span:

-
- `one
+
- `one
 - two`
 .
 <ul>
@@ -208,7 +205,7 @@ two items, not a list with one item containing a code span:

</ul>
-

This means that parsing can proceed in two steps: first, the block +

This means that parsing can proceed in two steps: first, the block structure of the document can be discerned; second, text lines inside paragraphs, headings, and other block constructs can be parsed for inline structure. The second step requires information about link reference @@ -216,24 +213,24 @@ definitions that will be available only at the end of the first step. Note that the first step requires processing lines in sequence, but the second can be parallelized, since the inline parsing of one block element does not affect the inline parsing of any other.

-

+

Container blocks and leaf blocks

-

We can divide blocks into two types: +

We can divide blocks into two types: container blocks, which can contain other blocks, and leaf blocks, which cannot.

-

+

Leaf blocks

-

This section describes the different kinds of leaf block that make up a +

This section describes the different kinds of leaf block that make up a Markdown document.

-

+

Thematic breaks

-

A line consisting of 0-3 spaces of indentation, followed by a sequence +

A line consisting of 0-3 spaces of indentation, followed by a sequence of three or more matching -, _, or * characters, each followed optionally by any number of spaces or tabs, forms a thematic break.

-
***
+
***
 ---
 ___
 .
@@ -242,22 +239,22 @@ optionally by any number of spaces or tabs, forms a
 <hr />
-

Wrong characters:

+

Wrong characters:

-
+++
+
+++
 .
 <p>+++</p>
-
===
+
===
 .
 <p>===</p>
-

Not enough characters:

+

Not enough characters:

-
--
+
--
 **
 __
 .
@@ -266,9 +263,9 @@ optionally by any number of spaces or tabs, forms a
 __</p>
-

One to three spaces indent are allowed:

+

One to three spaces indent are allowed:

-
 ***
+
 ***
   ***
    ***
 .
@@ -277,58 +274,58 @@ optionally by any number of spaces or tabs, forms a
 <hr />
-

Four spaces is too many:

+

Four spaces is too many:

-
    ***
+
    ***
 .
 <pre><code>***
 </code></pre>
-
Foo
+
Foo
     ***
 .
 <p>Foo
 ***</p>
-

More than three characters may be used:

+

More than three characters may be used:

-
_____________________________________
+
_____________________________________
 .
 <hr />
-

Spaces are allowed between the characters:

+

Spaces are allowed between the characters:

-
 - - -
+
 - - -
 .
 <hr />
-
 **  * ** * ** * **
+
 **  * ** * ** * **
 .
 <hr />
-
-     -      -      -
+
-     -      -      -
 .
 <hr />
-

Spaces are allowed at the end:

+

Spaces are allowed at the end:

-
- - - -    
+
- - - -    
 .
 <hr />
-

However, no other characters may occur in the line:

+

However, no other characters may occur in the line:

-
_ _ _ _ a
+
_ _ _ _ a
 
 a------
 
@@ -339,17 +336,17 @@ optionally by any number of spaces or tabs, forms a
 <p>---a---</p>
-

It is required that all of the [non-whitespace characters] be the same. +

It is required that all of the [non-whitespace characters] be the same. So, this is not a thematic break:

-
 *-*
+
 *-*
 .
 <p><em>-</em></p>
-

Thematic breaks do not need blank lines before or after:

+

Thematic breaks do not need blank lines before or after:

-
- foo
+
- foo
 ***
 - bar
 .
@@ -362,9 +359,9 @@ So, this is not a thematic break:

</ul>
-

Thematic breaks can interrupt a paragraph:

+

Thematic breaks can interrupt a paragraph:

-
Foo
+
Foo
 ***
 bar
 .
@@ -373,13 +370,13 @@ So, this is not a thematic break:

<p>bar</p>
-

If a line of dashes that meets the above conditions for being a +

If a line of dashes that meets the above conditions for being a thematic break could also be interpreted as the underline of a [setext heading], the interpretation as a [setext heading] takes precedence. Thus, for example, this is a setext heading, not a paragraph followed by a thematic break:

-
Foo
+
Foo
 ---
 bar
 .
@@ -387,10 +384,10 @@ this is a setext heading, not a paragraph followed by a thematic break:

<p>bar</p>
-

When both a thematic break and a list item are possible +

When both a thematic break and a list item are possible interpretations of a line, the thematic break takes precedence:

-
* Foo
+
* Foo
 * * *
 * Bar
 .
@@ -403,9 +400,9 @@ interpretations of a line, the thematic break takes precedence:

</ul>
-

If you want a thematic break in a list item, use a different bullet:

+

If you want a thematic break in a list item, use a different bullet:

-
- Foo
+
- Foo
 - * * *
 .
 <ul>
@@ -416,9 +413,9 @@ interpretations of a line, the thematic break takes precedence:

</ul>
-

+

ATX headings

-

An ATX heading +

An ATX heading consists of a string of characters, parsed as inline content, between an opening sequence of 1--6 unescaped # characters and an optional closing sequence of any number of unescaped # characters. @@ -429,9 +426,9 @@ preceded by a [space] and may be followed by spaces only. The opening heading are stripped of leading and trailing spaces before being parsed as inline content. The heading level is equal to the number of # characters in the opening sequence.

-

Simple headings:

+

Simple headings:

-
# foo
+
# foo
 ## foo
 ### foo
 #### foo
@@ -446,14 +443,14 @@ characters in the opening sequence.

<h6>foo</h6>
-

More than six # characters is not a heading:

+

More than six # characters is not a heading:

-
####### foo
+
####### foo
 .
 <p>####### foo</p>
-

At least one space is required between the # characters and the +

At least one space is required between the # characters and the heading's contents, unless the heading is empty. Note that many implementations currently do not require the space. However, the space was required by the @@ -461,7 +458,7 @@ space was required by the and it helps prevent things like the following from being parsed as headings:

-
#5 bolt
+
#5 bolt
 
 #hashtag
 .
@@ -469,30 +466,30 @@ headings:

<p>#hashtag</p>
-

This is not a heading, because the first # is escaped:

+

This is not a heading, because the first # is escaped:

-
\## foo
+
\## foo
 .
 <p>## foo</p>
-

Contents are parsed as inlines:

+

Contents are parsed as inlines:

-
# foo *bar* \*baz\*
+
# foo *bar* \*baz\*
 .
 <h1>foo <em>bar</em> *baz*</h1>
-

Leading and trailing [whitespace] is ignored in parsing inline content:

+

Leading and trailing [whitespace] is ignored in parsing inline content:

-
#                  foo                     
+
#                  foo                     
 .
 <h1>foo</h1>
-

One to three spaces indentation are allowed:

+

One to three spaces indentation are allowed:

-
 ### foo
+
 ### foo
   ## foo
    # foo
 .
@@ -501,67 +498,67 @@ headings:

<h1>foo</h1>
-

Four spaces are too much:

+

Four spaces are too much:

-
    # foo
+
    # foo
 .
 <pre><code># foo
 </code></pre>
-
foo
+
foo
     # bar
 .
 <p>foo
 # bar</p>
-

A closing sequence of # characters is optional:

+

A closing sequence of # characters is optional:

-
## foo ##
+
## foo ##
   ###   bar    ###
 .
 <h2>foo</h2>
 <h3>bar</h3>
-

It need not be the same length as the opening sequence:

+

It need not be the same length as the opening sequence:

-
# foo ##################################
+
# foo ##################################
 ##### foo ##
 .
 <h1>foo</h1>
 <h5>foo</h5>
-

Spaces are allowed after the closing sequence:

+

Spaces are allowed after the closing sequence:

-
### foo ###     
+
### foo ###     
 .
 <h3>foo</h3>
-

A sequence of # characters with anything but [spaces] following it +

A sequence of # characters with anything but [spaces] following it is not a closing sequence, but counts as part of the contents of the heading:

-
### foo ### b
+
### foo ### b
 .
 <h3>foo ### b</h3>
-

The closing sequence must be preceded by a space:

+

The closing sequence must be preceded by a space:

-
# foo#
+
# foo#
 .
 <h1>foo#</h1>
-

Backslash-escaped # characters do not count as part +

Backslash-escaped # characters do not count as part of the closing sequence:

-
### foo \###
+
### foo \###
 ## foo #\##
 # foo \#
 .
@@ -570,10 +567,10 @@ of the closing sequence:

<h1>foo #</h1>
-

ATX headings need not be separated from surrounding content by blank +

ATX headings need not be separated from surrounding content by blank lines, and they can interrupt paragraphs:

-
****
+
****
 ## foo
 ****
 .
@@ -583,7 +580,7 @@ lines, and they can interrupt paragraphs:

-
Foo bar
+
Foo bar
 # baz
 Bar foo
 .
@@ -592,9 +589,9 @@ lines, and they can interrupt paragraphs:

<p>Bar foo</p>
-

ATX headings can be empty:

+

ATX headings can be empty:

-
## 
+
## 
 #
 ### ###
 .
@@ -603,9 +600,9 @@ lines, and they can interrupt paragraphs:

<h3></h3>
-

+

Setext headings

-

A setext heading consists of one or more +

A setext heading consists of one or more lines of text, each containing at least one [non-whitespace character], with no more than 3 spaces indentation, followed by a [setext heading underline]. The lines of text must be such @@ -614,24 +611,24 @@ they would be interpreted as a paragraph: they cannot be interpretable as a [code fence], [ATX heading][ATX headings], [block quote][block quotes], [thematic break][thematic breaks], [list item][list items], or [HTML block][HTML blocks].

-

A setext heading underline is a sequence of +

A setext heading underline is a sequence of = characters or a sequence of - characters, with no more than 3 spaces indentation and any number of trailing spaces. If a line containing a single - can be interpreted as an empty [list items], it should be interpreted this way and not as a [setext heading underline].

-

The heading is a level 1 heading if = characters are used in +

The heading is a level 1 heading if = characters are used in the [setext heading underline], and a level 2 heading if - characters are used. The contents of the heading are the result of parsing the preceding lines of text as CommonMark inline content.

-

In general, a setext heading need not be preceded or followed by a +

In general, a setext heading need not be preceded or followed by a blank line. However, it cannot interrupt a paragraph, so when a setext heading comes after a paragraph, a blank line is needed between them.

-

Simple examples:

+

Simple examples:

-
Foo *bar*
+
Foo *bar*
 =========
 
 Foo *bar*
@@ -641,9 +638,9 @@ them.

<h2>Foo <em>bar</em></h2>
-

The content of the header may span more than one line:

+

The content of the header may span more than one line:

-
Foo *bar
+
Foo *bar
 baz*
 ====
 .
@@ -651,12 +648,12 @@ them.

baz</em></h1>
-

The contents are the result of parsing the headings's raw +

The contents are the result of parsing the headings's raw content as inlines. The heading's raw content is formed by concatenating the lines and removing initial and final [whitespace].

-
  Foo *bar
+
  Foo *bar
 baz*→
 ====
 .
@@ -664,9 +661,9 @@ concatenating the lines and removing initial and final
 baz</em></h1>
-

The underlining can be any length:

+

The underlining can be any length:

-
Foo
+
Foo
 -------------------------
 
 Foo
@@ -676,10 +673,10 @@ concatenating the lines and removing initial and final
 <h1>Foo</h1>
-

The heading content can be indented up to three spaces, and need +

The heading content can be indented up to three spaces, and need not line up with the underlining:

-
   Foo
+
   Foo
 ---
 
   Foo
@@ -693,9 +690,9 @@ not line up with the underlining:

<h1>Foo</h1>
-

Four spaces indent is too much:

+

Four spaces indent is too much:

-
    Foo
+
    Foo
     ---
 
     Foo
@@ -709,27 +706,27 @@ not line up with the underlining:

<hr />
-

The setext heading underline can be indented up to three spaces, and +

The setext heading underline can be indented up to three spaces, and may have trailing spaces:

-
Foo
+
Foo
    ----      
 .
 <h2>Foo</h2>
-

Four spaces is too much:

+

Four spaces is too much:

-
Foo
+
Foo
     ---
 .
 <p>Foo
 ---</p>
-

The setext heading underline cannot contain internal spaces:

+

The setext heading underline cannot contain internal spaces:

-
Foo
+
Foo
 = =
 
 Foo
@@ -741,26 +738,26 @@ may have trailing spaces:

<hr />
-

Trailing spaces in the content line do not cause a line break:

+

Trailing spaces in the content line do not cause a line break:

-
Foo  
+
Foo  
 -----
 .
 <h2>Foo</h2>
-

Nor does a backslash at the end:

+

Nor does a backslash at the end:

-
Foo\
+
Foo\
 ----
 .
 <h2>Foo\</h2>
-

Since indicators of block structure take precedence over +

Since indicators of block structure take precedence over indicators of inline structure, the following are setext headings:

-
`Foo
+
`Foo
 ----
 `
 
@@ -774,10 +771,10 @@ indicators of inline structure, the following are setext headings:

<p>of dashes&quot;/&gt;</p>
-

The setext heading underline cannot be a [lazy continuation +

The setext heading underline cannot be a [lazy continuation line] in a list item or block quote:

-
> Foo
+
> Foo
 ---
 .
 <blockquote>
@@ -787,7 +784,7 @@ line] in a list item or block quote:

-
> foo
+
> foo
 bar
 ===
 .
@@ -799,7 +796,7 @@ line] in a list item or block quote:

-
- Foo
+
- Foo
 ---
 .
 <ul>
@@ -808,11 +805,11 @@ line] in a list item or block quote:

<hr />
-

A blank line is needed between a paragraph and a following +

A blank line is needed between a paragraph and a following setext heading, since otherwise the paragraph becomes part of the heading's content:

-
Foo
+
Foo
 Bar
 ---
 .
@@ -820,10 +817,10 @@ of the heading's content:

Bar</h2>
-

But in general a blank line is not required before or after +

But in general a blank line is not required before or after setext headings:

-
---
+
---
 Foo
 ---
 Bar
@@ -836,19 +833,19 @@ setext headings:

<p>Baz</p>
-

Setext headings cannot be empty:

+

Setext headings cannot be empty:

-

+

 ====
 .
 <p>====</p>
-

Setext heading text lines must not be interpretable as block +

Setext heading text lines must not be interpretable as block constructs other than paragraphs. So, the line of dashes in these examples gets interpreted as a thematic break:

-
---
+
---
 ---
 .
 <hr />
@@ -856,7 +853,7 @@ in these examples gets interpreted as a thematic break:

-
- foo
+
- foo
 -----
 .
 <ul>
@@ -866,7 +863,7 @@ in these examples gets interpreted as a thematic break:

-
    foo
+
    foo
 ---
 .
 <pre><code>foo
@@ -875,7 +872,7 @@ in these examples gets interpreted as a thematic break:

-
> foo
+
> foo
 -----
 .
 <blockquote>
@@ -884,38 +881,38 @@ in these examples gets interpreted as a thematic break:

<hr />
-

If you want a heading with > foo as its literal text, you can +

If you want a heading with > foo as its literal text, you can use backslash escapes:

-
\> foo
+
\> foo
 ------
 .
 <h2>&gt; foo</h2>
-

Compatibility note: Most existing Markdown implementations +

Compatibility note: Most existing Markdown implementations do not allow the text of setext headings to span multiple lines. But there is no consensus about how to interpret

-
Foo
+
Foo
 bar
 ---
 baz
-

One can find four different interpretations:

-
    -
  1. paragraph "Foo", heading "bar", paragraph "baz"
  2. -
  3. paragraph "Foo bar", thematic break, paragraph "baz"
  4. -
  5. paragraph "Foo bar --- baz"
  6. -
  7. heading "Foo bar", paragraph "baz"
  8. +

    One can find four different interpretations:

    +
      +
    1. paragraph "Foo", heading "bar", paragraph "baz"
    2. +
    3. paragraph "Foo bar", thematic break, paragraph "baz"
    4. +
    5. paragraph "Foo bar --- baz"
    6. +
    7. heading "Foo bar", paragraph "baz"
    -

    We find interpretation 4 most natural, and interpretation 4 +

    We find interpretation 4 most natural, and interpretation 4 increases the expressive power of CommonMark, by allowing multiline headings. Authors who want interpretation 1 can put a blank line after the first paragraph:

    -
    Foo
    +
    Foo
     
     bar
     ---
    @@ -926,10 +923,10 @@ put a blank line after the first paragraph:

    <p>baz</p>
    -

    Authors who want interpretation 2 can put blank lines around +

    Authors who want interpretation 2 can put blank lines around the thematic break,

    -
    Foo
    +
    Foo
     bar
     
     ---
    @@ -942,10 +939,10 @@ the thematic break,

    <p>baz</p>
    -

    or use a thematic break that cannot count as a [setext heading +

    or use a thematic break that cannot count as a [setext heading underline], such as

    -
    Foo
    +
    Foo
     bar
     * * *
     baz
    @@ -956,9 +953,9 @@ underline], such as

    <p>baz</p>
    -

    Authors who want interpretation 3 can use backslash escapes:

    +

    Authors who want interpretation 3 can use backslash escapes:

    -
    Foo
    +
    Foo
     bar
     \---
     baz
    @@ -969,21 +966,21 @@ underline], such as

    baz</p>
    -

    +

    Indented code blocks

    -

    An indented code block is composed of one or more +

    An indented code block is composed of one or more [indented chunks] separated by blank lines. An indented chunk is a sequence of non-blank lines, each indented four or more spaces. The contents of the code block are the literal contents of the lines, including trailing [line endings], minus four spaces of indentation. An indented code block has no [info string].

    -

    An indented code block cannot interrupt a paragraph, so there must be +

    An indented code block cannot interrupt a paragraph, so there must be a blank line between a paragraph and a following indented code block. (A blank line is not needed, however, between a code block and a following paragraph.)

    -
        a simple
    +
        a simple
           indented code block
     .
     <pre><code>a simple
    @@ -991,11 +988,11 @@ paragraph.)

    </code></pre>
    -

    If there is any ambiguity between an interpretation of indentation +

    If there is any ambiguity between an interpretation of indentation as a code block and as indicating that material belongs to a [list item][list items], the list item interpretation takes precedence:

    -
      - foo
    +
      - foo
     
         bar
     .
    @@ -1008,7 +1005,7 @@ item][list items], the list item interpretation takes precedence:

    -
    1.  foo
    +
    1.  foo
     
         - bar
     .
    @@ -1022,10 +1019,10 @@ item][list items], the list item interpretation takes precedence:

    </ol>
    -

    The contents of a code block are literal text, and do not get parsed +

    The contents of a code block are literal text, and do not get parsed as Markdown:

    -
        <a/>
    +
        <a/>
         *hi*
     
         - one
    @@ -1037,9 +1034,9 @@ as Markdown:

    </code></pre>
    -

    Here we have three chunks separated by blank lines:

    +

    Here we have three chunks separated by blank lines:

    -
        chunk1
    +
        chunk1
     
         chunk2
       
    @@ -1057,10 +1054,10 @@ as Markdown:

    </code></pre>
    -

    Any initial spaces beyond four will be included in the content, even +

    Any initial spaces beyond four will be included in the content, even in interior blank lines:

    -
        chunk1
    +
        chunk1
           
           chunk2
     .
    @@ -1070,10 +1067,10 @@ in interior blank lines:

    </code></pre>
    -

    An indented code block cannot interrupt a paragraph. (This +

    An indented code block cannot interrupt a paragraph. (This allows hanging indents and the like.)

    -
    Foo
    +
    Foo
         bar
     
     .
    @@ -1081,11 +1078,11 @@ allows hanging indents and the like.)

    bar</p>
    -

    However, any non-blank line with fewer than four leading spaces ends +

    However, any non-blank line with fewer than four leading spaces ends the code block immediately. So a paragraph may occur immediately after indented code:

    -
        foo
    +
        foo
     bar
     .
     <pre><code>foo
    @@ -1093,10 +1090,10 @@ after indented code:

    <p>bar</p>
    -

    And indented code can occur immediately before and after other kinds of +

    And indented code can occur immediately before and after other kinds of blocks:

    -
    # Heading
    +
    # Heading
         foo
     Heading
     ------
    @@ -1112,9 +1109,9 @@ blocks:

    <hr />
    -

    The first line can be indented more than four spaces:

    +

    The first line can be indented more than four spaces:

    -
            foo
    +
            foo
         bar
     .
     <pre><code>    foo
    @@ -1122,10 +1119,10 @@ blocks:

    </code></pre>
    -

    Blank lines preceding or following an indented code block +

    Blank lines preceding or following an indented code block are not included in it:

    -
    
    +
    
         
         foo
         
    @@ -1135,29 +1132,29 @@ are not included in it:

    </code></pre>
    -

    Trailing spaces are included in the code block's content:

    +

    Trailing spaces are included in the code block's content:

    -
        foo  
    +
        foo  
     .
     <pre><code>foo  
     </code></pre>
    -

    +

    Fenced code blocks

    -

    A code fence is a sequence +

    A code fence is a sequence of at least three consecutive backtick characters (`) or tildes (~). (Tildes and backticks cannot be mixed.) A fenced code block begins with a code fence, indented no more than three spaces.

    -

    The line with the opening code fence may optionally contain some text +

    The line with the opening code fence may optionally contain some text following the code fence; this is trimmed of leading and trailing whitespace and called the info string. If the [info string] comes after a backtick fence, it may not contain any backtick characters. (The reason for this restriction is that otherwise some inline code would be incorrectly interpreted as the beginning of a fenced code block.)

    -

    The content of the code block consists of all subsequent lines, until +

    The content of the code block consists of all subsequent lines, until a closing [code fence] of the same type as the code block began with (backticks or tildes), and with at least as many backticks or tildes as the opening code fence. If the leading code fence is @@ -1165,7 +1162,7 @@ indented N spaces, then up to N spaces of indentation are removed from each line of the content (if present). (If a content line is not indented, it is preserved unchanged. If it is indented less than N spaces, all of the indentation is removed.)

    -

    The closing code fence may be indented up to three spaces, and may be +

    The closing code fence may be indented up to three spaces, and may be followed only by spaces, which are ignored. If the end of the containing block (or document) is reached and no closing code fence has been found, the code block contains all of the lines after the @@ -1174,16 +1171,16 @@ document). (An alternative spec would require backtracking in the event that a closing code fence is not found. But this makes parsing much less efficient, and there seems to be no real down side to the behavior described here.)

    -

    A fenced code block may interrupt a paragraph, and does not require +

    A fenced code block may interrupt a paragraph, and does not require a blank line either before or after.

    -

    The content of a code fence is treated as literal text, not parsed +

    The content of a code fence is treated as literal text, not parsed as inlines. The first word of the [info string] is typically used to specify the language of the code sample, and rendered in the class attribute of the code tag. However, this spec does not mandate any particular treatment of the [info string].

    -

    Here is a simple example with backticks:

    +

    Here is a simple example with backticks:

    -
    ```
    +
    ```
     <
      >
     ```
    @@ -1193,9 +1190,9 @@ particular treatment of the [info string].

    </code></pre>
    -

    With tildes:

    +

    With tildes:

    -
    ~~~
    +
    ~~~
     <
      >
     ~~~
    @@ -1205,19 +1202,19 @@ particular treatment of the [info string].

    </code></pre>
    -

    Fewer than three backticks is not enough:

    +

    Fewer than three backticks is not enough:

    -
    ``
    +
    ``
     foo
     ``
     .
     <p><code>foo</code></p>
    -

    The closing code fence must use the same character as the opening +

    The closing code fence must use the same character as the opening fence:

    -
    ```
    +
    ```
     aaa
     ~~~
     ```
    @@ -1228,7 +1225,7 @@ fence:

    -
    ~~~
    +
    ~~~
     aaa
     ```
     ~~~
    @@ -1238,9 +1235,9 @@ fence:

    </code></pre>
    -

    The closing code fence must be at least as long as the opening fence:

    +

    The closing code fence must be at least as long as the opening fence:

    -
    ````
    +
    ````
     aaa
     ```
     ``````
    @@ -1251,7 +1248,7 @@ fence:

    -
    ~~~~
    +
    ~~~~
     aaa
     ~~~
     ~~~~
    @@ -1261,16 +1258,16 @@ fence:

    </code></pre>
    -

    Unclosed code blocks are closed by the end of the document +

    Unclosed code blocks are closed by the end of the document (or the enclosing [block quote][block quotes] or [list item][list items]):

    -
    ```
    +
    ```
     .
     <pre><code></code></pre>
    -
    `````
    +
    `````
     
     ```
     aaa
    @@ -1282,7 +1279,7 @@ fence:

    -
    > ```
    +
    > ```
     > aaa
     
     bbb
    @@ -1294,9 +1291,9 @@ fence:

    <p>bbb</p>
    -

    A code block can have all empty lines as its content:

    +

    A code block can have all empty lines as its content:

    -
    ```
    +
    ```
     
       
     ```
    @@ -1306,19 +1303,19 @@ fence:

    </code></pre>
    -

    A code block can be empty:

    +

    A code block can be empty:

    -
    ```
    +
    ```
     ```
     .
     <pre><code></code></pre>
    -

    Fences can be indented. If the opening fence is indented, +

    Fences can be indented. If the opening fence is indented, content lines will have equivalent opening indentation removed, if present:

    -
     ```
    +
     ```
      aaa
     aaa
     ```
    @@ -1329,7 +1326,7 @@ if present:

    -
      ```
    +
      ```
     aaa
       aaa
     aaa
    @@ -1342,7 +1339,7 @@ if present:

    -
       ```
    +
       ```
        aaa
         aaa
       aaa
    @@ -1354,9 +1351,9 @@ if present:

    </code></pre>
    -

    Four spaces indentation produces an indented code block:

    +

    Four spaces indentation produces an indented code block:

    -
        ```
    +
        ```
         aaa
         ```
     .
    @@ -1366,10 +1363,10 @@ if present:

    </code></pre>
    -

    Closing fences may be indented by 0-3 spaces, and their indentation +

    Closing fences may be indented by 0-3 spaces, and their indentation need not match that of the opening fence:

    -
    ```
    +
    ```
     aaa
       ```
     .
    @@ -1378,7 +1375,7 @@ need not match that of the opening fence:

    -
       ```
    +
       ```
     aaa
       ```
     .
    @@ -1386,9 +1383,9 @@ need not match that of the opening fence:

    </code></pre>
    -

    This is not a closing fence, because it is indented 4 spaces:

    +

    This is not a closing fence, because it is indented 4 spaces:

    -
    ```
    +
    ```
     aaa
         ```
     .
    @@ -1397,9 +1394,9 @@ need not match that of the opening fence:

    </code></pre>
    -

    Code fences (opening and closing) cannot contain internal spaces:

    +

    Code fences (opening and closing) cannot contain internal spaces:

    -
    ``` ```
    +
    ``` ```
     aaa
     .
     <p><code> </code>
    @@ -1407,7 +1404,7 @@ need not match that of the opening fence:

    -
    ~~~~~~
    +
    ~~~~~~
     aaa
     ~~~ ~~
     .
    @@ -1416,10 +1413,10 @@ need not match that of the opening fence:

    </code></pre>
    -

    Fenced code blocks can interrupt paragraphs, and can be followed +

    Fenced code blocks can interrupt paragraphs, and can be followed directly by paragraphs, without a blank line between:

    -
    foo
    +
    foo
     ```
     bar
     ```
    @@ -1431,10 +1428,10 @@ directly by paragraphs, without a blank line between:

    <p>baz</p>
    -

    Other blocks can also occur before and after fenced code blocks +

    Other blocks can also occur before and after fenced code blocks without an intervening blank line:

    -
    foo
    +
    foo
     ---
     ~~~
     bar
    @@ -1447,14 +1444,14 @@ without an intervening blank line:

    <h1>baz</h1>
    -

    An [info string] can be provided after the opening code fence. +

    An [info string] can be provided after the opening code fence. Although this spec doesn't mandate any particular treatment of the info string, the first word is typically used to specify the language of the code block. In HTML output, the language is normally indicated by adding a class to the code element consisting of language- followed by the language name.

    -
    ```ruby
    +
    ```ruby
     def foo(x)
       return 3
     end
    @@ -1467,7 +1464,7 @@ of language- followed by the language name.

    -
    ~~~~    ruby startline=3 $%@#$
    +
    ~~~~    ruby startline=3 $%@#$
     def foo(x)
       return 3
     end
    @@ -1480,24 +1477,24 @@ of language- followed by the language name.

    -
    ````;
    +
    ````;
     ````
     .
     <pre><code class="language-;"></code></pre>
    -

    [Info strings] for backtick code blocks cannot contain backticks:

    +

    [Info strings] for backtick code blocks cannot contain backticks:

    -
    ``` aa ```
    +
    ``` aa ```
     foo
     .
     <p><code>aa</code>
     foo</p>
    -

    [Info strings] for tilde code blocks can contain backticks and tildes:

    +

    [Info strings] for tilde code blocks can contain backticks and tildes:

    -
    ~~~ aa ``` ~~~
    +
    ~~~ aa ``` ~~~
     foo
     ~~~
     .
    @@ -1505,9 +1502,9 @@ of language- followed by the language name.

    </code></pre>
    -

    Closing code fences cannot have [info strings]:

    +

    Closing code fences cannot have [info strings]:

    -
    ```
    +
    ```
     ``` aaa
     ```
     .
    @@ -1515,11 +1512,11 @@ of language- followed by the language name.

    </code></pre>
    -

    +

    HTML blocks

    -

    An HTML block is a group of lines that is treated +

    An HTML block is a group of lines that is treated as raw HTML (and will not be escaped in HTML output).

    -

    There are seven kinds of [HTML block], which can be defined by their +

    There are seven kinds of [HTML block], which can be defined by their start and end conditions. The block begins with a line that meets a start condition (after up to three spaces optional indentation). It ends with the first subsequent line that meets a matching end @@ -1528,35 +1525,35 @@ the container block containing the current HTML block, if no line is encountered that meets the [end condition]. If the first line meets both the [start condition] and the [end condition], the block will contain just that line.

    -
      -
    1. -

      Start condition: line begins with the string <script, +

        +
      1. +

        Start condition: line begins with the string <script, <pre, or <style (case-insensitive), followed by whitespace, the string >, or the end of the line.
        End condition: line contains an end tag </script>, </pre>, or </style> (case-insensitive; it need not match the start tag).

      2. -
      3. -

        Start condition: line begins with the string <!--.
        +

      4. +

        Start condition: line begins with the string <!--.
        End condition: line contains the string -->.

      5. -
      6. -

        Start condition: line begins with the string <?.
        +

      7. +

        Start condition: line begins with the string <?.
        End condition: line contains the string ?>.

      8. -
      9. -

        Start condition: line begins with the string <! +

      10. +

        Start condition: line begins with the string <! followed by an uppercase ASCII letter.
        End condition: line contains the character >.

      11. -
      12. -

        Start condition: line begins with the string +

      13. +

        Start condition: line begins with the string <![CDATA[.
        End condition: line contains the string ]]>.

      14. -
      15. -

        Start condition: line begins the string < or </ +

      16. +

        Start condition: line begins the string < or </ followed by one of the strings (case-insensitive) address, article, aside, base, basefont, blockquote, body, caption, center, col, colgroup, dd, details, dialog, @@ -1571,25 +1568,25 @@ by [whitespace], the end of the line, the string >, or the string />.
        End condition: line is followed by a [blank line].

      17. -
      18. -

        Start condition: line begins with a complete [open tag] +

      19. +

        Start condition: line begins with a complete [open tag] (with any [tag name] other than script, style, or pre) or a complete [closing tag], followed only by [whitespace] or the end of the line.
        End condition: line is followed by a [blank line].

      -

      HTML blocks continue until they are closed by their appropriate +

      HTML blocks continue until they are closed by their appropriate [end condition], or the last line of the document or other container block. This means any HTML within an HTML block that might otherwise be recognised as a start condition will be ignored by the parser and passed through as-is, without changing the parser's state.

      -

      For instance, <pre> within a HTML block started by <table> will not affect +

      For instance, <pre> within a HTML block started by <table> will not affect the parser state; as the HTML block was started in by start condition 6, it will end at any blank line. This can be surprising:

      -
      <table><tr><td>
      +
      <table><tr><td>
       <pre>
       **Hello**,
       
      @@ -1605,17 +1602,17 @@ will end at any blank line. This can be surprising:

      </td></tr></table>
      -

      In this case, the HTML block is terminated by the newline — the **Hello** +

      In this case, the HTML block is terminated by the newline — the **Hello** text remains verbatim — and regular parsing resumes, with a paragraph, emphasised world and inline and block HTML following.

      -

      All types of [HTML blocks] except type 7 may interrupt +

      All types of [HTML blocks] except type 7 may interrupt a paragraph. Blocks of type 7 may not interrupt a paragraph. (This restriction is intended to prevent unwanted interpretation of long tags inside a wrapped paragraph as starting HTML blocks.)

      -

      Some simple examples follow. Here are some basic HTML blocks +

      Some simple examples follow. Here are some basic HTML blocks of type 6:

      -
      <table>
      +
      <table>
         <tr>
           <td>
                  hi
      @@ -1636,7 +1633,7 @@ of type 6:

      -
       <div>
      +
       <div>
         *hello*
                <foo><a>
       .
      @@ -1645,18 +1642,18 @@ of type 6:

      <foo><a>
      -

      A block can also start with a closing tag:

      +

      A block can also start with a closing tag:

      -
      </div>
      +
      </div>
       *foo*
       .
       </div>
       *foo*
      -

      Here we have two HTML blocks with a Markdown paragraph between them:

      +

      Here we have two HTML blocks with a Markdown paragraph between them:

      -
      <DIV CLASS="foo">
      +
      <DIV CLASS="foo">
       
       *Markdown*
       
      @@ -1667,10 +1664,10 @@ of type 6:

      </DIV>
      -

      The tag on the first line can be partial, as long +

      The tag on the first line can be partial, as long as it is split where there would be whitespace:

      -
      <div id="foo"
      +
      <div id="foo"
         class="bar">
       </div>
       .
      @@ -1680,7 +1677,7 @@ as it is split where there would be whitespace:

      -
      <div id="foo" class="bar
      +
      <div id="foo" class="bar
         baz">
       </div>
       .
      @@ -1689,9 +1686,9 @@ as it is split where there would be whitespace:

      </div>
      -

      An open tag need not be closed:

      +

      An open tag need not be closed:

      -
      <div>
      +
      <div>
       *foo*
       
       *bar*
      @@ -1701,10 +1698,10 @@ as it is split where there would be whitespace:

      <p><em>bar</em></p>
      -

      A partial tag need not even be completed (garbage +

      A partial tag need not even be completed (garbage in, garbage out):

      -
      <div id="foo"
      +
      <div id="foo"
       *hi*
       .
       <div id="foo"
      @@ -1712,33 +1709,33 @@ in, garbage out):

      -
      <div class
      +
      <div class
       foo
       .
       <div class
       foo
      -

      The initial tag doesn't even need to be a valid +

      The initial tag doesn't even need to be a valid tag, as long as it starts like one:

      -
      <div *???-&&&-<---
      +
      <div *???-&&&-<---
       *foo*
       .
       <div *???-&&&-<---
       *foo*
      -

      In type 6 blocks, the initial tag need not be on a line by +

      In type 6 blocks, the initial tag need not be on a line by itself:

      -
      <div><a href="bar">*foo*</a></div>
      +
      <div><a href="bar">*foo*</a></div>
       .
       <div><a href="bar">*foo*</a></div>
      -
      <table><tr><td>
      +
      <table><tr><td>
       foo
       </td></tr></table>
       .
      @@ -1747,13 +1744,13 @@ itself:

      </td></tr></table>
      -

      Everything until the next blank line or end of document +

      Everything until the next blank line or end of document gets included in the HTML block. So, in the following example, what looks like a Markdown code block is actually part of the HTML block, which continues until a blank line or the end of the document is reached:

      -
      <div></div>
      +
      <div></div>
       ``` c
       int x = 33;
       ```
      @@ -1764,11 +1761,11 @@ line or the end of the document is reached:

      ```
      -

      To start an [HTML block] with a tag that is not in the +

      To start an [HTML block] with a tag that is not in the list of block-level tags in (6), you must put the tag by itself on the first line (and it must be complete):

      -
      <a href="foo">
      +
      <a href="foo">
       *bar*
       </a>
       .
      @@ -1777,9 +1774,9 @@ itself on the first line (and it must be complete):

      </a>
      -

      In type 7 blocks, the [tag name] can be anything:

      +

      In type 7 blocks, the [tag name] can be anything:

      -
      <Warning>
      +
      <Warning>
       *bar*
       </Warning>
       .
      @@ -1789,7 +1786,7 @@ itself on the first line (and it must be complete):

      -
      <i class="foo">
      +
      <i class="foo">
       *bar*
       </i>
       .
      @@ -1799,20 +1796,20 @@ itself on the first line (and it must be complete):

      -
      </ins>
      +
      </ins>
       *bar*
       .
       </ins>
       *bar*
      -

      These rules are designed to allow us to work with tags that +

      These rules are designed to allow us to work with tags that can function as either block-level or inline-level tags. The <del> tag is a nice example. We can surround content with <del> tags in three different ways. In this case, we get a raw HTML block, because the <del> tag is on a line by itself:

      -
      <del>
      +
      <del>
       *foo*
       </del>
       .
      @@ -1821,11 +1818,11 @@ HTML block, because the <del> tag is on a line by itself:

      </del>
      -

      In this case, we get a raw HTML block that just includes +

      In this case, we get a raw HTML block that just includes the <del> tag (because it ends with the following blank line). So the contents get interpreted as CommonMark:

      -
      <del>
      +
      <del>
       
       *foo*
       
      @@ -1836,25 +1833,25 @@ line).  So the contents get interpreted as CommonMark:

      </del>
      -

      Finally, in this case, the <del> tags are interpreted +

      Finally, in this case, the <del> tags are interpreted as [raw HTML] inside the CommonMark paragraph. (Because the tag is not on a line by itself, we get inline HTML rather than an [HTML block].)

      -
      <del>*foo*</del>
      +
      <del>*foo*</del>
       .
       <p><del><em>foo</em></del></p>
      -

      HTML tags designed to contain literal content +

      HTML tags designed to contain literal content (script, style, pre), comments, processing instructions, and declarations are treated somewhat differently. Instead of ending at the first blank line, these blocks end at the first line containing a corresponding end tag. As a result, these blocks can contain blank lines:

      -

      A pre tag (type 1):

      +

      A pre tag (type 1):

      -
      <pre language="haskell"><code>
      +
      <pre language="haskell"><code>
       import Text.HTML.TagSoup
       
       main :: IO ()
      @@ -1871,9 +1868,9 @@ As a result, these blocks can contain blank lines:

      <p>okay</p>
      -

      A script tag (type 1):

      +

      A script tag (type 1):

      -
      <script type="text/javascript">
      +
      <script type="text/javascript">
       // JavaScript example
       
       document.getElementById("demo").innerHTML = "Hello JavaScript!";
      @@ -1888,9 +1885,9 @@ As a result, these blocks can contain blank lines:

      <p>okay</p>
      -

      A style tag (type 1):

      +

      A style tag (type 1):

      -
      <style
      +
      <style
         type="text/css">
       h1 {color:red;}
       
      @@ -1907,11 +1904,11 @@ As a result, these blocks can contain blank lines:

      <p>okay</p>
      -

      If there is no matching end tag, the block will end at the +

      If there is no matching end tag, the block will end at the end of the document (or the enclosing [block quote][block quotes] or [list item][list items]):

      -
      <style
      +
      <style
         type="text/css">
       
       foo
      @@ -1923,7 +1920,7 @@ or [list item][list items]):

      -
      > <div>
      +
      > <div>
       > foo
       
       bar
      @@ -1936,7 +1933,7 @@ or [list item][list items]):

      -
      - <div>
      +
      - <div>
       - foo
       .
       <ul>
      @@ -1947,9 +1944,9 @@ or [list item][list items]):

      </ul>
      -

      The end tag can occur on the same line as the start tag:

      +

      The end tag can occur on the same line as the start tag:

      -
      <style>p{color:red;}</style>
      +
      <style>p{color:red;}</style>
       *foo*
       .
       <style>p{color:red;}</style>
      @@ -1957,17 +1954,17 @@ or [list item][list items]):

      -
      <!-- foo -->*bar*
      +
      <!-- foo -->*bar*
       *baz*
       .
       <!-- foo -->*bar*
       <p><em>baz</em></p>
      -

      Note that anything on the last line after the +

      Note that anything on the last line after the end tag will be included in the [HTML block]:

      -
      <script>
      +
      <script>
       foo
       </script>1. *bar*
       .
      @@ -1976,9 +1973,9 @@ end tag will be included in the [HTML block]:

      </script>1. *bar*
      -

      A comment (type 2):

      +

      A comment (type 2):

      -
      <!-- Foo
      +
      <!-- Foo
       
       bar
          baz -->
      @@ -1991,9 +1988,9 @@ end tag will be included in the [HTML block]:

      <p>okay</p>
      -

      A processing instruction (type 3):

      +

      A processing instruction (type 3):

      -
      <?php
      +
      <?php
       
         echo '>';
       
      @@ -2008,16 +2005,16 @@ end tag will be included in the [HTML block]:

      <p>okay</p>
      -

      A declaration (type 4):

      +

      A declaration (type 4):

      -
      <!DOCTYPE html>
      +
      <!DOCTYPE html>
       .
       <!DOCTYPE html>
      -

      CDATA (type 5):

      +

      CDATA (type 5):

      -
      <![CDATA[
      +
      <![CDATA[
       function matchwo(a,b)
       {
         if (a < b && a < 0) then {
      @@ -2046,9 +2043,9 @@ end tag will be included in the [HTML block]:

      <p>okay</p>
      -

      The opening tag can be indented 1-3 spaces, but not 4:

      +

      The opening tag can be indented 1-3 spaces, but not 4:

      -
        <!-- foo -->
      +
        <!-- foo -->
       
           <!-- foo -->
       .
      @@ -2058,7 +2055,7 @@ end tag will be included in the [HTML block]:

      -
        <div>
      +
        <div>
       
           <div>
       .
      @@ -2067,10 +2064,10 @@ end tag will be included in the [HTML block]:

      </code></pre>
      -

      An HTML block of types 1--6 can interrupt a paragraph, and need not be +

      An HTML block of types 1--6 can interrupt a paragraph, and need not be preceded by a blank line.

      -
      Foo
      +
      Foo
       <div>
       bar
       </div>
      @@ -2081,11 +2078,11 @@ preceded by a blank line.

      </div>
      -

      However, a following blank line is needed, except at the end of +

      However, a following blank line is needed, except at the end of a document, and except for blocks of types 1--5, [above][HTML block]:

      -
      <div>
      +
      <div>
       bar
       </div>
       *foo*
      @@ -2096,9 +2093,9 @@ block]:

      *foo*
      -

      HTML blocks of type 7 cannot interrupt a paragraph:

      +

      HTML blocks of type 7 cannot interrupt a paragraph:

      -
      Foo
      +
      Foo
       <a href="bar">
       baz
       .
      @@ -2107,25 +2104,25 @@ block]:

      baz</p>
      -

      This rule differs from John Gruber's original Markdown syntax +

      This rule differs from John Gruber's original Markdown syntax specification, which says:

      -
      -

      The only restrictions are that block-level HTML elements — +

      +

      The only restrictions are that block-level HTML elements — e.g. <div>, <table>, <pre>, <p>, etc. — must be separated from surrounding content by blank lines, and the start and end tags of the block should not be indented with tabs or spaces.

      -

      In some ways Gruber's rule is more restrictive than the one given +

      In some ways Gruber's rule is more restrictive than the one given here:

      -
        -
      • It requires that an HTML block be preceded by a blank line.
      • -
      • It does not allow the start tag to be indented.
      • -
      • It requires a matching end tag, which it also does not allow to +
          +
        • It requires that an HTML block be preceded by a blank line.
        • +
        • It does not allow the start tag to be indented.
        • +
        • It requires a matching end tag, which it also does not allow to be indented.
        -

        Most Markdown implementations (including some of Gruber's own) do not +

        Most Markdown implementations (including some of Gruber's own) do not respect all of these restrictions.

        -

        There is one respect, however, in which Gruber's rule is more liberal +

        There is one respect, however, in which Gruber's rule is more liberal than the one given here, since it allows blank lines to occur inside an HTML block. There are two reasons for disallowing them here. First, it removes the need to parse balanced tags, which is @@ -2133,9 +2130,9 @@ expensive and can require backtracking from the end of the document if no matching end tag is found. Second, it provides a very simple and flexible way of including Markdown content inside HTML tags: simply separate the Markdown from the HTML using blank lines:

        -

        Compare:

        +

        Compare:

        -
        <div>
        +
        <div>
         
         *Emphasized* text.
         
        @@ -2147,7 +2144,7 @@ simply separate the Markdown from the HTML using blank lines:

        -
        <div>
        +
        <div>
         *Emphasized* text.
         </div>
         .
        @@ -2156,17 +2153,17 @@ simply separate the Markdown from the HTML using blank lines:

        </div>
        -

        Some Markdown implementations have adopted a convention of +

        Some Markdown implementations have adopted a convention of interpreting content inside tags as text if the open tag has the attribute markdown=1. The rule given above seems a simpler and more elegant way of achieving the same expressive power, which is also much simpler to parse.

        -

        The main potential drawback is that one can no longer paste HTML +

        The main potential drawback is that one can no longer paste HTML blocks into Markdown documents with 100% reliability. However, in most cases this will work fine, because the blank lines in HTML are usually followed by HTML block tags. For example:

        -
        <table>
        +
        <table>
         
         <tr>
         
        @@ -2187,11 +2184,11 @@ HTML are usually followed by HTML block tags.  For example:

        </table>
        -

        There are problems, however, if the inner tags are indented +

        There are problems, however, if the inner tags are indented and separated by spaces, as then they will be interpreted as an indented code block:

        -
        <table>
        +
        <table>
         
           <tr>
         
        @@ -2213,13 +2210,13 @@ an indented code block:

        </table>
        -

        Fortunately, blank lines are usually not necessary and can be +

        Fortunately, blank lines are usually not necessary and can be deleted. The exception is inside <pre> tags, but as described [above][HTML blocks], raw HTML blocks starting with <pre> can contain blank lines.

        -

        +

        Link reference definitions

        -

        A link reference definition +

        A link reference definition consists of a [link label], indented up to three spaces, followed by a colon (:), optional [whitespace] (including up to one [line ending]), a [link destination], @@ -2228,14 +2225,14 @@ optional [whitespace] (including up to one title], which if it is present must be separated from the [link destination] by [whitespace]. No further [non-whitespace characters] may occur on the line.

        -

        A [link reference definition] +

        A [link reference definition] does not correspond to a structural element of a document. Instead, it defines a label which can be used in [reference links] and reference-style [images] elsewhere in the document. [Link reference definitions] can come either before or after the links that use them.

        -
        [foo]: /url "title"
        +
        [foo]: /url "title"
         
         [foo]
         .
        @@ -2243,7 +2240,7 @@ them.

        -
           [foo]: 
        +
           [foo]: 
               /url  
                    'the title'  
         
        @@ -2253,7 +2250,7 @@ them.

        -
        [Foo*bar\]]:my_(url) 'title (with parens)'
        +
        [Foo*bar\]]:my_(url) 'title (with parens)'
         
         [Foo*bar\]]
         .
        @@ -2261,7 +2258,7 @@ them.

        -
        [Foo bar]:
        +
        [Foo bar]:
         <my url>
         'title'
         
        @@ -2270,9 +2267,9 @@ them.

        <p><a href="my%20url" title="title">Foo bar</a></p>
        -

        The title may extend over multiple lines:

        +

        The title may extend over multiple lines:

        -
        [foo]: /url '
        +
        [foo]: /url '
         title
         line1
         line2
        @@ -2287,9 +2284,9 @@ them.

        ">foo</a></p>
        -

        However, it may not contain a [blank line]:

        +

        However, it may not contain a [blank line]:

        -
        [foo]: /url 'title
        +
        [foo]: /url 'title
         
         with blank line'
         
        @@ -2300,9 +2297,9 @@ them.

        <p>[foo]</p>
        -

        The title may be omitted:

        +

        The title may be omitted:

        -
        [foo]:
        +
        [foo]:
         /url
         
         [foo]
        @@ -2310,9 +2307,9 @@ them.

        <p><a href="/url">foo</a></p>
        -

        The link destination may not be omitted:

        +

        The link destination may not be omitted:

        -
        [foo]:
        +
        [foo]:
         
         [foo]
         .
        @@ -2320,20 +2317,20 @@ them.

        <p>[foo]</p>
        -

        However, an empty link destination may be specified using +

        However, an empty link destination may be specified using angle brackets:

        -
        [foo]: <>
        +
        [foo]: <>
         
         [foo]
         .
         <p><a href="">foo</a></p>
        -

        The title must be separated from the link destination by +

        The title must be separated from the link destination by whitespace:

        -
        [foo]: <bar>(baz)
        +
        [foo]: <bar>(baz)
         
         [foo]
         .
        @@ -2341,29 +2338,29 @@ whitespace:

        <p>[foo]</p>
        -

        Both title and destination can contain backslash escapes +

        Both title and destination can contain backslash escapes and literal backslashes:

        -
        [foo]: /url\bar\*baz "foo\"bar\baz"
        +
        [foo]: /url\bar\*baz "foo\"bar\baz"
         
         [foo]
         .
         <p><a href="/url%5Cbar*baz" title="foo&quot;bar\baz">foo</a></p>
        -

        A link can come before its corresponding definition:

        +

        A link can come before its corresponding definition:

        -
        [foo]
        +
        [foo]
         
         [foo]: url
         .
         <p><a href="url">foo</a></p>
        -

        If there are several matching definitions, the first one takes +

        If there are several matching definitions, the first one takes precedence:

        -
        [foo]
        +
        [foo]
         
         [foo]: first
         [foo]: second
        @@ -2371,10 +2368,10 @@ precedence:

        <p><a href="first">foo</a></p>
        -

        As noted in the section on [Links], matching of labels is +

        As noted in the section on [Links], matching of labels is case-insensitive (see [matches]).

        -
        [FOO]: /url
        +
        [FOO]: /url
         
         [Foo]
         .
        @@ -2382,23 +2379,23 @@ case-insensitive (see [matches]).

        -
        [ΑΓΩ]: /φου
        +
        [ΑΓΩ]: /φου
         
         [αγω]
         .
         <p><a href="/%CF%86%CE%BF%CF%85">αγω</a></p>
        -

        Here is a link reference definition with no corresponding link. +

        Here is a link reference definition with no corresponding link. It contributes nothing to the document.

        -
        [foo]: /url
        +
        [foo]: /url
         .
        -

        Here is another one:

        +

        Here is another one:

        -
        [
        +
        [
         foo
         ]: /url
         bar
        @@ -2406,26 +2403,26 @@ It contributes nothing to the document.

        <p>bar</p>
        -

        This is not a link reference definition, because there are +

        This is not a link reference definition, because there are [non-whitespace characters] after the title:

        -
        [foo]: /url "title" ok
        +
        [foo]: /url "title" ok
         .
         <p>[foo]: /url &quot;title&quot; ok</p>
        -

        This is a link reference definition, but it has no title:

        +

        This is a link reference definition, but it has no title:

        -
        [foo]: /url
        +
        [foo]: /url
         "title" ok
         .
         <p>&quot;title&quot; ok</p>
        -

        This is not a link reference definition, because it is indented +

        This is not a link reference definition, because it is indented four spaces:

        -
            [foo]: /url "title"
        +
            [foo]: /url "title"
         
         [foo]
         .
        @@ -2434,10 +2431,10 @@ four spaces:

        <p>[foo]</p>
        -

        This is not a link reference definition, because it occurs inside +

        This is not a link reference definition, because it occurs inside a code block:

        -
        ```
        +
        ```
         [foo]: /url
         ```
         
        @@ -2448,9 +2445,9 @@ a code block:

        <p>[foo]</p>
        -

        A [link reference definition] cannot interrupt a paragraph.

        +

        A [link reference definition] cannot interrupt a paragraph.

        -
        Foo
        +
        Foo
         [bar]: /baz
         
         [bar]
        @@ -2460,10 +2457,10 @@ a code block:

        <p>[bar]</p>
        -

        However, it can directly follow other block elements, such as headings +

        However, it can directly follow other block elements, such as headings and thematic breaks, and it need not be followed by a blank line.

        -
        # [Foo]
        +
        # [Foo]
         [foo]: /url
         > bar
         .
        @@ -2474,7 +2471,7 @@ and thematic breaks, and it need not be followed by a blank line.

        -
        [foo]: /url
        +
        [foo]: /url
         bar
         ===
         [foo]
        @@ -2484,7 +2481,7 @@ and thematic breaks, and it need not be followed by a blank line.

        -
        [foo]: /url
        +
        [foo]: /url
         ===
         [foo]
         .
        @@ -2492,10 +2489,10 @@ and thematic breaks, and it need not be followed by a blank line.

        <a href="/url">foo</a></p>
        -

        Several [link reference definitions] +

        Several [link reference definitions] can occur one after another, without intervening blank lines.

        -
        [foo]: /foo-url "foo"
        +
        [foo]: /foo-url "foo"
         [bar]: /bar-url
           "bar"
         [baz]: /baz-url
        @@ -2509,12 +2506,12 @@ can occur one after another, without intervening blank lines.

        <a href="/baz-url">baz</a></p>
        -

        [Link reference definitions] can occur +

        [Link reference definitions] can occur inside block containers, like lists and block quotations. They affect the entire document, not just the container in which they are defined:

        -
        [foo]
        +
        [foo]
         
         > [foo]: /url
         .
        @@ -2523,27 +2520,27 @@ are defined:

        </blockquote>
        -

        Whether something is a [link reference definition] is +

        Whether something is a [link reference definition] is independent of whether the link reference it defines is used in the document. Thus, for example, the following document contains just a link reference definition, and no visible content:

        -
        [foo]: /url
        +
        [foo]: /url
         .
        -

        +

        Paragraphs

        -

        A sequence of non-blank lines that cannot be interpreted as other +

        A sequence of non-blank lines that cannot be interpreted as other kinds of blocks forms a paragraph. The contents of the paragraph are the result of parsing the paragraph's raw content as inlines. The paragraph's raw content is formed by concatenating the lines and removing initial and final [whitespace].

        -

        A simple example with two paragraphs:

        +

        A simple example with two paragraphs:

        -
        aaa
        +
        aaa
         
         bbb
         .
        @@ -2551,9 +2548,9 @@ is formed by concatenating the lines and removing initial and final
         <p>bbb</p>
        -

        Paragraphs can contain multiple lines, but no blank lines:

        +

        Paragraphs can contain multiple lines, but no blank lines:

        -
        aaa
        +
        aaa
         bbb
         
         ccc
        @@ -2565,9 +2562,9 @@ is formed by concatenating the lines and removing initial and final
         ddd</p>
        -

        Multiple blank lines between paragraph have no effect:

        +

        Multiple blank lines between paragraph have no effect:

        -
        aaa
        +
        aaa
         
         
         bbb
        @@ -2576,19 +2573,19 @@ is formed by concatenating the lines and removing initial and final
         <p>bbb</p>
        -

        Leading spaces are skipped:

        +

        Leading spaces are skipped:

        -
          aaa
        +
          aaa
          bbb
         .
         <p>aaa
         bbb</p>
        -

        Lines after the first may be indented any amount, since indented +

        Lines after the first may be indented any amount, since indented code blocks cannot interrupt paragraphs.

        -
        aaa
        +
        aaa
                      bbb
                                                ccc
         .
        @@ -2597,10 +2594,10 @@ code blocks cannot interrupt paragraphs.

        ccc</p>
        -

        However, the first line may be indented at most three spaces, +

        However, the first line may be indented at most three spaces, or an indented code block will be triggered:

        -
           aaa
        +
           aaa
         bbb
         .
         <p>aaa
        @@ -2608,7 +2605,7 @@ or an indented code block will be triggered:

        -
            aaa
        +
            aaa
         bbb
         .
         <pre><code>aaa
        @@ -2616,25 +2613,25 @@ or an indented code block will be triggered:

        <p>bbb</p>
        -

        Final spaces are stripped before inline parsing, so a paragraph +

        Final spaces are stripped before inline parsing, so a paragraph that ends with two or more spaces will not end with a [hard line break]:

        -
        aaa     
        +
        aaa     
         bbb     
         .
         <p>aaa<br />
         bbb</p>
        -

        +

        Blank lines

        -

        [Blank lines] between block-level elements are ignored, +

        [Blank lines] between block-level elements are ignored, except for the role they play in determining whether a [list] is [tight] or [loose].

        -

        Blank lines at the beginning and end of the document are also ignored.

        +

        Blank lines at the beginning and end of the document are also ignored.

        -
          
        +
          
         
         aaa
           
        @@ -2648,23 +2645,23 @@ is [tight] or [loose].

        -

        +

        Tables (extension)

        -

        GFM enables the table extension, where an additional leaf block type is +

        GFM enables the table extension, where an additional leaf block type is available.

        -

        A table is an arrangement of data with rows and columns, consisting of a +

        A table is an arrangement of data with rows and columns, consisting of a single header row, a [delimiter row] separating the header from the data, and zero or more data rows.

        -

        Each row consists of cells containing arbitrary text, in which [inlines] are +

        Each row consists of cells containing arbitrary text, in which [inlines] are parsed, separated by pipes (|). A leading and trailing pipe is also recommended for clarity of reading, and if there's otherwise parsing ambiguity. Spaces between pipes and cell content are trimmed. Block-level elements cannot be inserted in a table.

        -

        The delimiter row consists of cells whose only content are hyphens (-), +

        The delimiter row consists of cells whose only content are hyphens (-), and optionally, a leading or trailing colon (:), or both, to indicate left, right, or center alignment respectively.

        -
        | foo | bar |
        +
        | foo | bar |
         | --- | --- |
         | baz | bim |
         .
        @@ -2684,10 +2681,10 @@ right, or center alignment respectively.

        </table>
        -

        Cells in one column don't need to match length, though it's easier to read if +

        Cells in one column don't need to match length, though it's easier to read if they are. Likewise, use of leading and trailing pipes may be inconsistent:

        -
        | abc | defghi |
        +
        | abc | defghi |
         :-: | -----------:
         bar | baz
         .
        @@ -2707,10 +2704,10 @@ they are. Likewise, use of leading and trailing pipes may be inconsistent:

        </table>
        -

        Include a pipe in a cell's content by escaping it, including inside other +

        Include a pipe in a cell's content by escaping it, including inside other inline spans:

        -
        | f\|oo  |
        +
        | f\|oo  |
         | ------ |
         | b `\|` az |
         | b **\|** im |
        @@ -2732,10 +2729,10 @@ inline spans:

        </table>
        -

        The table is broken at the first empty line, or beginning of another +

        The table is broken at the first empty line, or beginning of another block-level structure:

        -
        | abc | def |
        +
        | abc | def |
         | --- | --- |
         | bar | baz |
         > bar
        @@ -2760,7 +2757,7 @@ block-level structure:

        -
        | abc | def |
        +
        | abc | def |
         | --- | --- |
         | bar | baz |
         bar
        @@ -2788,10 +2785,10 @@ block-level structure:

        <p>bar</p>
        -

        The header row must match the [delimiter row] in the number of cells. If not, +

        The header row must match the [delimiter row] in the number of cells. If not, a table will not be recognized:

        -
        | abc | def |
        +
        | abc | def |
         | --- |
         | bar |
         .
        @@ -2800,11 +2797,11 @@ a table will not be recognized:

        | bar |</p>
        -

        The remainder of the table's rows may vary in the number of cells. If there +

        The remainder of the table's rows may vary in the number of cells. If there are a number of cells fewer than the number of cells in the header row, empty cells are inserted. If there are greater, the excess is ignored:

        -
        | abc | def |
        +
        | abc | def |
         | --- | --- |
         | bar |
         | bar | baz | boo |
        @@ -2829,9 +2826,9 @@ cells are inserted.  If there are greater, the excess is ignored:

        </table>
        -

        If there are no rows in the body, no <tbody> is generated in HTML output:

        +

        If there are no rows in the body, no <tbody> is generated in HTML output:

        -
        | abc | def |
        +
        | abc | def |
         | --- | --- |
         .
         <table>
        @@ -2845,39 +2842,39 @@ cells are inserted.  If there are greater, the excess is ignored:

        -

        +

        Container blocks

        -

        A container block is a block that has other +

        A container block is a block that has other blocks as its contents. There are two basic kinds of container blocks: [block quotes] and [list items]. [Lists] are meta-containers for [list items].

        -

        We define the syntax for container blocks recursively. The general +

        We define the syntax for container blocks recursively. The general form of the definition is:

        -
        -

        If X is a sequence of blocks, then the result of +

        +

        If X is a sequence of blocks, then the result of transforming X in such-and-such a way is a container of type Y with these blocks as its content.

        -

        So, we explain what counts as a block quote or list item by explaining +

        So, we explain what counts as a block quote or list item by explaining how these can be generated from their contents. This should suffice to define the syntax, although it does not give a recipe for parsing these constructions. (A recipe is provided below in the section entitled A parsing strategy.)

        -

        +

        Block quotes

        -

        A block quote marker +

        A block quote marker consists of 0-3 spaces of initial indent, plus (a) the character > together with a following space, or (b) a single character > not followed by a space.

        -

        The following rules define [block quotes]:

        -
          -
        1. -

          Basic case. If a string of lines Ls constitute a sequence +

          The following rules define [block quotes]:

          +
            +
          1. +

            Basic case. If a string of lines Ls constitute a sequence of blocks Bs, then the result of prepending a [block quote marker] to the beginning of each line in Ls is a block quote containing Bs.

          2. -
          3. -

            Laziness. If a string of lines Ls constitute a block +

          4. +

            Laziness. If a string of lines Ls constitute a block quote with contents Bs, then the result of deleting the initial [block quote marker] from one or more lines in which the next [non-whitespace character] after the [block @@ -2887,15 +2884,15 @@ text] is a block quote with Bs as its content. that will be parsed as part of the content of a paragraph, but does not occur at the beginning of the paragraph.

          5. -
          6. -

            Consecutiveness. A document cannot contain two [block +

          7. +

            Consecutiveness. A document cannot contain two [block quotes] in a row unless there is a [blank line] between them.

          -

          Nothing else counts as a block quote.

          -

          Here is a simple example:

          +

          Nothing else counts as a block quote.

          +

          Here is a simple example:

          -
          > # Foo
          +
          > # Foo
           > bar
           > baz
           .
          @@ -2906,9 +2903,9 @@ quotes] in a row unless there is a [blank line] between them.

          </blockquote>
          -

          The spaces after the > characters can be omitted:

          +

          The spaces after the > characters can be omitted:

          -
          ># Foo
          +
          ># Foo
           >bar
           > baz
           .
          @@ -2919,9 +2916,9 @@ quotes] in a row unless there is a [blank line] between them.

          </blockquote>
          -

          The > characters can be indented 1-3 spaces:

          +

          The > characters can be indented 1-3 spaces:

          -
             > # Foo
          +
             > # Foo
              > bar
            > baz
           .
          @@ -2932,9 +2929,9 @@ quotes] in a row unless there is a [blank line] between them.

          </blockquote>
          -

          Four spaces gives us a code block:

          +

          Four spaces gives us a code block:

          -
              > # Foo
          +
              > # Foo
               > bar
               > baz
           .
          @@ -2944,10 +2941,10 @@ quotes] in a row unless there is a [blank line] between them.

          </code></pre>
          -

          The Laziness clause allows us to omit the > before +

          The Laziness clause allows us to omit the > before [paragraph continuation text]:

          -
          > # Foo
          +
          > # Foo
           > bar
           baz
           .
          @@ -2958,10 +2955,10 @@ quotes] in a row unless there is a [blank line] between them.

          </blockquote>
          -

          A block quote can contain some lazy and some non-lazy +

          A block quote can contain some lazy and some non-lazy continuation lines:

          -
          > bar
          +
          > bar
           baz
           > foo
           .
          @@ -2972,17 +2969,17 @@ continuation lines:

          </blockquote>
          -

          Laziness only applies to lines that would have been continuations of +

          Laziness only applies to lines that would have been continuations of paragraphs had they been prepended with [block quote markers]. For example, the > cannot be omitted in the second line of

          -
          > foo
          +
          > foo
           > ---
          -

          without changing the meaning:

          +

          without changing the meaning:

          -
          > foo
          +
          > foo
           ---
           .
           <blockquote>
          @@ -2991,15 +2988,15 @@ For example, the >  cannot be omitted in the second line of

          <hr />
          -

          Similarly, if we omit the > in the second line of

          +

          Similarly, if we omit the > in the second line of

          -
          > - foo
          +
          > - foo
           > - bar
          -

          then the block quote ends after the first line:

          +

          then the block quote ends after the first line:

          -
          > - foo
          +
          > - foo
           - bar
           .
           <blockquote>
          @@ -3012,10 +3009,10 @@ For example, the >  cannot be omitted in the second line of

          </ul>
          -

          For the same reason, we can't omit the > in front of +

          For the same reason, we can't omit the > in front of subsequent lines of an indented or fenced code block:

          -
          >     foo
          +
          >     foo
               bar
           .
           <blockquote>
          @@ -3027,7 +3024,7 @@ subsequent lines of an indented or fenced code block:

          -
          > ```
          +
          > ```
           foo
           ```
           .
          @@ -3038,10 +3035,10 @@ subsequent lines of an indented or fenced code block:

          <pre><code></code></pre>
          -

          Note that in the following case, we have a [lazy +

          Note that in the following case, we have a [lazy continuation line]:

          -
          > foo
          +
          > foo
               - bar
           .
           <blockquote>
          @@ -3050,25 +3047,25 @@ continuation line]:

          </blockquote>
          -

          To see why, note that in

          +

          To see why, note that in

          -
          > foo
          +
          > foo
           >     - bar
          -

          the - bar is indented too far to start a list, and can't +

          the - bar is indented too far to start a list, and can't be an indented code block because indented code blocks cannot interrupt paragraphs, so it is [paragraph continuation text].

          -

          A block quote can be empty:

          +

          A block quote can be empty:

          -
          >
          +
          >
           .
           <blockquote>
           </blockquote>
          -
          >
          +
          >
           >  
           > 
           .
          @@ -3076,9 +3073,9 @@ interrupt paragraphs, so it is [paragraph continuation text].

          </blockquote>
          -

          A block quote can have initial or final blank lines:

          +

          A block quote can have initial or final blank lines:

          -
          >
          +
          >
           > foo
           >  
           .
          @@ -3087,9 +3084,9 @@ interrupt paragraphs, so it is [paragraph continuation text].

          </blockquote>
          -

          A blank line always separates block quotes:

          +

          A blank line always separates block quotes:

          -
          > foo
          +
          > foo
           
           > bar
           .
          @@ -3101,14 +3098,14 @@ interrupt paragraphs, so it is [paragraph continuation text].

          </blockquote>
          -

          (Most current Markdown implementations, including John Gruber's +

          (Most current Markdown implementations, including John Gruber's original Markdown.pl, will parse this example as a single block quote with two paragraphs. But it seems better to allow the author to decide whether two block quotes or one are wanted.)

          -

          Consecutiveness means that if we put these block quotes together, +

          Consecutiveness means that if we put these block quotes together, we get a single block quote:

          -
          > foo
          +
          > foo
           > bar
           .
           <blockquote>
          @@ -3117,9 +3114,9 @@ we get a single block quote:

          </blockquote>
          -

          To get a block quote with two paragraphs, use:

          +

          To get a block quote with two paragraphs, use:

          -
          > foo
          +
          > foo
           >
           > bar
           .
          @@ -3129,9 +3126,9 @@ we get a single block quote:

          </blockquote>
          -

          Block quotes can interrupt paragraphs:

          +

          Block quotes can interrupt paragraphs:

          -
          foo
          +
          foo
           > bar
           .
           <p>foo</p>
          @@ -3140,10 +3137,10 @@ we get a single block quote:

          </blockquote>
          -

          In general, blank lines are not needed before or after block +

          In general, blank lines are not needed before or after block quotes:

          -
          > aaa
          +
          > aaa
           ***
           > bbb
           .
          @@ -3156,10 +3153,10 @@ quotes:

          </blockquote>
          -

          However, because of laziness, a blank line is needed between +

          However, because of laziness, a blank line is needed between a block quote and a following paragraph:

          -
          > bar
          +
          > bar
           baz
           .
           <blockquote>
          @@ -3169,7 +3166,7 @@ a block quote and a following paragraph:

          -
          > bar
          +
          > bar
           
           baz
           .
          @@ -3180,7 +3177,7 @@ a block quote and a following paragraph:

          -
          > bar
          +
          > bar
           >
           baz
           .
          @@ -3190,11 +3187,11 @@ a block quote and a following paragraph:

          <p>baz</p>
          -

          It is a consequence of the Laziness rule that any number +

          It is a consequence of the Laziness rule that any number of initial >s may be omitted on a continuation line of a nested block quote:

          -
          > > > foo
          +
          > > > foo
           bar
           .
           <blockquote>
          @@ -3208,7 +3205,7 @@ nested block quote:

          -
          >>> foo
          +
          >>> foo
           > bar
           >>baz
           .
          @@ -3223,12 +3220,12 @@ nested block quote:

          </blockquote>
          -

          When including an indented code block in a block quote, +

          When including an indented code block in a block quote, remember that the [block quote marker] includes both the > and a following space. So five spaces are needed after the >:

          -
          >     code
          +
          >     code
           
           >    not code
           .
          @@ -3241,21 +3238,21 @@ the >:

          </blockquote>
          -

          +

          List items

          -

          A list marker is a +

          A list marker is a [bullet list marker] or an [ordered list marker].

          -

          A bullet list marker +

          A bullet list marker is a -, +, or * character.

          -

          An ordered list marker +

          An ordered list marker is a sequence of 1--9 arabic digits (0-9), followed by either a . character or a ) character. (The reason for the length limit is that with 10 digits we start seeing integer overflows in some browsers.)

          -

          The following rules define [list items]:

          -
            -
          1. -

            Basic case. If a sequence of lines Ls constitute a sequence of +

            The following rules define [list items]:

            +
              +
            1. +

              Basic case. If a sequence of lines Ls constitute a sequence of blocks Bs starting with a [non-whitespace character], and M is a list marker of width W followed by 1 ≤ N ≤ 4 spaces, then the result of prepending M and the following spaces to the first line of @@ -3264,21 +3261,21 @@ list item with Bs as its contents. The type of the list item (bullet or ordered) is determined by the type of its list marker. If the list item is ordered, then it is also assigned a start number, based on the ordered list marker.

              -

              Exceptions:

              -
                -
              1. When the first list item in a [list] interrupts +

                Exceptions:

                +
                  +
                1. When the first list item in a [list] interrupts a paragraph---that is, when it starts on a line that would otherwise count as [paragraph continuation text]---then (a) the lines Ls must not begin with a blank line, and (b) if the list item is ordered, the start number must be 1.
                2. -
                3. If any line is a [thematic break][thematic breaks] then +
                4. If any line is a [thematic break][thematic breaks] then that line is not a list item.
              -

              For example, let Ls be the lines

              +

              For example, let Ls be the lines

              -
              A paragraph
              +
              A paragraph
               with two lines.
               
                   indented code
              @@ -3294,11 +3291,11 @@ that line is not a list item.
            2. </blockquote> -

              And let M be the marker 1., and N = 2. Then rule #1 says +

              And let M be the marker 1., and N = 2. Then rule #1 says that the following is an ordered list item with start number 1, and the same contents as Ls:

              -
              1.  A paragraph
              +
              1.  A paragraph
                   with two lines.
               
                       indented code
              @@ -3318,17 +3315,17 @@ and the same contents as Ls:

              </ol>
              -

              The most important thing to notice is that the position of +

              The most important thing to notice is that the position of the text after the list marker determines how much indentation is needed in subsequent blocks in the list item. If the list marker takes up two spaces, and there are three spaces between the list marker and the next [non-whitespace character], then blocks must be indented five spaces in order to fall under the list item.

              -

              Here are some examples showing how far content must be indented to be +

              Here are some examples showing how far content must be indented to be put under the list item:

              -
              - one
              +
              - one
               
                two
               .
              @@ -3339,7 +3336,7 @@ put under the list item:

              -
              - one
              +
              - one
               
                 two
               .
              @@ -3352,7 +3349,7 @@ put under the list item:

              -
               -    one
              +
               -    one
               
                    two
               .
              @@ -3364,7 +3361,7 @@ put under the list item:

              -
               -    one
              +
               -    one
               
                     two
               .
              @@ -3376,7 +3373,7 @@ put under the list item:

              </ul>
              -

              It is tempting to think of this in terms of columns: the continuation +

              It is tempting to think of this in terms of columns: the continuation blocks must be indented at least to the column of the first [non-whitespace character] after the list marker. However, that is not quite right. The spaces after the list marker determine how much relative indentation @@ -3384,7 +3381,7 @@ is needed. Which column this indentation reaches will depend on how the list item is embedded in other constructions, as shown by this example:

              -
                 > > 1.  one
              +
                 > > 1.  one
               >>
               >>     two
               .
              @@ -3400,15 +3397,15 @@ this example:

              </blockquote>
              -

              Here two occurs in the same column as the list marker 1., +

              Here two occurs in the same column as the list marker 1., but is actually contained in the list item, because there is sufficient indentation after the last containing blockquote marker.

              -

              The converse is also possible. In the following example, the word two +

              The converse is also possible. In the following example, the word two occurs far to the right of the initial text of the list item, one, but it is not considered part of the list item, because it is not indented far enough past the blockquote marker:

              -
              >>- one
              +
              >>- one
               >>
                 >  > two
               .
              @@ -3422,10 +3419,10 @@ far enough past the blockquote marker:

              </blockquote>
              -

              Note that at least one space is needed between the list marker and +

              Note that at least one space is needed between the list marker and any following content, so these are not list items:

              -
              -one
              +
              -one
               
               2.two
               .
              @@ -3433,10 +3430,10 @@ any following content, so these are not list items:

              <p>2.two</p>
              -

              A list item may contain blocks that are separated by more than +

              A list item may contain blocks that are separated by more than one blank line.

              -
              - foo
              +
              - foo
               
               
                 bar
              @@ -3449,9 +3446,9 @@ one blank line.

              </ul>
              -

              A list item may contain any kind of block:

              +

              A list item may contain any kind of block:

              -
              1.  foo
              +
              1.  foo
               
                   ```
                   bar
              @@ -3474,10 +3471,10 @@ one blank line.

              </ol>
              -

              A list item that contains an indented code block will preserve +

              A list item that contains an indented code block will preserve empty lines within the code block verbatim.

              -
              - Foo
              +
              - Foo
               
                     bar
               
              @@ -3496,9 +3493,9 @@ empty lines within the code block verbatim.

              </ul>
              -

              Note that ordered list start numbers must be nine digits or less:

              +

              Note that ordered list start numbers must be nine digits or less:

              -
              123456789. ok
              +
              123456789. ok
               .
               <ol start="123456789">
               <li>ok</li>
              @@ -3506,14 +3503,14 @@ empty lines within the code block verbatim.

              -
              1234567890. not ok
              +
              1234567890. not ok
               .
               <p>1234567890. not ok</p>
              -

              A start number may begin with 0s:

              +

              A start number may begin with 0s:

              -
              0. ok
              +
              0. ok
               .
               <ol start="0">
               <li>ok</li>
              @@ -3521,22 +3518,22 @@ empty lines within the code block verbatim.

              -
              003. ok
              +
              003. ok
               .
               <ol start="3">
               <li>ok</li>
               </ol>
              -

              A start number may not be negative:

              +

              A start number may not be negative:

              -
              -1. not ok
              +
              -1. not ok
               .
               <p>-1. not ok</p>
              -
                -
              1. +
                  +
                1. Item starting with indented code. If a sequence of lines Ls constitute a sequence of blocks Bs starting with an indented code block, and M is a list marker of width W followed by @@ -3548,11 +3545,11 @@ list item (bullet or ordered) is determined by the type of its list marker. If the list item is ordered, then it is also assigned a start number, based on the ordered list marker.
                -

                An indented code block will have to be indented four spaces beyond +

                An indented code block will have to be indented four spaces beyond the edge of the region where text will be included in the list item. In the following case that is 6 spaces:

                -
                - foo
                +
                - foo
                 
                       bar
                 .
                @@ -3565,9 +3562,9 @@ In the following case that is 6 spaces:

                </ul>
                -

                And in this case it is 11 spaces:

                +

                And in this case it is 11 spaces:

                -
                  10.  foo
                +
                  10.  foo
                 
                            bar
                 .
                @@ -3580,11 +3577,11 @@ In the following case that is 6 spaces:

                </ol>
                -

                If the first block in the list item is an indented code block, +

                If the first block in the list item is an indented code block, then by rule #2, the contents must be indented one space after the list marker:

                -
                    indented code
                +
                    indented code
                 
                 paragraph
                 
                @@ -3598,7 +3595,7 @@ list marker:

                -
                1.     indented code
                +
                1.     indented code
                 
                    paragraph
                 
                @@ -3615,10 +3612,10 @@ list marker:

                </ol>
                -

                Note that an additional space indent is interpreted as space +

                Note that an additional space indent is interpreted as space inside the code block:

                -
                1.      indented code
                +
                1.      indented code
                 
                    paragraph
                 
                @@ -3635,7 +3632,7 @@ inside the code block:

                </ol>
                -

                Note that rules #1 and #2 only apply to two cases: (a) cases +

                Note that rules #1 and #2 only apply to two cases: (a) cases in which the lines to be included in a list item begin with a [non-whitespace character], and (b) cases in which they begin with an indented code @@ -3643,7 +3640,7 @@ block. In a case like the following, where the first block begins with a three-space indent, the rules do not allow us to form a list item by indenting the whole thing and prepending a list marker:

                -
                   foo
                +
                   foo
                 
                 bar
                 .
                @@ -3652,7 +3649,7 @@ indenting the whole thing and prepending a list marker:

                -
                -    foo
                +
                -    foo
                 
                   bar
                 .
                @@ -3662,12 +3659,12 @@ indenting the whole thing and prepending a list marker:

                <p>bar</p>
                -

                This is not a significant restriction, because when a block begins +

                This is not a significant restriction, because when a block begins with 1-3 spaces indent, the indentation can always be removed without a change in interpretation, allowing rule #1 to be applied. So, in the above case:

                -
                -  foo
                +
                -  foo
                 
                    bar
                 .
                @@ -3679,8 +3676,8 @@ the above case:

                </ul>
                -
                  -
                1. +
                    +
                  1. Item starting with a blank line. If a sequence of lines Ls starting with a single [blank line] constitute a (possibly empty) sequence of blocks Bs, not separated from each other by more than @@ -3693,9 +3690,9 @@ list item (bullet or ordered) is determined by the type of its list marker. If the list item is ordered, then it is also assigned a start number, based on the ordered list marker.
                  -

                  Here are some list items that start with a blank line but are not empty:

                  +

                  Here are some list items that start with a blank line but are not empty:

                  -
                  -
                  +
                  -
                     foo
                   -
                     ```
                  @@ -3717,10 +3714,10 @@ start number, based on the ordered list marker.
                2. </ul> -

                  When the list item starts with a blank line, the number of spaces +

                  When the list item starts with a blank line, the number of spaces following the list marker doesn't change the required indentation:

                  -
                  -   
                  +
                  -   
                     foo
                   .
                   <ul>
                  @@ -3728,11 +3725,11 @@ following the list marker doesn't change the required indentation:

                  </ul>
                  -

                  A list item can begin with at most one blank line. +

                  A list item can begin with at most one blank line. In the following example, foo is not part of the list item:

                  -
                  -
                  +
                  -
                   
                     foo
                   .
                  @@ -3742,9 +3739,9 @@ item:

                  <p>foo</p>
                  -

                  Here is an empty bullet list item:

                  +

                  Here is an empty bullet list item:

                  -
                  - foo
                  +
                  - foo
                   -
                   - bar
                   .
                  @@ -3755,9 +3752,9 @@ item:

                  </ul>
                  -

                  It does not matter whether there are spaces following the [list marker]:

                  +

                  It does not matter whether there are spaces following the [list marker]:

                  -
                  - foo
                  +
                  - foo
                   -   
                   - bar
                   .
                  @@ -3768,9 +3765,9 @@ item:

                  </ul>
                  -

                  Here is an empty ordered list item:

                  +

                  Here is an empty ordered list item:

                  -
                  1. foo
                  +
                  1. foo
                   2.
                   3. bar
                   .
                  @@ -3781,18 +3778,18 @@ item:

                  </ol>
                  -

                  A list may start or end with an empty list item:

                  +

                  A list may start or end with an empty list item:

                  -
                  *
                  +
                  *
                   .
                   <ul>
                   <li></li>
                   </ul>
                  -

                  However, an empty list item cannot interrupt a paragraph:

                  +

                  However, an empty list item cannot interrupt a paragraph:

                  -
                  foo
                  +
                  foo
                   *
                   
                   foo
                  @@ -3804,17 +3801,17 @@ item:

                  1.</p>
                  -
                    -
                  1. +
                      +
                    1. Indentation. If a sequence of lines Ls constitutes a list item according to rule #1, #2, or #3, then the result of indenting each line of Ls by 1-3 spaces (the same for each line) also constitutes a list item with the same contents and attributes. If a line is empty, then it need not be indented.
                    -

                    Indented one space:

                    +

                    Indented one space:

                    -
                     1.  A paragraph
                    +
                     1.  A paragraph
                          with two lines.
                     
                              indented code
                    @@ -3834,9 +3831,9 @@ empty, then it need not be indented.
                  2. </ol> -

                    Indented two spaces:

                    +

                    Indented two spaces:

                    -
                      1.  A paragraph
                    +
                      1.  A paragraph
                           with two lines.
                     
                               indented code
                    @@ -3856,9 +3853,9 @@ empty, then it need not be indented.
                     </ol>
                    -

                    Indented three spaces:

                    +

                    Indented three spaces:

                    -
                       1.  A paragraph
                    +
                       1.  A paragraph
                            with two lines.
                     
                                indented code
                    @@ -3878,9 +3875,9 @@ empty, then it need not be indented.
                     </ol>
                    -

                    Four spaces indent gives a code block:

                    +

                    Four spaces indent gives a code block:

                    -
                        1.  A paragraph
                    +
                        1.  A paragraph
                             with two lines.
                     
                                 indented code
                    @@ -3896,8 +3893,8 @@ empty, then it need not be indented.
                     </code></pre>
                    -
                      -
                    1. +
                        +
                      1. Laziness. If a string of lines Ls constitute a list item with contents Bs, then the result of deleting some or all of the indentation from one or more lines in which the @@ -3907,9 +3904,9 @@ list item with the same contents and attributes. The unindented lines are called lazy continuation lines.
                      -

                      Here is an example with [lazy continuation lines]:

                      +

                      Here is an example with [lazy continuation lines]:

                      -
                        1.  A paragraph
                      +
                        1.  A paragraph
                       with two lines.
                       
                                 indented code
                      @@ -3929,9 +3926,9 @@ lines are called
                       </ol>
                      -

                      Indentation can be partially deleted:

                      +

                      Indentation can be partially deleted:

                      -
                        1.  A paragraph
                      +
                        1.  A paragraph
                           with two lines.
                       .
                       <ol>
                      @@ -3940,9 +3937,9 @@ lines are called
                       </ol>
                      -

                      These examples show how laziness can work in nested structures:

                      +

                      These examples show how laziness can work in nested structures:

                      -
                      > 1. > Blockquote
                      +
                      > 1. > Blockquote
                       continued here.
                       .
                       <blockquote>
                      @@ -3958,7 +3955,7 @@ lines are called
                       
                       
                      -
                      > 1. > Blockquote
                      +
                      > 1. > Blockquote
                       > continued here.
                       .
                       <blockquote>
                      @@ -3973,18 +3970,18 @@ lines are called
                       </blockquote>
                      -
                        -
                      1. +
                          +
                        1. That's all. Nothing that is not counted as a list item by rules #1--5 counts as a list item.
                        -

                        The rules for sublists follow from the general rules +

                        The rules for sublists follow from the general rules [above][List items]. A sublist must be indented the same number of spaces a paragraph would need to be in order to be included in the list item.

                        -

                        So, in this case we need two spaces indent:

                        +

                        So, in this case we need two spaces indent:

                        -
                        - foo
                        +
                        - foo
                           - bar
                             - baz
                               - boo
                        @@ -4006,9 +4003,9 @@ in the list item.

                        </ul>
                        -

                        One is not enough:

                        +

                        One is not enough:

                        -
                        - foo
                        +
                        - foo
                          - bar
                           - baz
                            - boo
                        @@ -4021,9 +4018,9 @@ in the list item.

                        </ul>
                        -

                        Here we need four, because the list marker is wider:

                        +

                        Here we need four, because the list marker is wider:

                        -
                        10) foo
                        +
                        10) foo
                             - bar
                         .
                         <ol start="10">
                        @@ -4035,9 +4032,9 @@ in the list item.

                        </ol>
                        -

                        Three is not enough:

                        +

                        Three is not enough:

                        -
                        10) foo
                        +
                        10) foo
                            - bar
                         .
                         <ol start="10">
                        @@ -4048,9 +4045,9 @@ in the list item.

                        </ul>
                        -

                        A list may be the first block in a list item:

                        +

                        A list may be the first block in a list item:

                        -
                        - - foo
                        +
                        - - foo
                         .
                         <ul>
                         <li>
                        @@ -4062,7 +4059,7 @@ in the list item.

                        -
                        1. - 2. foo
                        +
                        1. - 2. foo
                         .
                         <ol>
                         <li>
                        @@ -4077,9 +4074,9 @@ in the list item.

                        </ol>
                        -

                        A list item can contain a heading:

                        +

                        A list item can contain a heading:

                        -
                        - # Foo
                        +
                        - # Foo
                         - Bar
                           ---
                           baz
                        @@ -4094,38 +4091,38 @@ in the list item.

                        </ul>
                        -

                        +

                        Motivation

                        -

                        John Gruber's Markdown spec says the following about list items:

                        -
                          -
                        1. -

                          "List markers typically start at the left margin, but may be indented +

                          John Gruber's Markdown spec says the following about list items:

                          +
                            +
                          1. +

                            "List markers typically start at the left margin, but may be indented by up to three spaces. List markers must be followed by one or more spaces or a tab."

                          2. -
                          3. -

                            "To make lists look nice, you can wrap items with hanging indents.... +

                          4. +

                            "To make lists look nice, you can wrap items with hanging indents.... But if you don't want to, you don't have to."

                          5. -
                          6. -

                            "List items may consist of multiple paragraphs. Each subsequent +

                          7. +

                            "List items may consist of multiple paragraphs. Each subsequent paragraph in a list item must be indented by either 4 spaces or one tab."

                          8. -
                          9. -

                            "It looks nice if you indent every line of the subsequent paragraphs, +

                          10. +

                            "It looks nice if you indent every line of the subsequent paragraphs, but here again, Markdown will allow you to be lazy."

                          11. -
                          12. -

                            "To put a blockquote within a list item, the blockquote's > +

                          13. +

                            "To put a blockquote within a list item, the blockquote's > delimiters need to be indented."

                          14. -
                          15. -

                            "To put a code block within a list item, the code block needs to be +

                          16. +

                            "To put a code block within a list item, the code block needs to be indented twice — 8 spaces or two tabs."

                          -

                          These rules specify that a paragraph under a list item must be indented +

                          These rules specify that a paragraph under a list item must be indented four spaces (presumably, from the left margin, rather than the start of the list marker, but this is not said), and that code under a list item must be indented eight spaces instead of the usual four. They also say @@ -4135,7 +4132,7 @@ about other kinds of block-level content, it is certainly reasonable to infer that all block elements under a list item, including other lists, must be indented four spaces. This principle has been called the four-space rule.

                          -

                          The four-space rule is clear and principled, and if the reference +

                          The four-space rule is clear and principled, and if the reference implementation Markdown.pl had followed it, it probably would have become the standard. However, Markdown.pl allowed paragraphs and sublists to start with only two spaces indentation, at least on the @@ -4147,33 +4144,33 @@ determining what comes under a list item. (Pandoc and python-Markdown, for example, stuck with Gruber's syntax description and the four-space rule, while discount, redcarpet, marked, PHP Markdown, and others followed Markdown.pl's behavior more closely.)

                          -

                          Unfortunately, given the divergences between implementations, there +

                          Unfortunately, given the divergences between implementations, there is no way to give a spec for list items that will be guaranteed not to break any existing documents. However, the spec given here should correctly handle lists formatted with either the four-space rule or the more forgiving Markdown.pl behavior, provided they are laid out in a way that is natural for a human to read.

                          -

                          The strategy here is to let the width and indentation of the list marker +

                          The strategy here is to let the width and indentation of the list marker determine the indentation necessary for blocks to fall under the list item, rather than having a fixed and arbitrary number. The writer can think of the body of the list item as a unit which gets indented to the right enough to fit the list marker (and any indentation on the list marker). (The laziness rule, #5, then allows continuation lines to be unindented if needed.)

                          -

                          This rule is superior, we claim, to any rule requiring a fixed level of +

                          This rule is superior, we claim, to any rule requiring a fixed level of indentation from the margin. The four-space rule is clear but unnatural. It is quite unintuitive that

                          -
                          - foo
                          +
                          - foo
                           
                             bar
                           
                             - baz
                          -

                          should be parsed as two lists with an intervening paragraph,

                          +

                          should be parsed as two lists with an intervening paragraph,

                          -
                          <ul>
                          +
                          <ul>
                           <li>foo</li>
                           </ul>
                           <p>bar</p>
                          @@ -4182,9 +4179,9 @@ unnatural. It is quite unintuitive that

                          </ul>
                          -

                          as the four-space rule demands, rather than a single list,

                          +

                          as the four-space rule demands, rather than a single list,

                          -
                          <ul>
                          +
                          <ul>
                           <li>
                           <p>foo</p>
                           <p>bar</p>
                          @@ -4195,22 +4192,22 @@ unnatural. It is quite unintuitive that

                          </ul>
                          -

                          The choice of four spaces is arbitrary. It can be learned, but it is +

                          The choice of four spaces is arbitrary. It can be learned, but it is not likely to be guessed, and it trips up beginners regularly.

                          -

                          Would it help to adopt a two-space rule? The problem is that such +

                          Would it help to adopt a two-space rule? The problem is that such a rule, together with the rule allowing 1--3 spaces indentation of the initial list marker, allows text that is indented less than the original list marker to be included in the list item. For example, Markdown.pl parses

                          -
                             - one
                          +
                             - one
                           
                             two
                          -

                          as a single list item, with two a continuation paragraph:

                          +

                          as a single list item, with two a continuation paragraph:

                          -
                          <ul>
                          +
                          <ul>
                           <li>
                           <p>one</p>
                           <p>two</p>
                          @@ -4218,16 +4215,16 @@ original list marker to be included in the list item. For example,
                           </ul>
                          -

                          and similarly

                          +

                          and similarly

                          -
                          >   - one
                          +
                          >   - one
                           >
                           >  two
                          -

                          as

                          +

                          as

                          -
                          <blockquote>
                          +
                          <blockquote>
                           <ul>
                           <li>
                           <p>one</p>
                          @@ -4237,33 +4234,33 @@ original list marker to be included in the list item. For example,
                           </blockquote>
                          -

                          This is extremely unintuitive.

                          -

                          Rather than requiring a fixed indent from the margin, we could require +

                          This is extremely unintuitive.

                          +

                          Rather than requiring a fixed indent from the margin, we could require a fixed indent (say, two spaces, or even one space) from the list marker (which may itself be indented). This proposal would remove the last anomaly discussed. Unlike the spec presented above, it would count the following as a list item with a subparagraph, even though the paragraph bar is not indented as far as the first paragraph foo:

                          -
                           10. foo
                          +
                           10. foo
                           
                              bar  
                          -

                          Arguably this text does read like a list item with bar as a subparagraph, +

                          Arguably this text does read like a list item with bar as a subparagraph, which may count in favor of the proposal. However, on this proposal indented code would have to be indented six spaces after the list marker. And this would break a lot of existing Markdown, which has the pattern:

                          -
                          1.  foo
                          +
                          1.  foo
                           
                                   indented code
                          -

                          where the code is indented eight spaces. The spec above, by contrast, will +

                          where the code is indented eight spaces. The spec above, by contrast, will parse this text as expected, since the code block's indentation is measured from the beginning of foo.

                          -

                          The one case that needs special treatment is a list item that starts +

                          The one case that needs special treatment is a list item that starts with indented code. How much indentation is required in that case, since we don't have a "first paragraph" to measure from? Rule #2 simply stipulates that in such cases, we require one space indentation from the list marker @@ -4271,26 +4268,26 @@ that in such cases, we require one space indentation from the list marker four-space rule in cases where the list marker plus its initial indentation takes four spaces (a common case), but diverge in other cases.

                          -

                          +

                          Task list items (extension)

                          -

                          GFM enables the tasklist extension, where an additional processing step is +

                          GFM enables the tasklist extension, where an additional processing step is performed on [list items].

                          -

                          A task list item is a [list item][list items] where the first block in it +

                          A task list item is a [list item][list items] where the first block in it is a paragraph which begins with a [task list item marker] and at least one whitespace character before any other content.

                          -

                          A task list item marker consists of an optional number of spaces, a left +

                          A task list item marker consists of an optional number of spaces, a left bracket ([), either a whitespace character or the letter x in either lowercase or uppercase, and then a right bracket (]).

                          -

                          When rendered, the [task list item marker] is replaced with a semantic checkbox element; +

                          When rendered, the [task list item marker] is replaced with a semantic checkbox element; in an HTML output, this would be an <input type="checkbox"> element.

                          -

                          If the character between the brackets is a whitespace character, the checkbox +

                          If the character between the brackets is a whitespace character, the checkbox is unchecked. Otherwise, the checkbox is checked.

                          -

                          This spec does not define how the checkbox elements are interacted with: in practice, +

                          This spec does not define how the checkbox elements are interacted with: in practice, implementors are free to render the checkboxes as disabled or inmutable elements, or they may dynamically handle dynamic interactions (i.e. checking, unchecking) in the final rendered document.

                          -
                          - [ ] foo
                          +
                          - [ ] foo
                           - [x] bar
                           .
                           <ul>
                          @@ -4299,9 +4296,9 @@ the final rendered document.

                          </ul>
                          -

                          Task lists can be arbitrarily nested:

                          +

                          Task lists can be arbitrarily nested:

                          -
                          - [x] foo
                          +
                          - [x] foo
                             - [ ] bar
                             - [x] baz
                           - [ ] bim
                          @@ -4318,35 +4315,35 @@ the final rendered document.

                          -

                          +

                          Lists

                          -

                          A list is a sequence of one or more +

                          A list is a sequence of one or more list items [of the same type]. The list items may be separated by any number of blank lines.

                          -

                          Two list items are of the same type +

                          Two list items are of the same type if they begin with a [list marker] of the same type. Two list markers are of the same type if (a) they are bullet list markers using the same character (-, +, or *) or (b) they are ordered list numbers with the same delimiter (either . or )).

                          -

                          A list is an ordered list +

                          A list is an ordered list if its constituent list items begin with [ordered list markers], and a bullet list if its constituent list items begin with [bullet list markers].

                          -

                          The start number +

                          The start number of an [ordered list] is determined by the list number of its initial list item. The numbers of subsequent list items are disregarded.

                          -

                          A list is loose if any of its constituent +

                          A list is loose if any of its constituent list items are separated by blank lines, or if any of its constituent list items directly contain two block-level elements with a blank line between them. Otherwise a list is tight. (The difference in HTML output is that paragraphs in a loose list are wrapped in <p> tags, while paragraphs in a tight list are not.)

                          -

                          Changing the bullet or ordered list delimiter starts a new list:

                          +

                          Changing the bullet or ordered list delimiter starts a new list:

                          -
                          - foo
                          +
                          - foo
                           - bar
                           + baz
                           .
                          @@ -4360,7 +4357,7 @@ wrapped in <p> tags, while paragraphs in a tight list are not
                           
                           
                          -
                          1. foo
                          +
                          1. foo
                           2. bar
                           3) baz
                           .
                          @@ -4373,11 +4370,11 @@ wrapped in <p> tags, while paragraphs in a tight list are not
                           </ol>
                          -

                          In CommonMark, a list can interrupt a paragraph. That is, +

                          In CommonMark, a list can interrupt a paragraph. That is, no blank line is needed to separate a paragraph from a following list:

                          -
                          Foo
                          +
                          Foo
                           - bar
                           - baz
                           .
                          @@ -4388,74 +4385,74 @@ list:

                          </ul>
                          -

                          Markdown.pl does not allow this, through fear of triggering a list +

                          Markdown.pl does not allow this, through fear of triggering a list via a numeral in a hard-wrapped line:

                          -
                          The number of windows in my house is
                          +
                          The number of windows in my house is
                           14.  The number of doors is 6.
                          -

                          Oddly, though, Markdown.pl does allow a blockquote to +

                          Oddly, though, Markdown.pl does allow a blockquote to interrupt a paragraph, even though the same considerations might apply.

                          -

                          In CommonMark, we do allow lists to interrupt paragraphs, for +

                          In CommonMark, we do allow lists to interrupt paragraphs, for two reasons. First, it is natural and not uncommon for people to start lists without blank lines:

                          -
                          I need to buy
                          +
                          I need to buy
                           - new shoes
                           - a coat
                           - a plane ticket
                          -

                          Second, we are attracted to a

                          -
                          -

                          principle of uniformity: +

                          Second, we are attracted to a

                          +
                          +

                          principle of uniformity: if a chunk of text has a certain meaning, it will continue to have the same meaning when put into a container block (such as a list item or blockquote).

                          -

                          (Indeed, the spec for [list items] and [block quotes] presupposes +

                          (Indeed, the spec for [list items] and [block quotes] presupposes this principle.) This principle implies that if

                          -
                            * I need to buy
                          +
                            * I need to buy
                               - new shoes
                               - a coat
                               - a plane ticket
                          -

                          is a list item containing a paragraph followed by a nested sublist, +

                          is a list item containing a paragraph followed by a nested sublist, as all Markdown implementations agree it is (though the paragraph may be rendered without <p> tags, since the list is "tight"), then

                          -
                          I need to buy
                          +
                          I need to buy
                           - new shoes
                           - a coat
                           - a plane ticket
                          -

                          by itself should be a paragraph followed by a nested sublist.

                          -

                          Since it is well established Markdown practice to allow lists to +

                          by itself should be a paragraph followed by a nested sublist.

                          +

                          Since it is well established Markdown practice to allow lists to interrupt paragraphs inside list items, the [principle of uniformity] requires us to allow this outside list items as well. (reStructuredText takes a different approach, requiring blank lines before lists even inside other list items.)

                          -

                          In order to solve of unwanted lists in paragraphs with +

                          In order to solve of unwanted lists in paragraphs with hard-wrapped numerals, we allow only lists starting with 1 to interrupt paragraphs. Thus,

                          -
                          The number of windows in my house is
                          +
                          The number of windows in my house is
                           14.  The number of doors is 6.
                           .
                           <p>The number of windows in my house is
                           14.  The number of doors is 6.</p>
                          -

                          We may still get an unintended result in cases like

                          +

                          We may still get an unintended result in cases like

                          -
                          The number of windows in my house is
                          +
                          The number of windows in my house is
                           1.  The number of doors is 6.
                           .
                           <p>The number of windows in my house is</p>
                          @@ -4464,10 +4461,10 @@ interrupt paragraphs.  Thus,

                          </ol>
                          -

                          but this rule should prevent most spurious list captures.

                          -

                          There can be any number of blank lines between items:

                          +

                          but this rule should prevent most spurious list captures.

                          +

                          There can be any number of blank lines between items:

                          -
                          - foo
                          +
                          - foo
                           
                           - bar
                           
                          @@ -4488,7 +4485,7 @@ interrupt paragraphs.  Thus,

                          -
                          - foo
                          +
                          - foo
                             - bar
                               - baz
                           
                          @@ -4511,12 +4508,12 @@ interrupt paragraphs.  Thus,

                          </ul>
                          -

                          To separate consecutive lists of the same type, or to separate a +

                          To separate consecutive lists of the same type, or to separate a list from an indented code block that would otherwise be parsed as a subparagraph of the final list item, you can insert a blank HTML comment:

                          -
                          - foo
                          +
                          - foo
                           - bar
                           
                           <!-- -->
                          @@ -4536,7 +4533,7 @@ comment:

                          -
                          -   foo
                          +
                          -   foo
                           
                               notcode
                           
                          @@ -4560,12 +4557,12 @@ comment:

                          </code></pre>
                          -

                          List items need not be indented to the same level. The following +

                          List items need not be indented to the same level. The following list items will be treated as items at the same list level, since none is indented enough to belong to the previous list item:

                          -
                          - a
                          +
                          - a
                            - b
                             - c
                              - d
                          @@ -4585,7 +4582,7 @@ item:

                          -
                          1. a
                          +
                          1. a
                           
                             2. b
                           
                          @@ -4604,11 +4601,11 @@ item:

                          </ol>
                          -

                          Note, however, that list items may not be indented more than +

                          Note, however, that list items may not be indented more than three spaces. Here - e is treated as a paragraph continuation line, because it is indented more than three spaces:

                          -
                          - a
                          +
                          - a
                            - b
                             - c
                              - d
                          @@ -4623,11 +4620,11 @@ line, because it is indented more than three spaces:

                          </ul>
                          -

                          And here, 3. c is treated as in indented code block, +

                          And here, 3. c is treated as in indented code block, because it is indented four spaces and preceded by a blank line.

                          -
                          1. a
                          +
                          1. a
                           
                             2. b
                           
                          @@ -4645,10 +4642,10 @@ blank line.

                          </code></pre>
                          -

                          This is a loose list, because there is a blank line between +

                          This is a loose list, because there is a blank line between two of the list items:

                          -
                          - a
                          +
                          - a
                           - b
                           
                           - c
                          @@ -4666,9 +4663,9 @@ two of the list items:

                          </ul>
                          -

                          So is this, with a empty second item:

                          +

                          So is this, with a empty second item:

                          -
                          * a
                          +
                          * a
                           *
                           
                           * c
                          @@ -4684,11 +4681,11 @@ two of the list items:

                          </ul>
                          -

                          These are loose lists, even though there is no space between the items, +

                          These are loose lists, even though there is no space between the items, because one of the items directly contains two block-level elements with a blank line between them:

                          -
                          - a
                          +
                          - a
                           - b
                           
                             c
                          @@ -4709,7 +4706,7 @@ with a blank line between them:

                          -
                          - a
                          +
                          - a
                           - b
                           
                             [ref]: /url
                          @@ -4728,9 +4725,9 @@ with a blank line between them:

                          </ul>
                          -

                          This is a tight list, because the blank lines are in a code block:

                          +

                          This is a tight list, because the blank lines are in a code block:

                          -
                          - a
                          +
                          - a
                           - ```
                             b
                           
                          @@ -4750,11 +4747,11 @@ with a blank line between them:

                          </ul>
                          -

                          This is a tight list, because the blank line is between two +

                          This is a tight list, because the blank line is between two paragraphs of a sublist. So the sublist is loose while the outer list is tight:

                          -
                          - a
                          +
                          - a
                             - b
                           
                               c
                          @@ -4773,10 +4770,10 @@ the outer list is tight:

                          </ul>
                          -

                          This is a tight list, because the blank line is inside the +

                          This is a tight list, because the blank line is inside the block quote:

                          -
                          * a
                          +
                          * a
                             > b
                             >
                           * c
                          @@ -4791,10 +4788,10 @@ block quote:

                          </ul>
                          -

                          This list is tight, because the consecutive block elements +

                          This list is tight, because the consecutive block elements are not separated by blank lines:

                          -
                          - a
                          +
                          - a
                             > b
                             ```
                             c
                          @@ -4813,9 +4810,9 @@ are not separated by blank lines:

                          </ul>
                          -

                          A single-paragraph list is tight:

                          +

                          A single-paragraph list is tight:

                          -
                          - a
                          +
                          - a
                           .
                           <ul>
                           <li>a</li>
                          @@ -4823,7 +4820,7 @@ are not separated by blank lines:

                          -
                          - a
                          +
                          - a
                             - b
                           .
                           <ul>
                          @@ -4835,10 +4832,10 @@ are not separated by blank lines:

                          </ul>
                          -

                          This list is loose, because of the blank line between the +

                          This list is loose, because of the blank line between the two block elements in the list item:

                          -
                          1. ```
                          +
                          1. ```
                              foo
                              ```
                           
                          @@ -4853,9 +4850,9 @@ two block elements in the list item:

                          </ol>
                          -

                          Here the outer list is loose, the inner list tight:

                          +

                          Here the outer list is loose, the inner list tight:

                          -
                          * foo
                          +
                          * foo
                             * bar
                           
                             baz
                          @@ -4872,7 +4869,7 @@ two block elements in the list item:

                          -
                          - a
                          +
                          - a
                             - b
                             - c
                           
                          @@ -4898,40 +4895,40 @@ two block elements in the list item:

                          </ul>
                          -

                          +

                          Inlines

                          -

                          Inlines are parsed sequentially from the beginning of the character +

                          Inlines are parsed sequentially from the beginning of the character stream to the end (left to right, in left-to-right languages). Thus, for example, in

                          -
                          `hi`lo`
                          +
                          `hi`lo`
                           .
                           <p><code>hi</code>lo`</p>
                          -

                          hi is parsed as code, leaving the backtick at the end as a literal +

                          hi is parsed as code, leaving the backtick at the end as a literal backtick.

                          -

                          +

                          Backslash escapes

                          -

                          Any ASCII punctuation character may be backslash-escaped:

                          +

                          Any ASCII punctuation character may be backslash-escaped:

                          -
                          \!\"\#\$\%\&\'\(\)\*\+\,\-\.\/\:\;\<\=\>\?\@\[\\\]\^\_\`\{\|\}\~
                          +
                          \!\"\#\$\%\&\'\(\)\*\+\,\-\.\/\:\;\<\=\>\?\@\[\\\]\^\_\`\{\|\}\~
                           .
                           <p>!&quot;#$%&amp;'()*+,-./:;&lt;=&gt;?@[\]^_`{|}~</p>
                          -

                          Backslashes before other characters are treated as literal +

                          Backslashes before other characters are treated as literal backslashes:

                          -
                          \→\A\a\ \3\φ\«
                          +
                          \→\A\a\ \3\φ\«
                           .
                           <p>\→\A\a\ \3\φ\«</p>
                          -

                          Escaped characters are treated as regular characters and do +

                          Escaped characters are treated as regular characters and do not have their usual Markdown meanings:

                          -
                          \*not emphasized*
                          +
                          \*not emphasized*
                           \<br/> not a tag
                           \[not a link](/foo)
                           \`not code`
                          @@ -4952,39 +4949,39 @@ not have their usual Markdown meanings:

                          &amp;ouml; not a character entity</p>
                          -

                          If a backslash is itself escaped, the following character is not:

                          +

                          If a backslash is itself escaped, the following character is not:

                          -
                          \\*emphasis*
                          +
                          \\*emphasis*
                           .
                           <p>\<em>emphasis</em></p>
                          -

                          A backslash at the end of the line is a [hard line break]:

                          +

                          A backslash at the end of the line is a [hard line break]:

                          -
                          foo\
                          +
                          foo\
                           bar
                           .
                           <p>foo<br />
                           bar</p>
                          -

                          Backslash escapes do not work in code blocks, code spans, autolinks, or +

                          Backslash escapes do not work in code blocks, code spans, autolinks, or raw HTML:

                          -
                          `` \[\` ``
                          +
                          `` \[\` ``
                           .
                           <p><code>\[\`</code></p>
                          -
                              \[\]
                          +
                              \[\]
                           .
                           <pre><code>\[\]
                           </code></pre>
                          -
                          ~~~
                          +
                          ~~~
                           \[\]
                           ~~~
                           .
                          @@ -4993,27 +4990,27 @@ raw HTML:

                          -
                          <http://example.com?find=\*>
                          +
                          <http://example.com?find=\*>
                           .
                           <p><a href="http://example.com?find=%5C*">http://example.com?find=\*</a></p>
                          -
                          <a href="/bar\/)">
                          +
                          <a href="/bar\/)">
                           .
                           <a href="/bar\/)">
                          -

                          But they work in all other contexts, including URLs and link titles, +

                          But they work in all other contexts, including URLs and link titles, link references, and [info strings] in [fenced code blocks]:

                          -
                          [foo](/bar\* "ti\*tle")
                          +
                          [foo](/bar\* "ti\*tle")
                           .
                           <p><a href="/bar*" title="ti*tle">foo</a></p>
                          -
                          [foo]
                          +
                          [foo]
                           
                           [foo]: /bar\* "ti\*tle"
                           .
                          @@ -5021,7 +5018,7 @@ link references, and [info strings] in [fenced code blocks]:

                          -
                          ``` foo\+bar
                          +
                          ``` foo\+bar
                           foo
                           ```
                           .
                          @@ -5029,18 +5026,18 @@ link references, and [info strings] in [fenced code blocks]:

                          </code></pre>
                          -

                          +

                          Entity and numeric character references

                          -

                          Valid HTML entity references and numeric character references +

                          Valid HTML entity references and numeric character references can be used in place of the corresponding Unicode character, with the following exceptions:

                          -
                            -
                          • -

                            Entity and character references are not recognized in code +

                              +
                            • +

                              Entity and character references are not recognized in code blocks and code spans.

                            • -
                            • -

                              Entity and character references cannot stand in place of +

                            • +

                              Entity and character references cannot stand in place of special characters that define structural elements in CommonMark. For example, although &#42; can be used in place of a literal * character, &#42; cannot replace @@ -5048,16 +5045,16 @@ in place of a literal * character, &#42; cannot re breaks.

                            -

                            Conforming CommonMark parsers need not store information about +

                            Conforming CommonMark parsers need not store information about whether a particular character was represented in the source using a Unicode character or an entity reference.

                            -

                            Entity references consist of & + any of the valid +

                            Entity references consist of & + any of the valid HTML5 entity names + ;. The document https://html.spec.whatwg.org/multipage/entities.json is used as an authoritative source for the valid entity references and their corresponding code points.

                            -
                            &nbsp; &amp; &copy; &AElig; &Dcaron;
                            +
                            &nbsp; &amp; &copy; &AElig; &Dcaron;
                             &frac34; &HilbertSpace; &DifferentialD;
                             &ClockwiseContourIntegral; &ngE;
                             .
                            @@ -5066,7 +5063,7 @@ references and their corresponding code points.

                            ∲ ≧̸</p>
                            -

                            Decimal numeric character +

                            Decimal numeric character references consist of &# + a string of 1--7 arabic digits + ;. A numeric character reference is parsed as the corresponding @@ -5074,25 +5071,25 @@ Unicode character. Invalid Unicode code points will be replaced by the REPLACEMENT CHARACTER (U+FFFD). For security reasons, the code point U+0000 will also be replaced by U+FFFD.

                            -
                            &#35; &#1234; &#992; &#0;
                            +
                            &#35; &#1234; &#992; &#0;
                             .
                             <p># Ӓ Ϡ �</p>
                            -

                            Hexadecimal numeric character +

                            Hexadecimal numeric character references consist of &# + either X or x + a string of 1-6 hexadecimal digits + ;. They too are parsed as the corresponding Unicode character (this time specified with a hexadecimal numeral instead of decimal).

                            -
                            &#X22; &#XD06; &#xcab;
                            +
                            &#X22; &#XD06; &#xcab;
                             .
                             <p>&quot; ആ ಫ</p>
                            -

                            Here are some nonentities:

                            +

                            Here are some nonentities:

                            -
                            &nbsp &x; &#; &#x;
                            +
                            &nbsp &x; &#; &#x;
                             &#987654321;
                             &#abcdef0;
                             &ThisIsNotDefined; &hi?;
                            @@ -5103,40 +5100,40 @@ time specified with a hexadecimal numeral instead of decimal).

                            &amp;ThisIsNotDefined; &amp;hi?;</p>
                            -

                            Although HTML5 does accept some entity references +

                            Although HTML5 does accept some entity references without a trailing semicolon (such as &copy), these are not recognized here, because it makes the grammar too ambiguous:

                            -
                            &copy
                            +
                            &copy
                             .
                             <p>&amp;copy</p>
                            -

                            Strings that are not on the list of HTML5 named entities are not +

                            Strings that are not on the list of HTML5 named entities are not recognized as entity references either:

                            -
                            &MadeUpEntity;
                            +
                            &MadeUpEntity;
                             .
                             <p>&amp;MadeUpEntity;</p>
                            -

                            Entity and numeric character references are recognized in any +

                            Entity and numeric character references are recognized in any context besides code spans or code blocks, including URLs, [link titles], and [fenced code block][] [info strings]:

                            -
                            <a href="&ouml;&ouml;.html">
                            +
                            <a href="&ouml;&ouml;.html">
                             .
                             <a href="&ouml;&ouml;.html">
                            -
                            [foo](/f&ouml;&ouml; "f&ouml;&ouml;")
                            +
                            [foo](/f&ouml;&ouml; "f&ouml;&ouml;")
                             .
                             <p><a href="/f%C3%B6%C3%B6" title="föö">foo</a></p>
                            -
                            [foo]
                            +
                            [foo]
                             
                             [foo]: /f&ouml;&ouml; "f&ouml;&ouml;"
                             .
                            @@ -5144,7 +5141,7 @@ URLs, [link titles], and [fenced code block][] [info strings]:

                            -
                            ``` f&ouml;&ouml;
                            +
                            ``` f&ouml;&ouml;
                             foo
                             ```
                             .
                            @@ -5152,26 +5149,26 @@ URLs, [link titles], and [fenced code block][] [info strings]:

                            </code></pre>
                            -

                            Entity and numeric character references are treated as literal +

                            Entity and numeric character references are treated as literal text in code spans and code blocks:

                            -
                            `f&ouml;&ouml;`
                            +
                            `f&ouml;&ouml;`
                             .
                             <p><code>f&amp;ouml;&amp;ouml;</code></p>
                            -
                                f&ouml;f&ouml;
                            +
                                f&ouml;f&ouml;
                             .
                             <pre><code>f&amp;ouml;f&amp;ouml;
                             </code></pre>
                            -

                            Entity and numeric character references cannot be used +

                            Entity and numeric character references cannot be used in place of symbols indicating structure in CommonMark documents.

                            -
                            &#42;foo&#42;
                            +
                            &#42;foo&#42;
                             *foo*
                             .
                             <p>*foo*
                            @@ -5179,7 +5176,7 @@ documents.

                            -
                            &#42; foo
                            +
                            &#42; foo
                             
                             * foo
                             .
                            @@ -5190,7 +5187,7 @@ documents.

                            -
                            foo&#10;&#10;bar
                            +
                            foo&#10;&#10;bar
                             .
                             <p>foo
                             
                            @@ -5198,94 +5195,94 @@ documents.

                            -
                            &#9;foo
                            +
                            &#9;foo
                             .
                             <p>→foo</p>
                            -
                            [a](url &quot;tit&quot;)
                            +
                            [a](url &quot;tit&quot;)
                             .
                             <p>[a](url &quot;tit&quot;)</p>
                            -

                            +

                            Code spans

                            -

                            A backtick string +

                            A backtick string is a string of one or more backtick characters (`) that is neither preceded nor followed by a backtick.

                            -

                            A code span begins with a backtick string and ends with +

                            A code span begins with a backtick string and ends with a backtick string of equal length. The contents of the code span are the characters between the two backtick strings, normalized in the following ways:

                            -
                              -
                            • First, [line endings] are converted to [spaces].
                            • -
                            • If the resulting string both begins and ends with a [space] +
                                +
                              • First, [line endings] are converted to [spaces].
                              • +
                              • If the resulting string both begins and ends with a [space] character, but does not consist entirely of [space] characters, a single [space] character is removed from the front and back. This allows you to include code that begins or ends with backtick characters, which must be separated by whitespace from the opening or closing backtick strings.
                              -

                              This is a simple code span:

                              +

                              This is a simple code span:

                              -
                              `foo`
                              +
                              `foo`
                               .
                               <p><code>foo</code></p>
                              -

                              Here two backticks are used, because the code contains a backtick. +

                              Here two backticks are used, because the code contains a backtick. This example also illustrates stripping of a single leading and trailing space:

                              -
                              `` foo ` bar ``
                              +
                              `` foo ` bar ``
                               .
                               <p><code>foo ` bar</code></p>
                              -

                              This example shows the motivation for stripping leading and trailing +

                              This example shows the motivation for stripping leading and trailing spaces:

                              -
                              ` `` `
                              +
                              ` `` `
                               .
                               <p><code>``</code></p>
                              -

                              Note that only one space is stripped:

                              +

                              Note that only one space is stripped:

                              -
                              `  ``  `
                              +
                              `  ``  `
                               .
                               <p><code> `` </code></p>
                              -

                              The stripping only happens if the space is on both +

                              The stripping only happens if the space is on both sides of the string:

                              -
                              ` a`
                              +
                              ` a`
                               .
                               <p><code> a</code></p>
                              -

                              Only [spaces], and not [unicode whitespace] in general, are +

                              Only [spaces], and not [unicode whitespace] in general, are stripped in this way:

                              -
                              ` b `
                              +
                              ` b `
                               .
                               <p><code> b </code></p>
                              -

                              No stripping occurs if the code span contains only spaces:

                              +

                              No stripping occurs if the code span contains only spaces:

                              -
                              ` `
                              +
                              ` `
                               `  `
                               .
                               <p><code> </code>
                               <code>  </code></p>
                              -

                              [Line endings] are treated like spaces:

                              +

                              [Line endings] are treated like spaces:

                              -
                              ``
                              +
                              ``
                               foo
                               bar  
                               baz
                              @@ -5295,274 +5292,274 @@ stripped in this way:

                              -
                              ``
                              +
                              ``
                               foo 
                               ``
                               .
                               <p><code>foo </code></p>
                              -

                              Interior spaces are not collapsed:

                              +

                              Interior spaces are not collapsed:

                              -
                              `foo   bar 
                              +
                              `foo   bar 
                               baz`
                               .
                               <p><code>foo   bar  baz</code></p>
                              -

                              Note that browsers will typically collapse consecutive spaces +

                              Note that browsers will typically collapse consecutive spaces when rendering <code> elements, so it is recommended that the following CSS be used:

                              -
                              code{white-space: pre-wrap;}
                              +
                              code{white-space: pre-wrap;}
                              -

                              Note that backslash escapes do not work in code spans. All backslashes +

                              Note that backslash escapes do not work in code spans. All backslashes are treated literally:

                              -
                              `foo\`bar`
                              +
                              `foo\`bar`
                               .
                               <p><code>foo\</code>bar`</p>
                              -

                              Backslash escapes are never needed, because one can always choose a +

                              Backslash escapes are never needed, because one can always choose a string of n backtick characters as delimiters, where the code does not contain any strings of exactly n backtick characters.

                              -
                              ``foo`bar``
                              +
                              ``foo`bar``
                               .
                               <p><code>foo`bar</code></p>
                              -
                              ` foo `` bar `
                              +
                              ` foo `` bar `
                               .
                               <p><code>foo `` bar</code></p>
                              -

                              Code span backticks have higher precedence than any other inline +

                              Code span backticks have higher precedence than any other inline constructs except HTML tags and autolinks. Thus, for example, this is not parsed as emphasized text, since the second * is part of a code span:

                              -
                              *foo`*`
                              +
                              *foo`*`
                               .
                               <p>*foo<code>*</code></p>
                              -

                              And this is not parsed as a link:

                              +

                              And this is not parsed as a link:

                              -
                              [not a `link](/foo`)
                              +
                              [not a `link](/foo`)
                               .
                               <p>[not a <code>link](/foo</code>)</p>
                              -

                              Code spans, HTML tags, and autolinks have the same precedence. +

                              Code spans, HTML tags, and autolinks have the same precedence. Thus, this is code:

                              -
                              `<a href="`">`
                              +
                              `<a href="`">`
                               .
                               <p><code>&lt;a href=&quot;</code>&quot;&gt;`</p>
                              -

                              But this is an HTML tag:

                              +

                              But this is an HTML tag:

                              -
                              <a href="`">`
                              +
                              <a href="`">`
                               .
                               <p><a href="`">`</p>
                              -

                              And this is code:

                              +

                              And this is code:

                              -
                              `<http://foo.bar.`baz>`
                              +
                              `<http://foo.bar.`baz>`
                               .
                               <p><code>&lt;http://foo.bar.</code>baz&gt;`</p>
                              -

                              But this is an autolink:

                              +

                              But this is an autolink:

                              -
                              <http://foo.bar.`baz>`
                              +
                              <http://foo.bar.`baz>`
                               .
                               <p><a href="http://foo.bar.%60baz">http://foo.bar.`baz</a>`</p>
                              -

                              When a backtick string is not closed by a matching backtick string, +

                              When a backtick string is not closed by a matching backtick string, we just have literal backticks:

                              -
                              ```foo``
                              +
                              ```foo``
                               .
                               <p>```foo``</p>
                              -
                              `foo
                              +
                              `foo
                               .
                               <p>`foo</p>
                              -

                              The following case also illustrates the need for opening and +

                              The following case also illustrates the need for opening and closing backtick strings to be equal in length:

                              -
                              `foo``bar``
                              +
                              `foo``bar``
                               .
                               <p>`foo<code>bar</code></p>
                              -

                              +

                              Emphasis and strong emphasis

                              -

                              John Gruber's original Markdown syntax +

                              John Gruber's original Markdown syntax description says:

                              -
                              -

                              Markdown treats asterisks (*) and underscores (_) as indicators of +

                              +

                              Markdown treats asterisks (*) and underscores (_) as indicators of emphasis. Text wrapped with one * or _ will be wrapped with an HTML <em> tag; double *'s or _'s will be wrapped with an HTML <strong> tag.

                              -

                              This is enough for most users, but these rules leave much undecided, +

                              This is enough for most users, but these rules leave much undecided, especially when it comes to nested emphasis. The original Markdown.pl test suite makes it clear that triple *** and ___ delimiters can be used for strong emphasis, and most implementations have also allowed the following patterns:

                              -
                              ***strong emph***
                              +
                              ***strong emph***
                               ***strong** in emph*
                               ***emph* in strong**
                               **in strong *emph***
                               *in emph **strong***
                              -

                              The following patterns are less widely supported, but the intent +

                              The following patterns are less widely supported, but the intent is clear and they are useful (especially in contexts like bibliography entries):

                              -
                              *emph *with emph* in it*
                              +
                              *emph *with emph* in it*
                               **strong **with strong** in it**
                              -

                              Many implementations have also restricted intraword emphasis to +

                              Many implementations have also restricted intraword emphasis to the * forms, to avoid unwanted emphasis in words containing internal underscores. (It is best practice to put these in code spans, but users often do not.)

                              -
                              internal emphasis: foo*bar*baz
                              +
                              internal emphasis: foo*bar*baz
                               no emphasis: foo_bar_baz
                              -

                              The rules given below capture all of these patterns, while allowing +

                              The rules given below capture all of these patterns, while allowing for efficient parsing strategies that do not backtrack.

                              -

                              First, some definitions. A delimiter run is either +

                              First, some definitions. A delimiter run is either a sequence of one or more * characters that is not preceded or followed by a non-backslash-escaped * character, or a sequence of one or more _ characters that is not preceded or followed by a non-backslash-escaped _ character.

                              -

                              A left-flanking delimiter run is +

                              A left-flanking delimiter run is a [delimiter run] that is (1) not followed by [Unicode whitespace], and either (2a) not followed by a [punctuation character], or (2b) followed by a [punctuation character] and preceded by [Unicode whitespace] or a [punctuation character]. For purposes of this definition, the beginning and the end of the line count as Unicode whitespace.

                              -

                              A right-flanking delimiter run is +

                              A right-flanking delimiter run is a [delimiter run] that is (1) not preceded by [Unicode whitespace], and either (2a) not preceded by a [punctuation character], or (2b) preceded by a [punctuation character] and followed by [Unicode whitespace] or a [punctuation character]. For purposes of this definition, the beginning and the end of the line count as Unicode whitespace.

                              -

                              Here are some examples of delimiter runs.

                              -
                                -
                              • -

                                left-flanking but not right-flanking:

                                +

                                Here are some examples of delimiter runs.

                                +
                                  +
                                • +

                                  left-flanking but not right-flanking:

                                  -
                                  ***abc
                                  +
                                  ***abc
                                     _abc
                                   **"abc"
                                    _"abc"
                                • -
                                • -

                                  right-flanking but not left-flanking:

                                  +
                                • +

                                  right-flanking but not left-flanking:

                                  -
                                   abc***
                                  +
                                   abc***
                                    abc_
                                   "abc"**
                                   "abc"_
                                • -
                                • -

                                  Both left and right-flanking:

                                  +
                                • +

                                  Both left and right-flanking:

                                  -
                                   abc***def
                                  +
                                   abc***def
                                   "abc"_"def"
                                • -
                                • -

                                  Neither left nor right-flanking:

                                  +
                                • +

                                  Neither left nor right-flanking:

                                  -
                                  abc *** def
                                  +
                                  abc *** def
                                   a _ b
                                -

                                (The idea of distinguishing left-flanking and right-flanking +

                                (The idea of distinguishing left-flanking and right-flanking delimiter runs based on the character before and the character after comes from Roopesh Chander's vfmd. vfmd uses the terminology "emphasis indicator string" instead of "delimiter run," and its rules for distinguishing left- and right-flanking runs are a bit more complex than the ones given here.)

                                -

                                The following rules define emphasis and strong emphasis:

                                -
                                  -
                                1. -

                                  A single * character can open emphasis +

                                  The following rules define emphasis and strong emphasis:

                                  +
                                    +
                                  1. +

                                    A single * character can open emphasis iff (if and only if) it is part of a [left-flanking delimiter run].

                                  2. -
                                  3. -

                                    A single _ character [can open emphasis] iff +

                                  4. +

                                    A single _ character [can open emphasis] iff it is part of a [left-flanking delimiter run] and either (a) not part of a [right-flanking delimiter run] or (b) part of a [right-flanking delimiter run] preceded by punctuation.

                                  5. -
                                  6. -

                                    A single * character can close emphasis +

                                  7. +

                                    A single * character can close emphasis iff it is part of a [right-flanking delimiter run].

                                  8. -
                                  9. -

                                    A single _ character [can close emphasis] iff +

                                  10. +

                                    A single _ character [can close emphasis] iff it is part of a [right-flanking delimiter run] and either (a) not part of a [left-flanking delimiter run] or (b) part of a [left-flanking delimiter run] followed by punctuation.

                                  11. -
                                  12. -

                                    A double ** can open strong emphasis +

                                  13. +

                                    A double ** can open strong emphasis iff it is part of a [left-flanking delimiter run].

                                  14. -
                                  15. -

                                    A double __ [can open strong emphasis] iff +

                                  16. +

                                    A double __ [can open strong emphasis] iff it is part of a [left-flanking delimiter run] and either (a) not part of a [right-flanking delimiter run] or (b) part of a [right-flanking delimiter run] preceded by punctuation.

                                  17. -
                                  18. -

                                    A double ** can close strong emphasis +

                                  19. +

                                    A double ** can close strong emphasis iff it is part of a [right-flanking delimiter run].

                                  20. -
                                  21. -

                                    A double __ [can close strong emphasis] iff +

                                  22. +

                                    A double __ [can close strong emphasis] iff it is part of a [right-flanking delimiter run] and either (a) not part of a [left-flanking delimiter run] or (b) part of a [left-flanking delimiter run] followed by punctuation.

                                  23. -
                                  24. -

                                    Emphasis begins with a delimiter that [can open emphasis] and ends +

                                  25. +

                                    Emphasis begins with a delimiter that [can open emphasis] and ends with a delimiter that [can close emphasis], and that uses the same character (_ or *) as the opening delimiter. The opening and closing delimiters must belong to separate @@ -5572,8 +5569,8 @@ delimiter runs containing the opening and closing delimiters must not be a multiple of 3 unless both lengths are multiples of 3.

                                  26. -
                                  27. -

                                    Strong emphasis begins with a delimiter that +

                                  28. +

                                    Strong emphasis begins with a delimiter that [can open strong emphasis] and ends with a delimiter that [can close strong emphasis], and that uses the same character (_ or *) as the opening delimiter. The @@ -5584,45 +5581,45 @@ the delimiter runs containing the opening and closing delimiters must not be a multiple of 3 unless both lengths are multiples of 3.

                                  29. -
                                  30. -

                                    A literal * character cannot occur at the beginning or end of +

                                  31. +

                                    A literal * character cannot occur at the beginning or end of *-delimited emphasis or **-delimited strong emphasis, unless it is backslash-escaped.

                                  32. -
                                  33. -

                                    A literal _ character cannot occur at the beginning or end of +

                                  34. +

                                    A literal _ character cannot occur at the beginning or end of _-delimited emphasis or __-delimited strong emphasis, unless it is backslash-escaped.

                                  -

                                  Where rules 1--12 above are compatible with multiple parsings, +

                                  Where rules 1--12 above are compatible with multiple parsings, the following principles resolve ambiguity:

                                  -
                                    -
                                  1. -

                                    The number of nestings should be minimized. Thus, for example, +

                                      +
                                    1. +

                                      The number of nestings should be minimized. Thus, for example, an interpretation <strong>...</strong> is always preferred to <em><em>...</em></em>.

                                    2. -
                                    3. -

                                      An interpretation <em><strong>...</strong></em> is always +

                                    4. +

                                      An interpretation <em><strong>...</strong></em> is always preferred to <strong><em>...</em></strong>.

                                    5. -
                                    6. -

                                      When two potential emphasis or strong emphasis spans overlap, +

                                    7. +

                                      When two potential emphasis or strong emphasis spans overlap, so that the second begins before the first ends and ends after the first ends, the first takes precedence. Thus, for example, *foo _bar* baz_ is parsed as <em>foo _bar</em> baz_ rather than *foo <em>bar* baz</em>.

                                    8. -
                                    9. -

                                      When there are two potential emphasis or strong emphasis spans +

                                    10. +

                                      When there are two potential emphasis or strong emphasis spans with the same closing delimiter, the shorter one (the one that opens later) takes precedence. Thus, for example, **foo **bar baz** is parsed as **foo <strong>bar baz</strong> rather than <strong>foo **bar baz</strong>.

                                    11. -
                                    12. -

                                      Inline code spans, links, images, and HTML tags group more tightly +

                                    13. +

                                      Inline code spans, links, images, and HTML tags group more tightly than emphasis. So, when there is a choice between an interpretation that contains one of these elements and one that does not, the former always wins. Thus, for example, *[foo*](bar) is @@ -5630,338 +5627,338 @@ parsed as *<a href="bar">foo*</a> rather than as <em>[foo</em>](bar).

                                    -

                                    These rules can be illustrated through a series of examples.

                                    -

                                    Rule 1:

                                    +

                                    These rules can be illustrated through a series of examples.

                                    +

                                    Rule 1:

                                    -
                                    *foo bar*
                                    +
                                    *foo bar*
                                     .
                                     <p><em>foo bar</em></p>
                                    -

                                    This is not emphasis, because the opening * is followed by +

                                    This is not emphasis, because the opening * is followed by whitespace, and hence not part of a [left-flanking delimiter run]:

                                    -
                                    a * foo bar*
                                    +
                                    a * foo bar*
                                     .
                                     <p>a * foo bar*</p>
                                    -

                                    This is not emphasis, because the opening * is preceded +

                                    This is not emphasis, because the opening * is preceded by an alphanumeric and followed by punctuation, and hence not part of a [left-flanking delimiter run]:

                                    -
                                    a*"foo"*
                                    +
                                    a*"foo"*
                                     .
                                     <p>a*&quot;foo&quot;*</p>
                                    -

                                    Unicode nonbreaking spaces count as whitespace, too:

                                    +

                                    Unicode nonbreaking spaces count as whitespace, too:

                                    -
                                    * a *
                                    +
                                    * a *
                                     .
                                     <p>* a *</p>
                                    -

                                    Intraword emphasis with * is permitted:

                                    +

                                    Intraword emphasis with * is permitted:

                                    -
                                    foo*bar*
                                    +
                                    foo*bar*
                                     .
                                     <p>foo<em>bar</em></p>
                                    -
                                    5*6*78
                                    +
                                    5*6*78
                                     .
                                     <p>5<em>6</em>78</p>
                                    -

                                    Rule 2:

                                    +

                                    Rule 2:

                                    -
                                    _foo bar_
                                    +
                                    _foo bar_
                                     .
                                     <p><em>foo bar</em></p>
                                    -

                                    This is not emphasis, because the opening _ is followed by +

                                    This is not emphasis, because the opening _ is followed by whitespace:

                                    -
                                    _ foo bar_
                                    +
                                    _ foo bar_
                                     .
                                     <p>_ foo bar_</p>
                                    -

                                    This is not emphasis, because the opening _ is preceded +

                                    This is not emphasis, because the opening _ is preceded by an alphanumeric and followed by punctuation:

                                    -
                                    a_"foo"_
                                    +
                                    a_"foo"_
                                     .
                                     <p>a_&quot;foo&quot;_</p>
                                    -

                                    Emphasis with _ is not allowed inside words:

                                    +

                                    Emphasis with _ is not allowed inside words:

                                    -
                                    foo_bar_
                                    +
                                    foo_bar_
                                     .
                                     <p>foo_bar_</p>
                                    -
                                    5_6_78
                                    +
                                    5_6_78
                                     .
                                     <p>5_6_78</p>
                                    -
                                    пристаням_стремятся_
                                    +
                                    пристаням_стремятся_
                                     .
                                     <p>пристаням_стремятся_</p>
                                    -

                                    Here _ does not generate emphasis, because the first delimiter run +

                                    Here _ does not generate emphasis, because the first delimiter run is right-flanking and the second left-flanking:

                                    -
                                    aa_"bb"_cc
                                    +
                                    aa_"bb"_cc
                                     .
                                     <p>aa_&quot;bb&quot;_cc</p>
                                    -

                                    This is emphasis, even though the opening delimiter is +

                                    This is emphasis, even though the opening delimiter is both left- and right-flanking, because it is preceded by punctuation:

                                    -
                                    foo-_(bar)_
                                    +
                                    foo-_(bar)_
                                     .
                                     <p>foo-<em>(bar)</em></p>
                                    -

                                    Rule 3:

                                    -

                                    This is not emphasis, because the closing delimiter does +

                                    Rule 3:

                                    +

                                    This is not emphasis, because the closing delimiter does not match the opening delimiter:

                                    -
                                    _foo*
                                    +
                                    _foo*
                                     .
                                     <p>_foo*</p>
                                    -

                                    This is not emphasis, because the closing * is preceded by +

                                    This is not emphasis, because the closing * is preceded by whitespace:

                                    -
                                    *foo bar *
                                    +
                                    *foo bar *
                                     .
                                     <p>*foo bar *</p>
                                    -

                                    A newline also counts as whitespace:

                                    +

                                    A newline also counts as whitespace:

                                    -
                                    *foo bar
                                    +
                                    *foo bar
                                     *
                                     .
                                     <p>*foo bar
                                     *</p>
                                    -

                                    This is not emphasis, because the second * is +

                                    This is not emphasis, because the second * is preceded by punctuation and followed by an alphanumeric (hence it is not part of a [right-flanking delimiter run]:

                                    -
                                    *(*foo)
                                    +
                                    *(*foo)
                                     .
                                     <p>*(*foo)</p>
                                    -

                                    The point of this restriction is more easily appreciated +

                                    The point of this restriction is more easily appreciated with this example:

                                    -
                                    *(*foo*)*
                                    +
                                    *(*foo*)*
                                     .
                                     <p><em>(<em>foo</em>)</em></p>
                                    -

                                    Intraword emphasis with * is allowed:

                                    +

                                    Intraword emphasis with * is allowed:

                                    -
                                    *foo*bar
                                    +
                                    *foo*bar
                                     .
                                     <p><em>foo</em>bar</p>
                                    -

                                    Rule 4:

                                    -

                                    This is not emphasis, because the closing _ is preceded by +

                                    Rule 4:

                                    +

                                    This is not emphasis, because the closing _ is preceded by whitespace:

                                    -
                                    _foo bar _
                                    +
                                    _foo bar _
                                     .
                                     <p>_foo bar _</p>
                                    -

                                    This is not emphasis, because the second _ is +

                                    This is not emphasis, because the second _ is preceded by punctuation and followed by an alphanumeric:

                                    -
                                    _(_foo)
                                    +
                                    _(_foo)
                                     .
                                     <p>_(_foo)</p>
                                    -

                                    This is emphasis within emphasis:

                                    +

                                    This is emphasis within emphasis:

                                    -
                                    _(_foo_)_
                                    +
                                    _(_foo_)_
                                     .
                                     <p><em>(<em>foo</em>)</em></p>
                                    -

                                    Intraword emphasis is disallowed for _:

                                    +

                                    Intraword emphasis is disallowed for _:

                                    -
                                    _foo_bar
                                    +
                                    _foo_bar
                                     .
                                     <p>_foo_bar</p>
                                    -
                                    _пристаням_стремятся
                                    +
                                    _пристаням_стремятся
                                     .
                                     <p>_пристаням_стремятся</p>
                                    -
                                    _foo_bar_baz_
                                    +
                                    _foo_bar_baz_
                                     .
                                     <p><em>foo_bar_baz</em></p>
                                    -

                                    This is emphasis, even though the closing delimiter is +

                                    This is emphasis, even though the closing delimiter is both left- and right-flanking, because it is followed by punctuation:

                                    -
                                    _(bar)_.
                                    +
                                    _(bar)_.
                                     .
                                     <p><em>(bar)</em>.</p>
                                    -

                                    Rule 5:

                                    +

                                    Rule 5:

                                    -
                                    **foo bar**
                                    +
                                    **foo bar**
                                     .
                                     <p><strong>foo bar</strong></p>
                                    -

                                    This is not strong emphasis, because the opening delimiter is +

                                    This is not strong emphasis, because the opening delimiter is followed by whitespace:

                                    -
                                    ** foo bar**
                                    +
                                    ** foo bar**
                                     .
                                     <p>** foo bar**</p>
                                    -

                                    This is not strong emphasis, because the opening ** is preceded +

                                    This is not strong emphasis, because the opening ** is preceded by an alphanumeric and followed by punctuation, and hence not part of a [left-flanking delimiter run]:

                                    -
                                    a**"foo"**
                                    +
                                    a**"foo"**
                                     .
                                     <p>a**&quot;foo&quot;**</p>
                                    -

                                    Intraword strong emphasis with ** is permitted:

                                    +

                                    Intraword strong emphasis with ** is permitted:

                                    -
                                    foo**bar**
                                    +
                                    foo**bar**
                                     .
                                     <p>foo<strong>bar</strong></p>
                                    -

                                    Rule 6:

                                    +

                                    Rule 6:

                                    -
                                    __foo bar__
                                    +
                                    __foo bar__
                                     .
                                     <p><strong>foo bar</strong></p>
                                    -

                                    This is not strong emphasis, because the opening delimiter is +

                                    This is not strong emphasis, because the opening delimiter is followed by whitespace:

                                    -
                                    __ foo bar__
                                    +
                                    __ foo bar__
                                     .
                                     <p>__ foo bar__</p>
                                    -

                                    A newline counts as whitespace:

                                    +

                                    A newline counts as whitespace:

                                    -
                                    __
                                    +
                                    __
                                     foo bar__
                                     .
                                     <p>__
                                     foo bar__</p>
                                    -

                                    This is not strong emphasis, because the opening __ is preceded +

                                    This is not strong emphasis, because the opening __ is preceded by an alphanumeric and followed by punctuation:

                                    -
                                    a__"foo"__
                                    +
                                    a__"foo"__
                                     .
                                     <p>a__&quot;foo&quot;__</p>
                                    -

                                    Intraword strong emphasis is forbidden with __:

                                    +

                                    Intraword strong emphasis is forbidden with __:

                                    -
                                    foo__bar__
                                    +
                                    foo__bar__
                                     .
                                     <p>foo__bar__</p>
                                    -
                                    5__6__78
                                    +
                                    5__6__78
                                     .
                                     <p>5__6__78</p>
                                    -
                                    пристаням__стремятся__
                                    +
                                    пристаням__стремятся__
                                     .
                                     <p>пристаням__стремятся__</p>
                                    -
                                    __foo, __bar__, baz__
                                    +
                                    __foo, __bar__, baz__
                                     .
                                     <p><strong>foo, <strong>bar</strong>, baz</strong></p>
                                    -

                                    This is strong emphasis, even though the opening delimiter is +

                                    This is strong emphasis, even though the opening delimiter is both left- and right-flanking, because it is preceded by punctuation:

                                    -
                                    foo-__(bar)__
                                    +
                                    foo-__(bar)__
                                     .
                                     <p>foo-<strong>(bar)</strong></p>
                                    -

                                    Rule 7:

                                    -

                                    This is not strong emphasis, because the closing delimiter is preceded +

                                    Rule 7:

                                    +

                                    This is not strong emphasis, because the closing delimiter is preceded by whitespace:

                                    -
                                    **foo bar **
                                    +
                                    **foo bar **
                                     .
                                     <p>**foo bar **</p>
                                    -

                                    (Nor can it be interpreted as an emphasized *foo bar *, because of +

                                    (Nor can it be interpreted as an emphasized *foo bar *, because of Rule 11.)

                                    -

                                    This is not strong emphasis, because the second ** is +

                                    This is not strong emphasis, because the second ** is preceded by punctuation and followed by an alphanumeric:

                                    -
                                    **(**foo)
                                    +
                                    **(**foo)
                                     .
                                     <p>**(**foo)</p>
                                    -

                                    The point of this restriction is more easily appreciated +

                                    The point of this restriction is more easily appreciated with these examples:

                                    -
                                    *(**foo**)*
                                    +
                                    *(**foo**)*
                                     .
                                     <p><em>(<strong>foo</strong>)</em></p>
                                    -
                                    **Gomphocarpus (*Gomphocarpus physocarpus*, syn.
                                    +
                                    **Gomphocarpus (*Gomphocarpus physocarpus*, syn.
                                     *Asclepias physocarpa*)**
                                     .
                                     <p><strong>Gomphocarpus (<em>Gomphocarpus physocarpus</em>, syn.
                                    @@ -5969,278 +5966,278 @@ with these examples:

                                    -
                                    **foo "*bar*" foo**
                                    +
                                    **foo "*bar*" foo**
                                     .
                                     <p><strong>foo &quot;<em>bar</em>&quot; foo</strong></p>
                                    -

                                    Intraword emphasis:

                                    +

                                    Intraword emphasis:

                                    -
                                    **foo**bar
                                    +
                                    **foo**bar
                                     .
                                     <p><strong>foo</strong>bar</p>
                                    -

                                    Rule 8:

                                    -

                                    This is not strong emphasis, because the closing delimiter is +

                                    Rule 8:

                                    +

                                    This is not strong emphasis, because the closing delimiter is preceded by whitespace:

                                    -
                                    __foo bar __
                                    +
                                    __foo bar __
                                     .
                                     <p>__foo bar __</p>
                                    -

                                    This is not strong emphasis, because the second __ is +

                                    This is not strong emphasis, because the second __ is preceded by punctuation and followed by an alphanumeric:

                                    -
                                    __(__foo)
                                    +
                                    __(__foo)
                                     .
                                     <p>__(__foo)</p>
                                    -

                                    The point of this restriction is more easily appreciated +

                                    The point of this restriction is more easily appreciated with this example:

                                    -
                                    _(__foo__)_
                                    +
                                    _(__foo__)_
                                     .
                                     <p><em>(<strong>foo</strong>)</em></p>
                                    -

                                    Intraword strong emphasis is forbidden with __:

                                    +

                                    Intraword strong emphasis is forbidden with __:

                                    -
                                    __foo__bar
                                    +
                                    __foo__bar
                                     .
                                     <p>__foo__bar</p>
                                    -
                                    __пристаням__стремятся
                                    +
                                    __пристаням__стремятся
                                     .
                                     <p>__пристаням__стремятся</p>
                                    -
                                    __foo__bar__baz__
                                    +
                                    __foo__bar__baz__
                                     .
                                     <p><strong>foo__bar__baz</strong></p>
                                    -

                                    This is strong emphasis, even though the closing delimiter is +

                                    This is strong emphasis, even though the closing delimiter is both left- and right-flanking, because it is followed by punctuation:

                                    -
                                    __(bar)__.
                                    +
                                    __(bar)__.
                                     .
                                     <p><strong>(bar)</strong>.</p>
                                    -

                                    Rule 9:

                                    -

                                    Any nonempty sequence of inline elements can be the contents of an +

                                    Rule 9:

                                    +

                                    Any nonempty sequence of inline elements can be the contents of an emphasized span.

                                    -
                                    *foo [bar](/url)*
                                    +
                                    *foo [bar](/url)*
                                     .
                                     <p><em>foo <a href="/url">bar</a></em></p>
                                    -
                                    *foo
                                    +
                                    *foo
                                     bar*
                                     .
                                     <p><em>foo
                                     bar</em></p>
                                    -

                                    In particular, emphasis and strong emphasis can be nested +

                                    In particular, emphasis and strong emphasis can be nested inside emphasis:

                                    -
                                    _foo __bar__ baz_
                                    +
                                    _foo __bar__ baz_
                                     .
                                     <p><em>foo <strong>bar</strong> baz</em></p>
                                    -
                                    _foo _bar_ baz_
                                    +
                                    _foo _bar_ baz_
                                     .
                                     <p><em>foo <em>bar</em> baz</em></p>
                                    -
                                    __foo_ bar_
                                    +
                                    __foo_ bar_
                                     .
                                     <p><em><em>foo</em> bar</em></p>
                                    -
                                    *foo *bar**
                                    +
                                    *foo *bar**
                                     .
                                     <p><em>foo <em>bar</em></em></p>
                                    -
                                    *foo **bar** baz*
                                    +
                                    *foo **bar** baz*
                                     .
                                     <p><em>foo <strong>bar</strong> baz</em></p>
                                    -
                                    *foo**bar**baz*
                                    +
                                    *foo**bar**baz*
                                     .
                                     <p><em>foo<strong>bar</strong>baz</em></p>
                                    -

                                    Note that in the preceding case, the interpretation

                                    +

                                    Note that in the preceding case, the interpretation

                                    -
                                    <p><em>foo</em><em>bar<em></em>baz</em></p>
                                    +
                                    <p><em>foo</em><em>bar<em></em>baz</em></p>
                                    -

                                    is precluded by the condition that a delimiter that +

                                    is precluded by the condition that a delimiter that can both open and close (like the * after foo) cannot form emphasis if the sum of the lengths of the delimiter runs containing the opening and closing delimiters is a multiple of 3 unless both lengths are multiples of 3.

                                    -

                                    For the same reason, we don't get two consecutive +

                                    For the same reason, we don't get two consecutive emphasis sections in this example:

                                    -
                                    *foo**bar*
                                    +
                                    *foo**bar*
                                     .
                                     <p><em>foo**bar</em></p>
                                    -

                                    The same condition ensures that the following +

                                    The same condition ensures that the following cases are all strong emphasis nested inside emphasis, even when the interior spaces are omitted:

                                    -
                                    ***foo** bar*
                                    +
                                    ***foo** bar*
                                     .
                                     <p><em><strong>foo</strong> bar</em></p>
                                    -
                                    *foo **bar***
                                    +
                                    *foo **bar***
                                     .
                                     <p><em>foo <strong>bar</strong></em></p>
                                    -
                                    *foo**bar***
                                    +
                                    *foo**bar***
                                     .
                                     <p><em>foo<strong>bar</strong></em></p>
                                    -

                                    When the lengths of the interior closing and opening +

                                    When the lengths of the interior closing and opening delimiter runs are both multiples of 3, though, they can match to create emphasis:

                                    -
                                    foo***bar***baz
                                    +
                                    foo***bar***baz
                                     .
                                     <p>foo<em><strong>bar</strong></em>baz</p>
                                    -
                                    foo******bar*********baz
                                    +
                                    foo******bar*********baz
                                     .
                                     <p>foo<strong><strong><strong>bar</strong></strong></strong>***baz</p>
                                    -

                                    Indefinite levels of nesting are possible:

                                    +

                                    Indefinite levels of nesting are possible:

                                    -
                                    *foo **bar *baz* bim** bop*
                                    +
                                    *foo **bar *baz* bim** bop*
                                     .
                                     <p><em>foo <strong>bar <em>baz</em> bim</strong> bop</em></p>
                                    -
                                    *foo [*bar*](/url)*
                                    +
                                    *foo [*bar*](/url)*
                                     .
                                     <p><em>foo <a href="/url"><em>bar</em></a></em></p>
                                    -

                                    There can be no empty emphasis or strong emphasis:

                                    +

                                    There can be no empty emphasis or strong emphasis:

                                    -
                                    ** is not an empty emphasis
                                    +
                                    ** is not an empty emphasis
                                     .
                                     <p>** is not an empty emphasis</p>
                                    -
                                    **** is not an empty strong emphasis
                                    +
                                    **** is not an empty strong emphasis
                                     .
                                     <p>**** is not an empty strong emphasis</p>
                                    -

                                    Rule 10:

                                    -

                                    Any nonempty sequence of inline elements can be the contents of an +

                                    Rule 10:

                                    +

                                    Any nonempty sequence of inline elements can be the contents of an strongly emphasized span.

                                    -
                                    **foo [bar](/url)**
                                    +
                                    **foo [bar](/url)**
                                     .
                                     <p><strong>foo <a href="/url">bar</a></strong></p>
                                    -
                                    **foo
                                    +
                                    **foo
                                     bar**
                                     .
                                     <p><strong>foo
                                     bar</strong></p>
                                    -

                                    In particular, emphasis and strong emphasis can be nested +

                                    In particular, emphasis and strong emphasis can be nested inside strong emphasis:

                                    -
                                    __foo _bar_ baz__
                                    +
                                    __foo _bar_ baz__
                                     .
                                     <p><strong>foo <em>bar</em> baz</strong></p>
                                    -
                                    __foo __bar__ baz__
                                    +
                                    __foo __bar__ baz__
                                     .
                                     <p><strong>foo <strong>bar</strong> baz</strong></p>
                                    -
                                    ____foo__ bar__
                                    +
                                    ____foo__ bar__
                                     .
                                     <p><strong><strong>foo</strong> bar</strong></p>
                                    -
                                    **foo **bar****
                                    +
                                    **foo **bar****
                                     .
                                     <p><strong>foo <strong>bar</strong></strong></p>
                                    -
                                    **foo *bar* baz**
                                    +
                                    **foo *bar* baz**
                                     .
                                     <p><strong>foo <em>bar</em> baz</strong></p>
                                    -
                                    **foo*bar*baz**
                                    +
                                    **foo*bar*baz**
                                     .
                                     <p><strong>foo<em>bar</em>baz</strong></p>
                                    -
                                    ***foo* bar**
                                    +
                                    ***foo* bar**
                                     .
                                     <p><strong><em>foo</em> bar</strong></p>
                                    -
                                    **foo *bar***
                                    +
                                    **foo *bar***
                                     .
                                     <p><strong>foo <em>bar</em></strong></p>
                                    -

                                    Indefinite levels of nesting are possible:

                                    +

                                    Indefinite levels of nesting are possible:

                                    -
                                    **foo *bar **baz**
                                    +
                                    **foo *bar **baz**
                                     bim* bop**
                                     .
                                     <p><strong>foo <em>bar <strong>baz</strong>
                                    @@ -6248,334 +6245,334 @@ inside strong emphasis:

                                    -
                                    **foo [*bar*](/url)**
                                    +
                                    **foo [*bar*](/url)**
                                     .
                                     <p><strong>foo <a href="/url"><em>bar</em></a></strong></p>
                                    -

                                    There can be no empty emphasis or strong emphasis:

                                    +

                                    There can be no empty emphasis or strong emphasis:

                                    -
                                    __ is not an empty emphasis
                                    +
                                    __ is not an empty emphasis
                                     .
                                     <p>__ is not an empty emphasis</p>
                                    -
                                    ____ is not an empty strong emphasis
                                    +
                                    ____ is not an empty strong emphasis
                                     .
                                     <p>____ is not an empty strong emphasis</p>
                                    -

                                    Rule 11:

                                    +

                                    Rule 11:

                                    -
                                    foo ***
                                    +
                                    foo ***
                                     .
                                     <p>foo ***</p>
                                    -
                                    foo *\**
                                    +
                                    foo *\**
                                     .
                                     <p>foo <em>*</em></p>
                                    -
                                    foo *_*
                                    +
                                    foo *_*
                                     .
                                     <p>foo <em>_</em></p>
                                    -
                                    foo *****
                                    +
                                    foo *****
                                     .
                                     <p>foo *****</p>
                                    -
                                    foo **\***
                                    +
                                    foo **\***
                                     .
                                     <p>foo <strong>*</strong></p>
                                    -
                                    foo **_**
                                    +
                                    foo **_**
                                     .
                                     <p>foo <strong>_</strong></p>
                                    -

                                    Note that when delimiters do not match evenly, Rule 11 determines +

                                    Note that when delimiters do not match evenly, Rule 11 determines that the excess literal * characters will appear outside of the emphasis, rather than inside it:

                                    -
                                    **foo*
                                    +
                                    **foo*
                                     .
                                     <p>*<em>foo</em></p>
                                    -
                                    *foo**
                                    +
                                    *foo**
                                     .
                                     <p><em>foo</em>*</p>
                                    -
                                    ***foo**
                                    +
                                    ***foo**
                                     .
                                     <p>*<strong>foo</strong></p>
                                    -
                                    ****foo*
                                    +
                                    ****foo*
                                     .
                                     <p>***<em>foo</em></p>
                                    -
                                    **foo***
                                    +
                                    **foo***
                                     .
                                     <p><strong>foo</strong>*</p>
                                    -
                                    *foo****
                                    +
                                    *foo****
                                     .
                                     <p><em>foo</em>***</p>
                                    -

                                    Rule 12:

                                    +

                                    Rule 12:

                                    -
                                    foo ___
                                    +
                                    foo ___
                                     .
                                     <p>foo ___</p>
                                    -
                                    foo _\__
                                    +
                                    foo _\__
                                     .
                                     <p>foo <em>_</em></p>
                                    -
                                    foo _*_
                                    +
                                    foo _*_
                                     .
                                     <p>foo <em>*</em></p>
                                    -
                                    foo _____
                                    +
                                    foo _____
                                     .
                                     <p>foo _____</p>
                                    -
                                    foo __\___
                                    +
                                    foo __\___
                                     .
                                     <p>foo <strong>_</strong></p>
                                    -
                                    foo __*__
                                    +
                                    foo __*__
                                     .
                                     <p>foo <strong>*</strong></p>
                                    -
                                    __foo_
                                    +
                                    __foo_
                                     .
                                     <p>_<em>foo</em></p>
                                    -

                                    Note that when delimiters do not match evenly, Rule 12 determines +

                                    Note that when delimiters do not match evenly, Rule 12 determines that the excess literal _ characters will appear outside of the emphasis, rather than inside it:

                                    -
                                    _foo__
                                    +
                                    _foo__
                                     .
                                     <p><em>foo</em>_</p>
                                    -
                                    ___foo__
                                    +
                                    ___foo__
                                     .
                                     <p>_<strong>foo</strong></p>
                                    -
                                    ____foo_
                                    +
                                    ____foo_
                                     .
                                     <p>___<em>foo</em></p>
                                    -
                                    __foo___
                                    +
                                    __foo___
                                     .
                                     <p><strong>foo</strong>_</p>
                                    -
                                    _foo____
                                    +
                                    _foo____
                                     .
                                     <p><em>foo</em>___</p>
                                    -

                                    Rule 13 implies that if you want emphasis nested directly inside +

                                    Rule 13 implies that if you want emphasis nested directly inside emphasis, you must use different delimiters:

                                    -
                                    **foo**
                                    +
                                    **foo**
                                     .
                                     <p><strong>foo</strong></p>
                                    -
                                    *_foo_*
                                    +
                                    *_foo_*
                                     .
                                     <p><em><em>foo</em></em></p>
                                    -
                                    __foo__
                                    +
                                    __foo__
                                     .
                                     <p><strong>foo</strong></p>
                                    -
                                    _*foo*_
                                    +
                                    _*foo*_
                                     .
                                     <p><em><em>foo</em></em></p>
                                    -

                                    However, strong emphasis within strong emphasis is possible without +

                                    However, strong emphasis within strong emphasis is possible without switching delimiters:

                                    -
                                    ****foo****
                                    +
                                    ****foo****
                                     .
                                     <p><strong><strong>foo</strong></strong></p>
                                    -
                                    ____foo____
                                    +
                                    ____foo____
                                     .
                                     <p><strong><strong>foo</strong></strong></p>
                                    -

                                    Rule 13 can be applied to arbitrarily long sequences of +

                                    Rule 13 can be applied to arbitrarily long sequences of delimiters:

                                    -
                                    ******foo******
                                    +
                                    ******foo******
                                     .
                                     <p><strong><strong><strong>foo</strong></strong></strong></p>
                                    -

                                    Rule 14:

                                    +

                                    Rule 14:

                                    -
                                    ***foo***
                                    +
                                    ***foo***
                                     .
                                     <p><em><strong>foo</strong></em></p>
                                    -
                                    _____foo_____
                                    +
                                    _____foo_____
                                     .
                                     <p><em><strong><strong>foo</strong></strong></em></p>
                                    -

                                    Rule 15:

                                    +

                                    Rule 15:

                                    -
                                    *foo _bar* baz_
                                    +
                                    *foo _bar* baz_
                                     .
                                     <p><em>foo _bar</em> baz_</p>
                                    -
                                    *foo __bar *baz bim__ bam*
                                    +
                                    *foo __bar *baz bim__ bam*
                                     .
                                     <p><em>foo <strong>bar *baz bim</strong> bam</em></p>
                                    -

                                    Rule 16:

                                    +

                                    Rule 16:

                                    -
                                    **foo **bar baz**
                                    +
                                    **foo **bar baz**
                                     .
                                     <p>**foo <strong>bar baz</strong></p>
                                    -
                                    *foo *bar baz*
                                    +
                                    *foo *bar baz*
                                     .
                                     <p>*foo <em>bar baz</em></p>
                                    -

                                    Rule 17:

                                    +

                                    Rule 17:

                                    -
                                    *[bar*](/url)
                                    +
                                    *[bar*](/url)
                                     .
                                     <p>*<a href="/url">bar*</a></p>
                                    -
                                    _foo [bar_](/url)
                                    +
                                    _foo [bar_](/url)
                                     .
                                     <p>_foo <a href="/url">bar_</a></p>
                                    -
                                    *<img src="foo" title="*"/>
                                    +
                                    *<img src="foo" title="*"/>
                                     .
                                     <p>*<img src="foo" title="*"/></p>
                                    -
                                    **<a href="**">
                                    +
                                    **<a href="**">
                                     .
                                     <p>**<a href="**"></p>
                                    -
                                    __<a href="__">
                                    +
                                    __<a href="__">
                                     .
                                     <p>__<a href="__"></p>
                                    -
                                    *a `*`*
                                    +
                                    *a `*`*
                                     .
                                     <p><em>a <code>*</code></em></p>
                                    -
                                    _a `_`_
                                    +
                                    _a `_`_
                                     .
                                     <p><em>a <code>_</code></em></p>
                                    -
                                    **a<http://foo.bar/?q=**>
                                    +
                                    **a<http://foo.bar/?q=**>
                                     .
                                     <p>**a<a href="http://foo.bar/?q=**">http://foo.bar/?q=**</a></p>
                                    -
                                    __a<http://foo.bar/?q=__>
                                    +
                                    __a<http://foo.bar/?q=__>
                                     .
                                     <p>__a<a href="http://foo.bar/?q=__">http://foo.bar/?q=__</a></p>
                                    -

                                    +

                                    Strikethrough (extension)

                                    -

                                    GFM enables the strikethrough extension, where an additional emphasis type is +

                                    GFM enables the strikethrough extension, where an additional emphasis type is available.

                                    -

                                    Strikethrough text is any text wrapped in two tildes (~).

                                    +

                                    Strikethrough text is any text wrapped in two tildes (~).

                                    -
                                    ~~Hi~~ Hello, world!
                                    +
                                    ~~Hi~~ Hello, world!
                                     .
                                     <p><del>Hi</del> Hello, world!</p>
                                    -

                                    As with regular emphasis delimiters, a new paragraph will cause strikethrough +

                                    As with regular emphasis delimiters, a new paragraph will cause strikethrough parsing to cease:

                                    -
                                    This ~~has a
                                    +
                                    This ~~has a
                                     
                                     new paragraph~~.
                                     .
                                    @@ -6584,49 +6581,49 @@ parsing to cease:

                                    -

                                    +

                                    Links

                                    -

                                    A link contains [link text] (the visible text), a [link destination] +

                                    A link contains [link text] (the visible text), a [link destination] (the URI that is the link destination), and optionally a [link title]. There are two basic kinds of links in Markdown. In [inline links] the destination and title are given immediately after the link text. In [reference links] the destination and title are defined elsewhere in the document.

                                    -

                                    A link text consists of a sequence of zero or more +

                                    A link text consists of a sequence of zero or more inline elements enclosed by square brackets ([ and ]). The following rules apply:

                                    -
                                      -
                                    • -

                                      Links may not contain other links, at any level of nesting. If +

                                        +
                                      • +

                                        Links may not contain other links, at any level of nesting. If multiple otherwise valid link definitions appear nested inside each other, the inner-most definition is used.

                                      • -
                                      • -

                                        Brackets are allowed in the [link text] only if (a) they +

                                      • +

                                        Brackets are allowed in the [link text] only if (a) they are backslash-escaped or (b) they appear as a matched pair of brackets, with an open bracket [, a sequence of zero or more inlines, and a close bracket ].

                                      • -
                                      • -

                                        Backtick [code spans], [autolinks], and raw [HTML tags] bind more tightly +

                                      • +

                                        Backtick [code spans], [autolinks], and raw [HTML tags] bind more tightly than the brackets in link text. Thus, for example, [foo`]` could not be a link text, since the second ] is part of a code span.

                                      • -
                                      • -

                                        The brackets in link text bind more tightly than markers for +

                                      • +

                                        The brackets in link text bind more tightly than markers for [emphasis and strong emphasis]. Thus, for example, *[foo*](url) is a link.

                                      -

                                      A link destination consists of either

                                      -
                                        -
                                      • -

                                        a sequence of zero or more characters between an opening < and a +

                                        A link destination consists of either

                                        +
                                          +
                                        • +

                                          a sequence of zero or more characters between an opening < and a closing > that contains no line breaks or unescaped < or > characters, or

                                        • -
                                        • -

                                          a nonempty sequence of characters that does not start with +

                                        • +

                                          a nonempty sequence of characters that does not start with <, does not include ASCII space or control characters, and includes parentheses only if (a) they are backslash-escaped or (b) they are part of a balanced pair of unescaped parentheses. @@ -6635,27 +6632,27 @@ avoid performance issues, but at least three levels of nesting should be supported.)

                                        -

                                        A link title consists of either

                                        -
                                          -
                                        • -

                                          a sequence of zero or more characters between straight double-quote +

                                          A link title consists of either

                                          +
                                            +
                                          • +

                                            a sequence of zero or more characters between straight double-quote characters ("), including a " character only if it is backslash-escaped, or

                                          • -
                                          • -

                                            a sequence of zero or more characters between straight single-quote +

                                          • +

                                            a sequence of zero or more characters between straight single-quote characters ('), including a ' character only if it is backslash-escaped, or

                                          • -
                                          • -

                                            a sequence of zero or more characters between matching parentheses +

                                          • +

                                            a sequence of zero or more characters between matching parentheses ((...)), including a ( or ) character only if it is backslash-escaped.

                                          -

                                          Although [link titles] may span multiple lines, they may not contain +

                                          Although [link titles] may span multiple lines, they may not contain a [blank line].

                                          -

                                          An inline link consists of a [link text] followed immediately +

                                          An inline link consists of a [link text] followed immediately by a left parenthesis (, optional [whitespace], an optional [link destination], an optional [link title] separated from the link destination by [whitespace], optional [whitespace], and a right @@ -6666,51 +6663,51 @@ The link's URI consists of the link destination, excluding enclosing above. The link's title consists of the link title, excluding its enclosing delimiters, with backslash-escapes in effect as described above.

                                          -

                                          Here is a simple inline link:

                                          +

                                          Here is a simple inline link:

                                          -
                                          [link](/uri "title")
                                          +
                                          [link](/uri "title")
                                           .
                                           <p><a href="/uri" title="title">link</a></p>
                                          -

                                          The title may be omitted:

                                          +

                                          The title may be omitted:

                                          -
                                          [link](/uri)
                                          +
                                          [link](/uri)
                                           .
                                           <p><a href="/uri">link</a></p>
                                          -

                                          Both the title and the destination may be omitted:

                                          +

                                          Both the title and the destination may be omitted:

                                          -
                                          [link]()
                                          +
                                          [link]()
                                           .
                                           <p><a href="">link</a></p>
                                          -
                                          [link](<>)
                                          +
                                          [link](<>)
                                           .
                                           <p><a href="">link</a></p>
                                          -

                                          The destination can only contain spaces if it is +

                                          The destination can only contain spaces if it is enclosed in pointy brackets:

                                          -
                                          [link](/my uri)
                                          +
                                          [link](/my uri)
                                           .
                                           <p>[link](/my uri)</p>
                                          -
                                          [link](</my uri>)
                                          +
                                          [link](</my uri>)
                                           .
                                           <p><a href="/my%20uri">link</a></p>
                                          -

                                          The destination cannot contain line breaks, +

                                          The destination cannot contain line breaks, even if enclosed in pointy brackets:

                                          -
                                          [link](foo
                                          +
                                          [link](foo
                                           bar)
                                           .
                                           <p>[link](foo
                                          @@ -6718,32 +6715,32 @@ even if enclosed in pointy brackets:

                                          -
                                          [link](<foo
                                          +
                                          [link](<foo
                                           bar>)
                                           .
                                           <p>[link](<foo
                                           bar>)</p>
                                          -

                                          The destination can contain ) if it is enclosed +

                                          The destination can contain ) if it is enclosed in pointy brackets:

                                          -
                                          [a](<b)c>)
                                          +
                                          [a](<b)c>)
                                           .
                                           <p><a href="b)c">a</a></p>
                                          -

                                          Pointy brackets that enclose links must be unescaped:

                                          +

                                          Pointy brackets that enclose links must be unescaped:

                                          -
                                          [link](<foo\>)
                                          +
                                          [link](<foo\>)
                                           .
                                           <p>[link](&lt;foo&gt;)</p>
                                          -

                                          These are not links, because the opening pointy bracket +

                                          These are not links, because the opening pointy bracket is not matched properly:

                                          -
                                          [a](<b)c
                                          +
                                          [a](<b)c
                                           [a](<b)c>
                                           [a](<b>c)
                                           .
                                          @@ -6752,46 +6749,46 @@ is not matched properly:

                                          [a](<b>c)</p>
                                          -

                                          Parentheses inside the link destination may be escaped:

                                          +

                                          Parentheses inside the link destination may be escaped:

                                          -
                                          [link](\(foo\))
                                          +
                                          [link](\(foo\))
                                           .
                                           <p><a href="(foo)">link</a></p>
                                          -

                                          Any number of parentheses are allowed without escaping, as long as they are +

                                          Any number of parentheses are allowed without escaping, as long as they are balanced:

                                          -
                                          [link](foo(and(bar)))
                                          +
                                          [link](foo(and(bar)))
                                           .
                                           <p><a href="foo(and(bar))">link</a></p>
                                          -

                                          However, if you have unbalanced parentheses, you need to escape or use the +

                                          However, if you have unbalanced parentheses, you need to escape or use the <...> form:

                                          -
                                          [link](foo\(and\(bar\))
                                          +
                                          [link](foo\(and\(bar\))
                                           .
                                           <p><a href="foo(and(bar)">link</a></p>
                                          -
                                          [link](<foo(and(bar)>)
                                          +
                                          [link](<foo(and(bar)>)
                                           .
                                           <p><a href="foo(and(bar)">link</a></p>
                                          -

                                          Parentheses and other symbols can also be escaped, as usual +

                                          Parentheses and other symbols can also be escaped, as usual in Markdown:

                                          -
                                          [link](foo\)\:)
                                          +
                                          [link](foo\)\:)
                                           .
                                           <p><a href="foo):">link</a></p>
                                          -

                                          A link can contain fragment identifiers and queries:

                                          +

                                          A link can contain fragment identifiers and queries:

                                          -
                                          [link](#fragment)
                                          +
                                          [link](#fragment)
                                           
                                           [link](http://example.com#fragment)
                                           
                                          @@ -6802,15 +6799,15 @@ in Markdown:

                                          <p><a href="http://example.com?foo=3#frag">link</a></p>
                                          -

                                          Note that a backslash before a non-escapable character is +

                                          Note that a backslash before a non-escapable character is just a backslash:

                                          -
                                          [link](foo\bar)
                                          +
                                          [link](foo\bar)
                                           .
                                           <p><a href="foo%5Cbar">link</a></p>
                                          -

                                          URL-escaping should be left alone inside the destination, as all +

                                          URL-escaping should be left alone inside the destination, as all URL-escaped characters are also valid URL characters. Entity and numerical character references in the destination will be parsed into the corresponding Unicode code points, as usual. These may @@ -6819,23 +6816,23 @@ does not enforce any particular policy for rendering URLs in HTML or other formats. Renderers may make different decisions about how to escape or normalize URLs in the output.

                                          -
                                          [link](foo%20b&auml;)
                                          +
                                          [link](foo%20b&auml;)
                                           .
                                           <p><a href="foo%20b%C3%A4">link</a></p>
                                          -

                                          Note that, because titles can often be parsed as destinations, +

                                          Note that, because titles can often be parsed as destinations, if you try to omit the destination and keep the title, you'll get unexpected results:

                                          -
                                          [link]("title")
                                          +
                                          [link]("title")
                                           .
                                           <p><a href="%22title%22">link</a></p>
                                          -

                                          Titles may be in single quotes, double quotes, or parentheses:

                                          +

                                          Titles may be in single quotes, double quotes, or parentheses:

                                          -
                                          [link](/url "title")
                                          +
                                          [link](/url "title")
                                           [link](/url 'title')
                                           [link](/url (title))
                                           .
                                          @@ -6844,37 +6841,37 @@ get unexpected results:

                                          <a href="/url" title="title">link</a></p>
                                          -

                                          Backslash escapes and entity and numeric character references +

                                          Backslash escapes and entity and numeric character references may be used in titles:

                                          -
                                          [link](/url "title \"&quot;")
                                          +
                                          [link](/url "title \"&quot;")
                                           .
                                           <p><a href="/url" title="title &quot;&quot;">link</a></p>
                                          -

                                          Titles must be separated from the link using a [whitespace]. +

                                          Titles must be separated from the link using a [whitespace]. Other [Unicode whitespace] like non-breaking space doesn't work.

                                          -
                                          [link](/url "title")
                                          +
                                          [link](/url "title")
                                           .
                                           <p><a href="/url%C2%A0%22title%22">link</a></p>
                                          -

                                          Nested balanced quotes are not allowed without escaping:

                                          +

                                          Nested balanced quotes are not allowed without escaping:

                                          -
                                          [link](/url "title "and" title")
                                          +
                                          [link](/url "title "and" title")
                                           .
                                           <p>[link](/url &quot;title &quot;and&quot; title&quot;)</p>
                                          -

                                          But it is easy to work around this by using a different quote type:

                                          +

                                          But it is easy to work around this by using a different quote type:

                                          -
                                          [link](/url 'title "and" title')
                                          +
                                          [link](/url 'title "and" title')
                                           .
                                           <p><a href="/url" title="title &quot;and&quot; title">link</a></p>
                                          -

                                          (Note: Markdown.pl did allow double quotes inside a double-quoted +

                                          (Note: Markdown.pl did allow double quotes inside a double-quoted title, and its test suite included a test demonstrating this. But it is hard to see a good rationale for the extra complexity this brings, since there are already many ways---backslash escaping, @@ -6888,136 +6885,136 @@ with " and end with ). Markdown.pl 1.0.1 titles with no closing quotation mark, though 1.0.2b8 does not. It seems preferable to adopt a simple, rational rule that works the same way in inline links and link reference definitions.)

                                          -

                                          [Whitespace] is allowed around the destination and title:

                                          +

                                          [Whitespace] is allowed around the destination and title:

                                          -
                                          [link](   /uri
                                          +
                                          [link](   /uri
                                             "title"  )
                                           .
                                           <p><a href="/uri" title="title">link</a></p>
                                          -

                                          But it is not allowed between the link text and the +

                                          But it is not allowed between the link text and the following parenthesis:

                                          -
                                          [link] (/uri)
                                          +
                                          [link] (/uri)
                                           .
                                           <p>[link] (/uri)</p>
                                          -

                                          The link text may contain balanced brackets, but not unbalanced ones, +

                                          The link text may contain balanced brackets, but not unbalanced ones, unless they are escaped:

                                          -
                                          [link [foo [bar]]](/uri)
                                          +
                                          [link [foo [bar]]](/uri)
                                           .
                                           <p><a href="/uri">link [foo [bar]]</a></p>
                                          -
                                          [link] bar](/uri)
                                          +
                                          [link] bar](/uri)
                                           .
                                           <p>[link] bar](/uri)</p>
                                          -
                                          [link [bar](/uri)
                                          +
                                          [link [bar](/uri)
                                           .
                                           <p>[link <a href="/uri">bar</a></p>
                                          -
                                          [link \[bar](/uri)
                                          +
                                          [link \[bar](/uri)
                                           .
                                           <p><a href="/uri">link [bar</a></p>
                                          -

                                          The link text may contain inline content:

                                          +

                                          The link text may contain inline content:

                                          -
                                          [link *foo **bar** `#`*](/uri)
                                          +
                                          [link *foo **bar** `#`*](/uri)
                                           .
                                           <p><a href="/uri">link <em>foo <strong>bar</strong> <code>#</code></em></a></p>
                                          -
                                          [![moon](moon.jpg)](/uri)
                                          +
                                          [![moon](moon.jpg)](/uri)
                                           .
                                           <p><a href="/uri"><img src="moon.jpg" alt="moon" /></a></p>
                                          -

                                          However, links may not contain other links, at any level of nesting.

                                          +

                                          However, links may not contain other links, at any level of nesting.

                                          -
                                          [foo [bar](/uri)](/uri)
                                          +
                                          [foo [bar](/uri)](/uri)
                                           .
                                           <p>[foo <a href="/uri">bar</a>](/uri)</p>
                                          -
                                          [foo *[bar [baz](/uri)](/uri)*](/uri)
                                          +
                                          [foo *[bar [baz](/uri)](/uri)*](/uri)
                                           .
                                           <p>[foo <em>[bar <a href="/uri">baz</a>](/uri)</em>](/uri)</p>
                                          -
                                          ![[[foo](uri1)](uri2)](uri3)
                                          +
                                          ![[[foo](uri1)](uri2)](uri3)
                                           .
                                           <p><img src="uri3" alt="[foo](uri2)" /></p>
                                          -

                                          These cases illustrate the precedence of link text grouping over +

                                          These cases illustrate the precedence of link text grouping over emphasis grouping:

                                          -
                                          *[foo*](/uri)
                                          +
                                          *[foo*](/uri)
                                           .
                                           <p>*<a href="/uri">foo*</a></p>
                                          -
                                          [foo *bar](baz*)
                                          +
                                          [foo *bar](baz*)
                                           .
                                           <p><a href="baz*">foo *bar</a></p>
                                          -

                                          Note that brackets that aren't part of links do not take +

                                          Note that brackets that aren't part of links do not take precedence:

                                          -
                                          *foo [bar* baz]
                                          +
                                          *foo [bar* baz]
                                           .
                                           <p><em>foo [bar</em> baz]</p>
                                          -

                                          These cases illustrate the precedence of HTML tags, code spans, +

                                          These cases illustrate the precedence of HTML tags, code spans, and autolinks over link grouping:

                                          -
                                          [foo <bar attr="](baz)">
                                          +
                                          [foo <bar attr="](baz)">
                                           .
                                           <p>[foo <bar attr="](baz)"></p>
                                          -
                                          [foo`](/uri)`
                                          +
                                          [foo`](/uri)`
                                           .
                                           <p>[foo<code>](/uri)</code></p>
                                          -
                                          [foo<http://example.com/?search=](uri)>
                                          +
                                          [foo<http://example.com/?search=](uri)>
                                           .
                                           <p>[foo<a href="http://example.com/?search=%5D(uri)">http://example.com/?search=](uri)</a></p>
                                          -

                                          There are three kinds of reference links: +

                                          There are three kinds of reference links: full, collapsed, and shortcut.

                                          -

                                          A full reference link +

                                          A full reference link consists of a [link text] immediately followed by a [link label] that [matches] a [link reference definition] elsewhere in the document.

                                          -

                                          A link label begins with a left bracket ([) and ends +

                                          A link label begins with a left bracket ([) and ends with the first right bracket (]) that is not backslash-escaped. Between these brackets there must be at least one [non-whitespace character]. Unescaped square bracket characters are not allowed inside the opening and closing square brackets of [link labels]. A link label can have at most 999 characters inside the square brackets.

                                          -

                                          One label matches +

                                          One label matches another just in case their normalized forms are equal. To normalize a label, strip off the opening and closing brackets, perform the Unicode case fold, strip leading and trailing @@ -7025,24 +7022,24 @@ perform the Unicode case fold, strip leading and trailing [whitespace] to a single space. If there are multiple matching reference link definitions, the one that comes first in the document is used. (It is desirable in such cases to emit a warning.)

                                          -

                                          The contents of the first link label are parsed as inlines, which are +

                                          The contents of the first link label are parsed as inlines, which are used as the link's text. The link's URI and title are provided by the matching [link reference definition].

                                          -

                                          Here is a simple example:

                                          +

                                          Here is a simple example:

                                          -
                                          [foo][bar]
                                          +
                                          [foo][bar]
                                           
                                           [bar]: /url "title"
                                           .
                                           <p><a href="/url" title="title">foo</a></p>
                                          -

                                          The rules for the [link text] are the same as with +

                                          The rules for the [link text] are the same as with [inline links]. Thus:

                                          -

                                          The link text may contain balanced brackets, but not unbalanced ones, +

                                          The link text may contain balanced brackets, but not unbalanced ones, unless they are escaped:

                                          -
                                          [link [foo [bar]]][ref]
                                          +
                                          [link [foo [bar]]][ref]
                                           
                                           [ref]: /uri
                                           .
                                          @@ -7050,16 +7047,16 @@ unless they are escaped:

                                          -
                                          [link \[bar][ref]
                                          +
                                          [link \[bar][ref]
                                           
                                           [ref]: /uri
                                           .
                                           <p><a href="/uri">link [bar</a></p>
                                          -

                                          The link text may contain inline content:

                                          +

                                          The link text may contain inline content:

                                          -
                                          [link *foo **bar** `#`*][ref]
                                          +
                                          [link *foo **bar** `#`*][ref]
                                           
                                           [ref]: /uri
                                           .
                                          @@ -7067,16 +7064,16 @@ unless they are escaped:

                                          -
                                          [![moon](moon.jpg)][ref]
                                          +
                                          [![moon](moon.jpg)][ref]
                                           
                                           [ref]: /uri
                                           .
                                           <p><a href="/uri"><img src="moon.jpg" alt="moon" /></a></p>
                                          -

                                          However, links may not contain other links, at any level of nesting.

                                          +

                                          However, links may not contain other links, at any level of nesting.

                                          -
                                          [foo [bar](/uri)][ref]
                                          +
                                          [foo [bar](/uri)][ref]
                                           
                                           [ref]: /uri
                                           .
                                          @@ -7084,19 +7081,19 @@ unless they are escaped:

                                          -
                                          [foo *bar [baz][ref]*][ref]
                                          +
                                          [foo *bar [baz][ref]*][ref]
                                           
                                           [ref]: /uri
                                           .
                                           <p>[foo <em>bar <a href="/uri">baz</a></em>]<a href="/uri">ref</a></p>
                                          -

                                          (In the examples above, we have two [shortcut reference links] +

                                          (In the examples above, we have two [shortcut reference links] instead of one [full reference link].)

                                          -

                                          The following cases illustrate the precedence of link text grouping over +

                                          The following cases illustrate the precedence of link text grouping over emphasis grouping:

                                          -
                                          *[foo*][ref]
                                          +
                                          *[foo*][ref]
                                           
                                           [ref]: /uri
                                           .
                                          @@ -7104,17 +7101,17 @@ emphasis grouping:

                                          -
                                          [foo *bar][ref]
                                          +
                                          [foo *bar][ref]
                                           
                                           [ref]: /uri
                                           .
                                           <p><a href="/uri">foo *bar</a></p>
                                          -

                                          These cases illustrate the precedence of HTML tags, code spans, +

                                          These cases illustrate the precedence of HTML tags, code spans, and autolinks over link grouping:

                                          -
                                          [foo <bar attr="][ref]">
                                          +
                                          [foo <bar attr="][ref]">
                                           
                                           [ref]: /uri
                                           .
                                          @@ -7122,7 +7119,7 @@ and autolinks over link grouping:

                                          -
                                          [foo`][ref]`
                                          +
                                          [foo`][ref]`
                                           
                                           [ref]: /uri
                                           .
                                          @@ -7130,35 +7127,35 @@ and autolinks over link grouping:

                                          -
                                          [foo<http://example.com/?search=][ref]>
                                          +
                                          [foo<http://example.com/?search=][ref]>
                                           
                                           [ref]: /uri
                                           .
                                           <p>[foo<a href="http://example.com/?search=%5D%5Bref%5D">http://example.com/?search=][ref]</a></p>
                                          -

                                          Matching is case-insensitive:

                                          +

                                          Matching is case-insensitive:

                                          -
                                          [foo][BaR]
                                          +
                                          [foo][BaR]
                                           
                                           [bar]: /url "title"
                                           .
                                           <p><a href="/url" title="title">foo</a></p>
                                          -

                                          Unicode case fold is used:

                                          +

                                          Unicode case fold is used:

                                          -
                                          [Толпой][Толпой] is a Russian word.
                                          +
                                          [Толпой][Толпой] is a Russian word.
                                           
                                           [ТОЛПОЙ]: /url
                                           .
                                           <p><a href="/url">Толпой</a> is a Russian word.</p>
                                          -

                                          Consecutive internal [whitespace] is treated as one space for +

                                          Consecutive internal [whitespace] is treated as one space for purposes of determining matching:

                                          -
                                          [Foo
                                          +
                                          [Foo
                                             bar]: /url
                                           
                                           [Baz][Foo bar]
                                          @@ -7166,10 +7163,10 @@ purposes of determining matching:

                                          <p><a href="/url">Baz</a></p>
                                          -

                                          No [whitespace] is allowed between the [link text] and the +

                                          No [whitespace] is allowed between the [link text] and the [link label]:

                                          -
                                          [foo] [bar]
                                          +
                                          [foo] [bar]
                                           
                                           [bar]: /url "title"
                                           .
                                          @@ -7177,7 +7174,7 @@ purposes of determining matching:

                                          -
                                          [foo]
                                          +
                                          [foo]
                                           [bar]
                                           
                                           [bar]: /url "title"
                                          @@ -7186,7 +7183,7 @@ purposes of determining matching:

                                          <a href="/url" title="title">bar</a></p>
                                          -

                                          This is a departure from John Gruber's original Markdown syntax +

                                          This is a departure from John Gruber's original Markdown syntax description, which explicitly allows whitespace between the link text and the link label. It brings reference links in line with [inline links], which (according to both original Markdown and @@ -7197,24 +7194,24 @@ link text and the link label, then in the following we will have a single reference link, not two shortcut reference links, as intended:

                                          -
                                          [foo]
                                          +
                                          [foo]
                                           [bar]
                                           
                                           [foo]: /url1
                                           [bar]: /url2
                                          -

                                          (Note that [shortcut reference links] were introduced by Gruber +

                                          (Note that [shortcut reference links] were introduced by Gruber himself in a beta version of Markdown.pl, but never included in the official syntax description. Without shortcut reference links, it is harmless to allow space between the link text and link label; but once shortcut references are introduced, it is too dangerous to allow this, as it frequently leads to unintended results.)

                                          -

                                          When there are multiple matching [link reference definitions], +

                                          When there are multiple matching [link reference definitions], the first is used:

                                          -
                                          [foo]: /url1
                                          +
                                          [foo]: /url1
                                           
                                           [foo]: /url2
                                           
                                          @@ -7223,21 +7220,21 @@ the first is used:

                                          <p><a href="/url1">bar</a></p>
                                          -

                                          Note that matching is performed on normalized strings, not parsed +

                                          Note that matching is performed on normalized strings, not parsed inline content. So the following does not match, even though the labels define equivalent inline content:

                                          -
                                          [bar][foo\!]
                                          +
                                          [bar][foo\!]
                                           
                                           [foo!]: /url
                                           .
                                           <p>[bar][foo!]</p>
                                          -

                                          [Link labels] cannot contain brackets, unless they are +

                                          [Link labels] cannot contain brackets, unless they are backslash-escaped:

                                          -
                                          [foo][ref[]
                                          +
                                          [foo][ref[]
                                           
                                           [ref[]: /uri
                                           .
                                          @@ -7246,7 +7243,7 @@ backslash-escaped:

                                          -
                                          [foo][ref[bar]]
                                          +
                                          [foo][ref[bar]]
                                           
                                           [ref[bar]]: /uri
                                           .
                                          @@ -7255,7 +7252,7 @@ backslash-escaped:

                                          -
                                          [[[foo]]]
                                          +
                                          [[[foo]]]
                                           
                                           [[[foo]]]: /url
                                           .
                                          @@ -7264,25 +7261,25 @@ backslash-escaped:

                                          -
                                          [foo][ref\[]
                                          +
                                          [foo][ref\[]
                                           
                                           [ref\[]: /uri
                                           .
                                           <p><a href="/uri">foo</a></p>
                                          -

                                          Note that in this example ] is not backslash-escaped:

                                          +

                                          Note that in this example ] is not backslash-escaped:

                                          -
                                          [bar\\]: /uri
                                          +
                                          [bar\\]: /uri
                                           
                                           [bar\\]
                                           .
                                           <p><a href="/uri">bar\</a></p>
                                          -

                                          A [link label] must contain at least one [non-whitespace character]:

                                          +

                                          A [link label] must contain at least one [non-whitespace character]:

                                          -
                                          []
                                          +
                                          []
                                           
                                           []: /uri
                                           .
                                          @@ -7291,7 +7288,7 @@ backslash-escaped:

                                          -
                                          [
                                          +
                                          [
                                            ]
                                           
                                           [
                                          @@ -7303,7 +7300,7 @@ backslash-escaped:

                                          ]: /uri</p>
                                          -

                                          A collapsed reference link +

                                          A collapsed reference link consists of a [link label] that [matches] a [link reference definition] elsewhere in the document, followed by the string []. @@ -7312,7 +7309,7 @@ which are used as the link's text. The link's URI and title are provided by the matching reference link definition. Thus, [foo][] is equivalent to [foo][foo].

                                          -
                                          [foo][]
                                          +
                                          [foo][]
                                           
                                           [foo]: /url "title"
                                           .
                                          @@ -7320,26 +7317,26 @@ provided by the matching reference link definition.  Thus,
                                           
                                           
                                          -
                                          [*foo* bar][]
                                          +
                                          [*foo* bar][]
                                           
                                           [*foo* bar]: /url "title"
                                           .
                                           <p><a href="/url" title="title"><em>foo</em> bar</a></p>
                                          -

                                          The link labels are case-insensitive:

                                          +

                                          The link labels are case-insensitive:

                                          -
                                          [Foo][]
                                          +
                                          [Foo][]
                                           
                                           [foo]: /url "title"
                                           .
                                           <p><a href="/url" title="title">Foo</a></p>
                                          -

                                          As with full reference links, [whitespace] is not +

                                          As with full reference links, [whitespace] is not allowed between the two sets of brackets:

                                          -
                                          [foo] 
                                          +
                                          [foo] 
                                           []
                                           
                                           [foo]: /url "title"
                                          @@ -7348,7 +7345,7 @@ allowed between the two sets of brackets:

                                          []</p>
                                          -

                                          A shortcut reference link +

                                          A shortcut reference link consists of a [link label] that [matches] a [link reference definition] elsewhere in the document and is not followed by [] or a link label. @@ -7357,7 +7354,7 @@ which are used as the link's text. The link's URI and title are provided by the matching link reference definition. Thus, [foo] is equivalent to [foo][].

                                          -
                                          [foo]
                                          +
                                          [foo]
                                           
                                           [foo]: /url "title"
                                           .
                                          @@ -7365,7 +7362,7 @@ Thus, [foo] is equivalent to [foo][].

                                          -
                                          [*foo* bar]
                                          +
                                          [*foo* bar]
                                           
                                           [*foo* bar]: /url "title"
                                           .
                                          @@ -7373,7 +7370,7 @@ Thus, [foo] is equivalent to [foo][].

                                          -
                                          [[*foo* bar]]
                                          +
                                          [[*foo* bar]]
                                           
                                           [*foo* bar]: /url "title"
                                           .
                                          @@ -7381,55 +7378,55 @@ Thus, [foo] is equivalent to [foo][].

                                          -
                                          [[bar [foo]
                                          +
                                          [[bar [foo]
                                           
                                           [foo]: /url
                                           .
                                           <p>[[bar <a href="/url">foo</a></p>
                                          -

                                          The link labels are case-insensitive:

                                          +

                                          The link labels are case-insensitive:

                                          -
                                          [Foo]
                                          +
                                          [Foo]
                                           
                                           [foo]: /url "title"
                                           .
                                           <p><a href="/url" title="title">Foo</a></p>
                                          -

                                          A space after the link text should be preserved:

                                          +

                                          A space after the link text should be preserved:

                                          -
                                          [foo] bar
                                          +
                                          [foo] bar
                                           
                                           [foo]: /url
                                           .
                                           <p><a href="/url">foo</a> bar</p>
                                          -

                                          If you just want bracketed text, you can backslash-escape the +

                                          If you just want bracketed text, you can backslash-escape the opening bracket to avoid links:

                                          -
                                          \[foo]
                                          +
                                          \[foo]
                                           
                                           [foo]: /url "title"
                                           .
                                           <p>[foo]</p>
                                          -

                                          Note that this is a link, because a link label ends with the first +

                                          Note that this is a link, because a link label ends with the first following closing bracket:

                                          -
                                          [foo*]: /url
                                          +
                                          [foo*]: /url
                                           
                                           *[foo*]
                                           .
                                           <p>*<a href="/url">foo*</a></p>
                                          -

                                          Full and compact references take precedence over shortcut +

                                          Full and compact references take precedence over shortcut references:

                                          -
                                          [foo][bar]
                                          +
                                          [foo][bar]
                                           
                                           [foo]: /url1
                                           [bar]: /url2
                                          @@ -7438,16 +7435,16 @@ references:

                                          -
                                          [foo][]
                                          +
                                          [foo][]
                                           
                                           [foo]: /url1
                                           .
                                           <p><a href="/url1">foo</a></p>
                                          -

                                          Inline links also take precedence:

                                          +

                                          Inline links also take precedence:

                                          -
                                          [foo]()
                                          +
                                          [foo]()
                                           
                                           [foo]: /url1
                                           .
                                          @@ -7455,27 +7452,27 @@ references:

                                          -
                                          [foo](not a link)
                                          +
                                          [foo](not a link)
                                           
                                           [foo]: /url1
                                           .
                                           <p><a href="/url1">foo</a>(not a link)</p>
                                          -

                                          In the following case [bar][baz] is parsed as a reference, +

                                          In the following case [bar][baz] is parsed as a reference, [foo] as normal text:

                                          -
                                          [foo][bar][baz]
                                          +
                                          [foo][bar][baz]
                                           
                                           [baz]: /url
                                           .
                                           <p>[foo]<a href="/url">bar</a></p>
                                          -

                                          Here, though, [foo][bar] is parsed as a reference, since +

                                          Here, though, [foo][bar] is parsed as a reference, since [bar] is defined:

                                          -
                                          [foo][bar][baz]
                                          +
                                          [foo][bar][baz]
                                           
                                           [baz]: /url1
                                           [bar]: /url2
                                          @@ -7483,10 +7480,10 @@ references:

                                          <p><a href="/url2">foo</a><a href="/url1">baz</a></p>
                                          -

                                          Here [foo] is not parsed as a shortcut reference, because it +

                                          Here [foo] is not parsed as a shortcut reference, because it is followed by a link label (even though [bar] is not defined):

                                          -
                                          [foo][bar][baz]
                                          +
                                          [foo][bar][baz]
                                           
                                           [baz]: /url1
                                           [foo]: /url2
                                          @@ -7494,9 +7491,9 @@ is followed by a link label (even though [bar] is not defined):

                                          <p>[foo]<a href="/url1">bar</a></p>
                                          -

                                          +

                                          Images

                                          -

                                          Syntax for images is like the syntax for links, with one +

                                          Syntax for images is like the syntax for links, with one difference. Instead of [link text], we have an image description. The rules for this are the same as for [link text], except that (a) an @@ -7506,13 +7503,13 @@ An image description has inline elements as its contents. When an image is rendered to HTML, this is standardly used as the image's alt attribute.

                                          -
                                          ![foo](/url "title")
                                          +
                                          ![foo](/url "title")
                                           .
                                           <p><img src="/url" alt="foo" title="title" /></p>
                                          -
                                          ![foo *bar*]
                                          +
                                          ![foo *bar*]
                                           
                                           [foo *bar*]: train.jpg "train & tracks"
                                           .
                                          @@ -7520,24 +7517,24 @@ this is standardly used as the image's alt attribute.

                                          -
                                          ![foo ![bar](/url)](/url2)
                                          +
                                          ![foo ![bar](/url)](/url2)
                                           .
                                           <p><img src="/url2" alt="foo bar" /></p>
                                          -
                                          ![foo [bar](/url)](/url2)
                                          +
                                          ![foo [bar](/url)](/url2)
                                           .
                                           <p><img src="/url2" alt="foo bar" /></p>
                                          -

                                          Though this spec is concerned with parsing, not rendering, it is +

                                          Though this spec is concerned with parsing, not rendering, it is recommended that in rendering to HTML, only the plain string content of the [image description] be used. Note that in the above example, the alt attribute's value is foo bar, not foo [bar](/url) or foo <a href="/url">bar</a>. Only the plain string content is rendered, without formatting.

                                          -
                                          ![foo *bar*][]
                                          +
                                          ![foo *bar*][]
                                           
                                           [foo *bar*]: train.jpg "train & tracks"
                                           .
                                          @@ -7545,7 +7542,7 @@ content is rendered, without formatting.

                                          -
                                          ![foo *bar*][foobar]
                                          +
                                          ![foo *bar*][foobar]
                                           
                                           [FOOBAR]: train.jpg "train & tracks"
                                           .
                                          @@ -7553,32 +7550,32 @@ content is rendered, without formatting.

                                          -
                                          ![foo](train.jpg)
                                          +
                                          ![foo](train.jpg)
                                           .
                                           <p><img src="train.jpg" alt="foo" /></p>
                                          -
                                          My ![foo bar](/path/to/train.jpg  "title"   )
                                          +
                                          My ![foo bar](/path/to/train.jpg  "title"   )
                                           .
                                           <p>My <img src="/path/to/train.jpg" alt="foo bar" title="title" /></p>
                                          -
                                          ![foo](<url>)
                                          +
                                          ![foo](<url>)
                                           .
                                           <p><img src="url" alt="foo" /></p>
                                          -
                                          ![](/url)
                                          +
                                          ![](/url)
                                           .
                                           <p><img src="/url" alt="" /></p>
                                          -

                                          Reference-style:

                                          +

                                          Reference-style:

                                          -
                                          ![foo][bar]
                                          +
                                          ![foo][bar]
                                           
                                           [bar]: /url
                                           .
                                          @@ -7586,16 +7583,16 @@ content is rendered, without formatting.

                                          -
                                          ![foo][bar]
                                          +
                                          ![foo][bar]
                                           
                                           [BAR]: /url
                                           .
                                           <p><img src="/url" alt="foo" /></p>
                                          -

                                          Collapsed:

                                          +

                                          Collapsed:

                                          -
                                          ![foo][]
                                          +
                                          ![foo][]
                                           
                                           [foo]: /url "title"
                                           .
                                          @@ -7603,26 +7600,26 @@ content is rendered, without formatting.

                                          -
                                          ![*foo* bar][]
                                          +
                                          ![*foo* bar][]
                                           
                                           [*foo* bar]: /url "title"
                                           .
                                           <p><img src="/url" alt="foo bar" title="title" /></p>
                                          -

                                          The labels are case-insensitive:

                                          +

                                          The labels are case-insensitive:

                                          -
                                          ![Foo][]
                                          +
                                          ![Foo][]
                                           
                                           [foo]: /url "title"
                                           .
                                           <p><img src="/url" alt="Foo" title="title" /></p>
                                          -

                                          As with reference links, [whitespace] is not allowed +

                                          As with reference links, [whitespace] is not allowed between the two sets of brackets:

                                          -
                                          ![foo] 
                                          +
                                          ![foo] 
                                           []
                                           
                                           [foo]: /url "title"
                                          @@ -7631,9 +7628,9 @@ between the two sets of brackets:

                                          []</p>
                                          -

                                          Shortcut:

                                          +

                                          Shortcut:

                                          -
                                          ![foo]
                                          +
                                          ![foo]
                                           
                                           [foo]: /url "title"
                                           .
                                          @@ -7641,16 +7638,16 @@ between the two sets of brackets:

                                          -
                                          ![*foo* bar]
                                          +
                                          ![*foo* bar]
                                           
                                           [*foo* bar]: /url "title"
                                           .
                                           <p><img src="/url" alt="foo bar" title="title" /></p>
                                          -

                                          Note that link labels cannot contain unescaped brackets:

                                          +

                                          Note that link labels cannot contain unescaped brackets:

                                          -
                                          ![[foo]]
                                          +
                                          ![[foo]]
                                           
                                           [[foo]]: /url "title"
                                           .
                                          @@ -7658,228 +7655,228 @@ between the two sets of brackets:

                                          <p>[[foo]]: /url &quot;title&quot;</p>
                                          -

                                          The link labels are case-insensitive:

                                          +

                                          The link labels are case-insensitive:

                                          -
                                          ![Foo]
                                          +
                                          ![Foo]
                                           
                                           [foo]: /url "title"
                                           .
                                           <p><img src="/url" alt="Foo" title="title" /></p>
                                          -

                                          If you just want a literal ! followed by bracketed text, you can +

                                          If you just want a literal ! followed by bracketed text, you can backslash-escape the opening [:

                                          -
                                          !\[foo]
                                          +
                                          !\[foo]
                                           
                                           [foo]: /url "title"
                                           .
                                           <p>![foo]</p>
                                          -

                                          If you want a link after a literal !, backslash-escape the +

                                          If you want a link after a literal !, backslash-escape the !:

                                          -
                                          \![foo]
                                          +
                                          \![foo]
                                           
                                           [foo]: /url "title"
                                           .
                                           <p>!<a href="/url" title="title">foo</a></p>
                                          -

                                          +

                                          Autolinks

                                          -

                                          Autolinks are absolute URIs and email addresses inside +

                                          Autolinks are absolute URIs and email addresses inside < and >. They are parsed as links, with the URL or email address as the link label.

                                          -

                                          A URI autolink consists of <, followed by an +

                                          A URI autolink consists of <, followed by an [absolute URI] followed by >. It is parsed as a link to the URI, with the URI as the link's label.

                                          -

                                          An absolute URI, +

                                          An absolute URI, for these purposes, consists of a [scheme] followed by a colon (:) followed by zero or more characters other than ASCII [whitespace] and control characters, <, and >. If the URI includes these characters, they must be percent-encoded (e.g. %20 for a space).

                                          -

                                          For purposes of this spec, a scheme is any sequence +

                                          For purposes of this spec, a scheme is any sequence of 2--32 characters beginning with an ASCII letter and followed by any combination of ASCII letters, digits, or the symbols plus ("+"), period ("."), or hyphen ("-").

                                          -

                                          Here are some valid autolinks:

                                          +

                                          Here are some valid autolinks:

                                          -
                                          <http://foo.bar.baz>
                                          +
                                          <http://foo.bar.baz>
                                           .
                                           <p><a href="http://foo.bar.baz">http://foo.bar.baz</a></p>
                                          -
                                          <http://foo.bar.baz/test?q=hello&id=22&boolean>
                                          +
                                          <http://foo.bar.baz/test?q=hello&id=22&boolean>
                                           .
                                           <p><a href="http://foo.bar.baz/test?q=hello&amp;id=22&amp;boolean">http://foo.bar.baz/test?q=hello&amp;id=22&amp;boolean</a></p>
                                          -
                                          <irc://foo.bar:2233/baz>
                                          +
                                          <irc://foo.bar:2233/baz>
                                           .
                                           <p><a href="irc://foo.bar:2233/baz">irc://foo.bar:2233/baz</a></p>
                                          -

                                          Uppercase is also fine:

                                          +

                                          Uppercase is also fine:

                                          -
                                          <MAILTO:FOO@BAR.BAZ>
                                          +
                                          <MAILTO:FOO@BAR.BAZ>
                                           .
                                           <p><a href="MAILTO:FOO@BAR.BAZ">MAILTO:FOO@BAR.BAZ</a></p>
                                          -

                                          Note that many strings that count as [absolute URIs] for +

                                          Note that many strings that count as [absolute URIs] for purposes of this spec are not valid URIs, because their schemes are not registered or because of other problems with their syntax:

                                          -
                                          <a+b+c:d>
                                          +
                                          <a+b+c:d>
                                           .
                                           <p><a href="a+b+c:d">a+b+c:d</a></p>
                                          -
                                          <made-up-scheme://foo,bar>
                                          +
                                          <made-up-scheme://foo,bar>
                                           .
                                           <p><a href="made-up-scheme://foo,bar">made-up-scheme://foo,bar</a></p>
                                          -
                                          <http://../>
                                          +
                                          <http://../>
                                           .
                                           <p><a href="http://../">http://../</a></p>
                                          -
                                          <localhost:5001/foo>
                                          +
                                          <localhost:5001/foo>
                                           .
                                           <p><a href="localhost:5001/foo">localhost:5001/foo</a></p>
                                          -

                                          Spaces are not allowed in autolinks:

                                          +

                                          Spaces are not allowed in autolinks:

                                          -
                                          <http://foo.bar/baz bim>
                                          +
                                          <http://foo.bar/baz bim>
                                           .
                                           <p>&lt;http://foo.bar/baz bim&gt;</p>
                                          -

                                          Backslash-escapes do not work inside autolinks:

                                          +

                                          Backslash-escapes do not work inside autolinks:

                                          -
                                          <http://example.com/\[\>
                                          +
                                          <http://example.com/\[\>
                                           .
                                           <p><a href="http://example.com/%5C%5B%5C">http://example.com/\[\</a></p>
                                          -

                                          An email autolink +

                                          An email autolink consists of <, followed by an [email address], followed by >. The link's label is the email address, and the URL is mailto: followed by the email address.

                                          -

                                          An email address, +

                                          An email address, for these purposes, is anything that matches the non-normative regex from the HTML5 spec:

                                          -
                                          /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?
                                          +
                                          /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?
                                           (?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/
                                          -

                                          Examples of email autolinks:

                                          +

                                          Examples of email autolinks:

                                          -
                                          <foo@bar.example.com>
                                          +
                                          <foo@bar.example.com>
                                           .
                                           <p><a href="mailto:foo@bar.example.com">foo@bar.example.com</a></p>
                                          -
                                          <foo+special@Bar.baz-bar0.com>
                                          +
                                          <foo+special@Bar.baz-bar0.com>
                                           .
                                           <p><a href="mailto:foo+special@Bar.baz-bar0.com">foo+special@Bar.baz-bar0.com</a></p>
                                          -

                                          Backslash-escapes do not work inside email autolinks:

                                          +

                                          Backslash-escapes do not work inside email autolinks:

                                          -
                                          <foo\+@bar.example.com>
                                          +
                                          <foo\+@bar.example.com>
                                           .
                                           <p>&lt;foo+@bar.example.com&gt;</p>
                                          -

                                          These are not autolinks:

                                          +

                                          These are not autolinks:

                                          -
                                          <>
                                          +
                                          <>
                                           .
                                           <p>&lt;&gt;</p>
                                          -
                                          < http://foo.bar >
                                          +
                                          < http://foo.bar >
                                           .
                                           <p>&lt; http://foo.bar &gt;</p>
                                          -
                                          <m:abc>
                                          +
                                          <m:abc>
                                           .
                                           <p>&lt;m:abc&gt;</p>
                                          -
                                          <foo.bar.baz>
                                          +
                                          <foo.bar.baz>
                                           .
                                           <p>&lt;foo.bar.baz&gt;</p>
                                          -
                                          http://example.com
                                          +
                                          http://example.com
                                           .
                                           <p>http://example.com</p>
                                          -
                                          foo@bar.example.com
                                          +
                                          foo@bar.example.com
                                           .
                                           <p>foo@bar.example.com</p>
                                          -

                                          +

                                          Autolinks (extension)

                                          -

                                          GFM enables the autolink extension, where autolinks will be recognised in a +

                                          GFM enables the autolink extension, where autolinks will be recognised in a greater number of conditions.

                                          -

                                          [Autolink]s can also be constructed without requiring the use of < and to > +

                                          [Autolink]s can also be constructed without requiring the use of < and to > to delimit them, although they will be recognized under a smaller set of circumstances. All such recognized autolinks can only come at the beginning of a line, after whitespace, or any of the delimiting characters *, _, ~, and (.

                                          -

                                          An extended www autolink will be recognized +

                                          An extended www autolink will be recognized when the text www. is found followed by a [valid domain]. A valid domain consists of segments of alphanumeric characters, underscores (_) and hyphens (-) separated by periods (.). There must be at least one period, and no underscores may be present in the last two segments of the domain.

                                          -

                                          The scheme http will be inserted automatically:

                                          +

                                          The scheme http will be inserted automatically:

                                          -
                                          www.commonmark.org
                                          +
                                          www.commonmark.org
                                           .
                                           <p><a href="http://www.commonmark.org">www.commonmark.org</a></p>
                                          -

                                          After a [valid domain], zero or more non-space non-< characters may follow:

                                          +

                                          After a [valid domain], zero or more non-space non-< characters may follow:

                                          -
                                          Visit www.commonmark.org/help for more information.
                                          +
                                          Visit www.commonmark.org/help for more information.
                                           .
                                           <p>Visit <a href="http://www.commonmark.org/help">www.commonmark.org/help</a> for more information.</p>
                                          -

                                          We then apply extended autolink path validation as follows:

                                          -

                                          Trailing punctuation (specifically, ?, !, ., ,, :, *, _, and ~) +

                                          We then apply extended autolink path validation as follows:

                                          +

                                          Trailing punctuation (specifically, ?, !, ., ,, :, *, _, and ~) will not be considered part of the autolink, though they may be included in the interior of the link:

                                          -
                                          Visit www.commonmark.org.
                                          +
                                          Visit www.commonmark.org.
                                           
                                           Visit www.commonmark.org/a.b.
                                           .
                                          @@ -7887,12 +7884,12 @@ interior of the link:

                                          <p>Visit <a href="http://www.commonmark.org/a.b">www.commonmark.org/a.b</a>.</p>
                                          -

                                          When an autolink ends in ), we scan the entire autolink for the total number +

                                          When an autolink ends in ), we scan the entire autolink for the total number of parentheses. If there is a greater number of closing parentheses than opening ones, we don't consider the unmatched trailing parentheses part of the autolink, in order to facilitate including an autolink inside a parenthesis:

                                          -
                                          www.google.com/search?q=Markup+(business)
                                          +
                                          www.google.com/search?q=Markup+(business)
                                           
                                           www.google.com/search?q=Markup+(business)))
                                           
                                          @@ -7906,21 +7903,21 @@ autolink, in order to facilitate including an autolink inside a parenthesis:

                                          <p>(<a href="http://www.google.com/search?q=Markup+(business)">www.google.com/search?q=Markup+(business)</a></p>
                                          -

                                          This check is only done when the link ends in a closing parentheses ), so if +

                                          This check is only done when the link ends in a closing parentheses ), so if the only parentheses are in the interior of the autolink, no special rules are applied:

                                          -
                                          www.google.com/search?q=(business))+ok
                                          +
                                          www.google.com/search?q=(business))+ok
                                           .
                                           <p><a href="http://www.google.com/search?q=(business))+ok">www.google.com/search?q=(business))+ok</a></p>
                                          -

                                          If an autolink ends in a semicolon (;), we check to see if it appears to +

                                          If an autolink ends in a semicolon (;), we check to see if it appears to resemble an [entity reference][entity references]; if the preceding text is & followed by one or more alphanumeric characters. If so, it is excluded from the autolink:

                                          -
                                          www.google.com/search?q=commonmark&hl=en
                                          +
                                          www.google.com/search?q=commonmark&hl=en
                                           
                                           www.google.com/search?q=commonmark&hl;
                                           .
                                          @@ -7928,19 +7925,19 @@ the autolink:

                                          <p><a href="http://www.google.com/search?q=commonmark">www.google.com/search?q=commonmark</a>&amp;hl;</p>
                                          -

                                          < immediately ends an autolink.

                                          +

                                          < immediately ends an autolink.

                                          -
                                          www.commonmark.org/he<lp
                                          +
                                          www.commonmark.org/he<lp
                                           .
                                           <p><a href="http://www.commonmark.org/he">www.commonmark.org/he</a>&lt;lp</p>
                                          -

                                          An extended url autolink will be recognised when one of the schemes +

                                          An extended url autolink will be recognised when one of the schemes http://, https://, or ftp://, followed by a [valid domain], then zero or more non-space non-< characters according to [extended autolink path validation]:

                                          -
                                          http://commonmark.org
                                          +
                                          http://commonmark.org
                                           
                                           (Visit https://encrypted.google.com/search?q=Markup+(business))
                                           
                                          @@ -7951,36 +7948,36 @@ more non-space non-< characters according to
                                           <p>Anonymous FTP is available at <a href="ftp://foo.bar.baz">ftp://foo.bar.baz</a>.</p>
                                          -

                                          An extended email autolink will be recognised when an email address is +

                                          An extended email autolink will be recognised when an email address is recognised within any text node. Email addresses are recognised according to the following rules:

                                          -
                                            -
                                          • One ore more characters which are alphanumeric, or ., -, _, or +.
                                          • -
                                          • An @ symbol.
                                          • -
                                          • One or more characters which are alphanumeric, or - or _, +
                                              +
                                            • One ore more characters which are alphanumeric, or ., -, _, or +.
                                            • +
                                            • An @ symbol.
                                            • +
                                            • One or more characters which are alphanumeric, or - or _, separated by periods (.). There must be at least one period. The last character must not be one of - or _.
                                            -

                                            The scheme mailto: will automatically be added to the generated link:

                                            +

                                            The scheme mailto: will automatically be added to the generated link:

                                            -
                                            foo@bar.baz
                                            +
                                            foo@bar.baz
                                             .
                                             <p><a href="mailto:foo@bar.baz">foo@bar.baz</a></p>
                                            -

                                            + can occur before the @, but not after.

                                            +

                                            + can occur before the @, but not after.

                                            -
                                            hello@mail+xyz.example isn't valid, but hello+xyz@mail.example is.
                                            +
                                            hello@mail+xyz.example isn't valid, but hello+xyz@mail.example is.
                                             .
                                             <p>hello@mail+xyz.example isn't valid, but <a href="mailto:hello+xyz@mail.example">hello+xyz@mail.example</a> is.</p>
                                            -

                                            ., -, and _ can occur on both sides of the @, but only . may occur at +

                                            ., -, and _ can occur on both sides of the @, but only . may occur at the end of the email address, in which case it will not be considered part of the address:

                                            -
                                            a.b-c_d@a.b
                                            +
                                            a.b-c_d@a.b
                                             
                                             a.b-c_d@a.b.
                                             
                                            @@ -7995,125 +7992,125 @@ the address:

                                          -

                                          +

                                          Raw HTML

                                          -

                                          Text between < and > that looks like an HTML tag is parsed as a +

                                          Text between < and > that looks like an HTML tag is parsed as a raw HTML tag and will be rendered in HTML without escaping. Tag and attribute names are not limited to current HTML tags, so custom tags (and even, say, DocBook tags) may be used.

                                          -

                                          Here is the grammar for tags:

                                          -

                                          A tag name consists of an ASCII letter +

                                          Here is the grammar for tags:

                                          +

                                          A tag name consists of an ASCII letter followed by zero or more ASCII letters, digits, or hyphens (-).

                                          -

                                          An attribute consists of [whitespace], +

                                          An attribute consists of [whitespace], an [attribute name], and an optional [attribute value specification].

                                          -

                                          An attribute name +

                                          An attribute name consists of an ASCII letter, _, or :, followed by zero or more ASCII letters, digits, _, ., :, or -. (Note: This is the XML specification restricted to ASCII. HTML5 is laxer.)

                                          -

                                          An attribute value specification +

                                          An attribute value specification consists of optional [whitespace], a = character, optional [whitespace], and an [attribute value].

                                          -

                                          An attribute value +

                                          An attribute value consists of an [unquoted attribute value], a [single-quoted attribute value], or a [double-quoted attribute value].

                                          -

                                          An unquoted attribute value +

                                          An unquoted attribute value is a nonempty string of characters not including [whitespace], ", ', =, <, >, or `.

                                          -

                                          A single-quoted attribute value +

                                          A single-quoted attribute value consists of ', zero or more characters not including ', and a final '.

                                          -

                                          A double-quoted attribute value +

                                          A double-quoted attribute value consists of ", zero or more characters not including ", and a final ".

                                          -

                                          An open tag consists of a < character, a [tag name], +

                                          An open tag consists of a < character, a [tag name], zero or more [attributes], optional [whitespace], an optional / character, and a > character.

                                          -

                                          A closing tag consists of the string </, a +

                                          A closing tag consists of the string </, a [tag name], optional [whitespace], and the character >.

                                          -

                                          An HTML comment consists of <!-- + text + -->, +

                                          An HTML comment consists of <!-- + text + -->, where text does not start with > or ->, does not end with -, and does not contain --. (See the HTML5 spec.)

                                          -

                                          A processing instruction +

                                          A processing instruction consists of the string <?, a string of characters not including the string ?>, and the string ?>.

                                          -

                                          A declaration consists of the +

                                          A declaration consists of the string <!, a name consisting of one or more uppercase ASCII letters, [whitespace], a string of characters not including the character >, and the character >.

                                          -

                                          A CDATA section consists of +

                                          A CDATA section consists of the string <![CDATA[, a string of characters not including the string ]]>, and the string ]]>.

                                          -

                                          An HTML tag consists of an [open tag], a [closing tag], +

                                          An HTML tag consists of an [open tag], a [closing tag], an [HTML comment], a [processing instruction], a [declaration], or a [CDATA section].

                                          -

                                          Here are some simple open tags:

                                          +

                                          Here are some simple open tags:

                                          -
                                          <a><bab><c2c>
                                          +
                                          <a><bab><c2c>
                                           .
                                           <p><a><bab><c2c></p>
                                          -

                                          Empty elements:

                                          +

                                          Empty elements:

                                          -
                                          <a/><b2/>
                                          +
                                          <a/><b2/>
                                           .
                                           <p><a/><b2/></p>
                                          -

                                          [Whitespace] is allowed:

                                          +

                                          [Whitespace] is allowed:

                                          -
                                          <a  /><b2
                                          +
                                          <a  /><b2
                                           data="foo" >
                                           .
                                           <p><a  /><b2
                                           data="foo" ></p>
                                          -

                                          With attributes:

                                          +

                                          With attributes:

                                          -
                                          <a foo="bar" bam = 'baz <em>"</em>'
                                          +
                                          <a foo="bar" bam = 'baz <em>"</em>'
                                           _boolean zoop:33=zoop:33 />
                                           .
                                           <p><a foo="bar" bam = 'baz <em>"</em>'
                                           _boolean zoop:33=zoop:33 /></p>
                                          -

                                          Custom tag names can be used:

                                          +

                                          Custom tag names can be used:

                                          -
                                          Foo <responsive-image src="foo.jpg" />
                                          +
                                          Foo <responsive-image src="foo.jpg" />
                                           .
                                           <p>Foo <responsive-image src="foo.jpg" /></p>
                                          -

                                          Illegal tag names, not parsed as HTML:

                                          +

                                          Illegal tag names, not parsed as HTML:

                                          -
                                          <33> <__>
                                          +
                                          <33> <__>
                                           .
                                           <p>&lt;33&gt; &lt;__&gt;</p>
                                          -

                                          Illegal attribute names:

                                          +

                                          Illegal attribute names:

                                          -
                                          <a h*#ref="hi">
                                          +
                                          <a h*#ref="hi">
                                           .
                                           <p>&lt;a h*#ref=&quot;hi&quot;&gt;</p>
                                          -

                                          Illegal attribute values:

                                          +

                                          Illegal attribute values:

                                          -
                                          <a href="hi'> <a href=hi'>
                                          +
                                          <a href="hi'> <a href=hi'>
                                           .
                                           <p>&lt;a href=&quot;hi'&gt; &lt;a href=hi'&gt;</p>
                                          -

                                          Illegal [whitespace]:

                                          +

                                          Illegal [whitespace]:

                                          -
                                          < a><
                                          +
                                          < a><
                                           foo><bar/ >
                                           <foo bar=baz
                                           bim!bop />
                                          @@ -8124,30 +8121,30 @@ or a [CDATA section].

                                          bim!bop /&gt;</p>
                                          -

                                          Missing [whitespace]:

                                          +

                                          Missing [whitespace]:

                                          -
                                          <a href='bar'title=title>
                                          +
                                          <a href='bar'title=title>
                                           .
                                           <p>&lt;a href='bar'title=title&gt;</p>
                                          -

                                          Closing tags:

                                          +

                                          Closing tags:

                                          -
                                          </a></foo >
                                          +
                                          </a></foo >
                                           .
                                           <p></a></foo ></p>
                                          -

                                          Illegal attributes in closing tag:

                                          +

                                          Illegal attributes in closing tag:

                                          -
                                          </a href="foo">
                                          +
                                          </a href="foo">
                                           .
                                           <p>&lt;/a href=&quot;foo&quot;&gt;</p>
                                          -

                                          Comments:

                                          +

                                          Comments:

                                          -
                                          foo <!-- this is a
                                          +
                                          foo <!-- this is a
                                           comment - with hyphen -->
                                           .
                                           <p>foo <!-- this is a
                                          @@ -8155,14 +8152,14 @@ or a [CDATA section].

                                          -
                                          foo <!-- not a comment -- two hyphens -->
                                          +
                                          foo <!-- not a comment -- two hyphens -->
                                           .
                                           <p>foo &lt;!-- not a comment -- two hyphens --&gt;</p>
                                          -

                                          Not comments:

                                          +

                                          Not comments:

                                          -
                                          foo <!--> foo -->
                                          +
                                          foo <!--> foo -->
                                           
                                           foo <!-- foo--->
                                           .
                                          @@ -8170,71 +8167,71 @@ or a [CDATA section].

                                          <p>foo &lt;!-- foo---&gt;</p>
                                          -

                                          Processing instructions:

                                          +

                                          Processing instructions:

                                          -
                                          foo <?php echo $a; ?>
                                          +
                                          foo <?php echo $a; ?>
                                           .
                                           <p>foo <?php echo $a; ?></p>
                                          -

                                          Declarations:

                                          +

                                          Declarations:

                                          -
                                          foo <!ELEMENT br EMPTY>
                                          +
                                          foo <!ELEMENT br EMPTY>
                                           .
                                           <p>foo <!ELEMENT br EMPTY></p>
                                          -

                                          CDATA sections:

                                          +

                                          CDATA sections:

                                          -
                                          foo <![CDATA[>&<]]>
                                          +
                                          foo <![CDATA[>&<]]>
                                           .
                                           <p>foo <![CDATA[>&<]]></p>
                                          -

                                          Entity and numeric character references are preserved in HTML +

                                          Entity and numeric character references are preserved in HTML attributes:

                                          -
                                          foo <a href="&ouml;">
                                          +
                                          foo <a href="&ouml;">
                                           .
                                           <p>foo <a href="&ouml;"></p>
                                          -

                                          Backslash escapes do not work in HTML attributes:

                                          +

                                          Backslash escapes do not work in HTML attributes:

                                          -
                                          foo <a href="\*">
                                          +
                                          foo <a href="\*">
                                           .
                                           <p>foo <a href="\*"></p>
                                          -
                                          <a href="\"">
                                          +
                                          <a href="\"">
                                           .
                                           <p>&lt;a href=&quot;&quot;&quot;&gt;</p>
                                          -

                                          +

                                          Disallowed Raw HTML (extension)

                                          -

                                          GFM enables the tagfilter extension, where the following HTML tags will be +

                                          GFM enables the tagfilter extension, where the following HTML tags will be filtered when rendering HTML output:

                                          -
                                            -
                                          • <title>
                                          • -
                                          • <textarea>
                                          • -
                                          • <style>
                                          • -
                                          • <xmp>
                                          • -
                                          • <iframe>
                                          • -
                                          • <noembed>
                                          • -
                                          • <noframes>
                                          • -
                                          • <script>
                                          • -
                                          • <plaintext>
                                          • +
                                              +
                                            • <title>
                                            • +
                                            • <textarea>
                                            • +
                                            • <style>
                                            • +
                                            • <xmp>
                                            • +
                                            • <iframe>
                                            • +
                                            • <noembed>
                                            • +
                                            • <noframes>
                                            • +
                                            • <script>
                                            • +
                                            • <plaintext>
                                            -

                                            Filtering is done by replacing the leading < with the entity &lt;. These +

                                            Filtering is done by replacing the leading < with the entity &lt;. These tags are chosen in particular as they change how HTML is interpreted in a way unique to them (i.e. nested HTML is interpreted differently), and this is usually undesireable in the context of other rendered Markdown content.

                                            -

                                            All other HTML tags are left untouched.

                                            +

                                            All other HTML tags are left untouched.

                                            -
                                            <strong> <title> <style> <em>
                                            +
                                            <strong> <title> <style> <em>
                                             
                                             <blockquote>
                                               <xmp> is disallowed.  <XMP> is also disallowed.
                                            @@ -8247,42 +8244,42 @@ usually undesireable in the context of other rendered Markdown content.

                                          -

                                          +

                                          Hard line breaks

                                          -

                                          A line break (not in a code span or HTML tag) that is preceded +

                                          A line break (not in a code span or HTML tag) that is preceded by two or more spaces and does not occur at the end of a block is parsed as a hard line break (rendered in HTML as a <br /> tag):

                                          -
                                          foo  
                                          +
                                          foo  
                                           baz
                                           .
                                           <p>foo<br />
                                           baz</p>
                                          -

                                          For a more visible alternative, a backslash before the +

                                          For a more visible alternative, a backslash before the [line ending] may be used instead of two spaces:

                                          -
                                          foo\
                                          +
                                          foo\
                                           baz
                                           .
                                           <p>foo<br />
                                           baz</p>
                                          -

                                          More than two spaces can be used:

                                          +

                                          More than two spaces can be used:

                                          -
                                          foo       
                                          +
                                          foo       
                                           baz
                                           .
                                           <p>foo<br />
                                           baz</p>
                                          -

                                          Leading spaces at the beginning of the next line are ignored:

                                          +

                                          Leading spaces at the beginning of the next line are ignored:

                                          -
                                          foo  
                                          +
                                          foo  
                                                bar
                                           .
                                           <p>foo<br />
                                          @@ -8290,17 +8287,17 @@ in HTML as a <br /> tag):

                                          -
                                          foo\
                                          +
                                          foo\
                                                bar
                                           .
                                           <p>foo<br />
                                           bar</p>
                                          -

                                          Line breaks can occur inside emphasis, links, and other constructs +

                                          Line breaks can occur inside emphasis, links, and other constructs that allow inline content:

                                          -
                                          *foo  
                                          +
                                          *foo  
                                           bar*
                                           .
                                           <p><em>foo<br />
                                          @@ -8308,31 +8305,31 @@ that allow inline content:

                                          -
                                          *foo\
                                          +
                                          *foo\
                                           bar*
                                           .
                                           <p><em>foo<br />
                                           bar</em></p>
                                          -

                                          Line breaks do not occur inside code spans

                                          +

                                          Line breaks do not occur inside code spans

                                          -
                                          `code  
                                          +
                                          `code  
                                           span`
                                           .
                                           <p><code>code   span</code></p>
                                          -
                                          `code\
                                          +
                                          `code\
                                           span`
                                           .
                                           <p><code>code\ span</code></p>
                                          -

                                          or HTML tags:

                                          +

                                          or HTML tags:

                                          -
                                          <a href="foo  
                                          +
                                          <a href="foo  
                                           bar">
                                           .
                                           <p><a href="foo  
                                          @@ -8340,106 +8337,106 @@ that allow inline content:

                                          -
                                          <a href="foo\
                                          +
                                          <a href="foo\
                                           bar">
                                           .
                                           <p><a href="foo\
                                           bar"></p>
                                          -

                                          Hard line breaks are for separating inline content within a block. +

                                          Hard line breaks are for separating inline content within a block. Neither syntax for hard line breaks works at the end of a paragraph or other block element:

                                          -
                                          foo\
                                          +
                                          foo\
                                           .
                                           <p>foo\</p>
                                          -
                                          foo  
                                          +
                                          foo  
                                           .
                                           <p>foo</p>
                                          -
                                          ### foo\
                                          +
                                          ### foo\
                                           .
                                           <h3>foo\</h3>
                                          -
                                          ### foo  
                                          +
                                          ### foo  
                                           .
                                           <h3>foo</h3>
                                          -

                                          +

                                          Soft line breaks

                                          -

                                          A regular line break (not in a code span or HTML tag) that is not +

                                          A regular line break (not in a code span or HTML tag) that is not preceded by two or more spaces or a backslash is parsed as a softbreak. (A softbreak may be rendered in HTML either as a [line ending] or as a space. The result will be the same in browsers. In the examples here, a [line ending] will be used.)

                                          -
                                          foo
                                          +
                                          foo
                                           baz
                                           .
                                           <p>foo
                                           baz</p>
                                          -

                                          Spaces at the end of the line and beginning of the next line are +

                                          Spaces at the end of the line and beginning of the next line are removed:

                                          -
                                          foo 
                                          +
                                          foo 
                                            baz
                                           .
                                           <p>foo
                                           baz</p>
                                          -

                                          A conforming parser may render a soft line break in HTML either as a +

                                          A conforming parser may render a soft line break in HTML either as a line break or as a space.

                                          -

                                          A renderer may also provide an option to render soft line breaks +

                                          A renderer may also provide an option to render soft line breaks as hard line breaks.

                                          -

                                          +

                                          Textual content

                                          -

                                          Any characters not given an interpretation by the above rules will +

                                          Any characters not given an interpretation by the above rules will be parsed as plain textual content.

                                          -
                                          hello $.;'there
                                          +
                                          hello $.;'there
                                           .
                                           <p>hello $.;'there</p>
                                          -
                                          Foo χρῆν
                                          +
                                          Foo χρῆν
                                           .
                                           <p>Foo χρῆν</p>
                                          -

                                          Internal spaces are preserved verbatim:

                                          +

                                          Internal spaces are preserved verbatim:

                                          -
                                          Multiple     spaces
                                          +
                                          Multiple     spaces
                                           .
                                           <p>Multiple     spaces</p>
                                          -

                                          +

                                          GitLab Official Specification Markdown

                                          -

                                          Currently, only some of the GitLab-specific markdown features are -listed in this section. We will eventually add all +

                                          Currently, only some of the GitLab-specific markdown features are +listed in this section. We may eventually add all GitLab-specific features currently listed as supported in the user-facing documentation for GitLab Flavored Markdown.

                                          -

                                          There is currently only this single top-level heading, but the +

                                          There is currently only this single top-level heading, but the examples may be split into multiple top-level headings in the future.

                                          -

                                          +

                                          Footnotes

                                          -

                                          See +

                                          See the footnotes section of the user-facing documentation for GitLab Flavored Markdown.

                                          -
                                          footnote reference tag [^fortytwo]
                                          +
                                          footnote reference tag [^fortytwo]
                                           
                                           [^fortytwo]: footnote text
                                           .
                                          @@ -8464,19 +8461,19 @@ examples may be split into multiple top-level headings in the future.

                                          </section>
                                          -

                                          +

                                          Task list items

                                          -

                                          See +

                                          See Task lists in the GitLab Flavored Markdown documentation.

                                          -

                                          Task list items (checkboxes) are defined as a GitHub Flavored Markdown extension in a section above. +

                                          Task list items (checkboxes) are defined as a GitHub Flavored Markdown extension in a section above. GitLab extends the behavior of task list items to support additional features. Some of these features are in-progress, and should not yet be considered part of the official GitLab Flavored Markdown specification.

                                          -

                                          Some of the behavior of task list items is implemented as client-side JavaScript/CSS.

                                          -

                                          The following are some basic examples; more examples may be added in the future.

                                          -

                                          Incomplete task:

                                          +

                                          Some of the behavior of task list items is implemented as client-side JavaScript/CSS.

                                          +

                                          The following are some basic examples; more examples may be added in the future.

                                          +

                                          Incomplete task:

                                          -
                                          - [ ] incomplete
                                          +
                                          - [ ] incomplete
                                           .
                                           <ul>
                                           <li>
                                          @@ -8487,9 +8484,9 @@ GitLab Flavored Markdown specification.

                                          </ul>
                                          -

                                          Completed task:

                                          +

                                          Completed task:

                                          -
                                          - [x] completed
                                          +
                                          - [x] completed
                                           .
                                           <ul>
                                           <li>
                                          @@ -8500,9 +8497,9 @@ GitLab Flavored Markdown specification.

                                          </ul>
                                          -

                                          Inapplicable task:

                                          +

                                          Inapplicable task:

                                          -
                                          - [~] inapplicable
                                          +
                                          - [~] inapplicable
                                           .
                                           <ul>
                                           <li>
                                          @@ -8515,10 +8512,10 @@ GitLab Flavored Markdown specification.

                                          </ul>
                                          -

                                          Inapplicable task in a "loose" list. Note that the <del> tag is not applied to the +

                                          Inapplicable task in a "loose" list. Note that the <del> tag is not applied to the loose text; it has strikethrough applied with CSS.

                                          -
                                          - [~] inapplicable
                                          +
                                          - [~] inapplicable
                                           
                                             text in loose list
                                           .
                                          @@ -8538,15 +8535,15 @@ loose text; it has strikethrough applied with CSS.

                                          </ul>
                                          -

                                          +

                                          Front matter

                                          -

                                          See +

                                          See Front matter in the GitLab Flavored Markdown documentation.

                                          -

                                          Front matter is metadata included at the beginning of a Markdown document, preceding the content. +

                                          Front matter is metadata included at the beginning of a Markdown document, preceding the content. This data can be used by static site generators like Jekyll, Hugo, and many other applications.

                                          -

                                          YAML front matter:

                                          +

                                          YAML front matter:

                                          -
                                          ---
                                          +
                                          ---
                                           title: YAML front matter
                                           ---
                                           .
                                          @@ -8557,9 +8554,9 @@ This data can be used by static site generators like Jekyll, Hugo, and many othe
                                           </pre>
                                          -

                                          TOML front matter:

                                          +

                                          TOML front matter:

                                          -
                                          +++
                                          +
                                          +++
                                           title: TOML front matter
                                           +++
                                           .
                                          @@ -8570,9 +8567,9 @@ This data can be used by static site generators like Jekyll, Hugo, and many othe
                                           </pre>
                                          -

                                          JSON front matter:

                                          +

                                          JSON front matter:

                                          -
                                          ;;;
                                          +
                                          ;;;
                                           {
                                             "title": "JSON front matter"
                                           }
                                          @@ -8587,9 +8584,9 @@ This data can be used by static site generators like Jekyll, Hugo, and many othe
                                           </pre>
                                          -

                                          Front matter blocks should be inserted at the top of the document:

                                          +

                                          Front matter blocks should be inserted at the top of the document:

                                          -
                                          text
                                          +
                                          text
                                           
                                           ---
                                           title: YAML front matter
                                          @@ -8600,9 +8597,9 @@ This data can be used by static site generators like Jekyll, Hugo, and many othe
                                           <h2>title: YAML front matter</h2>
                                          -

                                          Front matter block delimiters shouldn’t be preceded by space characters:

                                          +

                                          Front matter block delimiters shouldn’t be preceded by space characters:

                                          -
                                           ---
                                          +
                                           ---
                                           title: YAML front matter
                                           ---
                                           .
                                          @@ -8610,14 +8607,13 @@ This data can be used by static site generators like Jekyll, Hugo, and many othe
                                           <h2>title: YAML front matter</h2>
                                          -

                                          +

                                          Table of contents

                                          -

                                          See +

                                          See table of contents in the GitLab Flavored Markdown documentation.

                                          -

                                          A table of contents is an unordered list that links to subheadings in the document. +

                                          A table of contents is an unordered list that links to subheadings in the document. Add either the [[_TOC_]] or

                                            -
                                          • Introduction
                                          • Preliminaries tag on its own line.
                                            -
                                            [TOC]
                                            +
                                            [TOC]
                                             
                                             # Heading 1
                                             
                                            @@ -8723,7 +8705,7 @@ Add either the [[_TOC_]] or 

                                            -
                                            [[_TOC_]]
                                            +
                                            [[_TOC_]]
                                             
                                             # Heading 1
                                             
                                            @@ -8741,10 +8723,10 @@ Add either the [[_TOC_]] or 

                                              <h2>Heading 2</h2>
                                            -

                                            A table of contents is a block element. It should preceded and followed by a blank +

                                            A table of contents is a block element. It should preceded and followed by a blank line.

                                            -
                                            [[_TOC_]]
                                            +
                                            [[_TOC_]]
                                             text
                                             
                                             text
                                            @@ -8754,9 +8736,9 @@ line.

                                            <p>text[TOC]</p>
                                            -

                                            A table of contents can be indented with up to three spaces.

                                            +

                                            A table of contents can be indented with up to three spaces.

                                            -
                                               [[_TOC_]]
                                            +
                                               [[_TOC_]]
                                             
                                             # Heading 1
                                             .
                                            @@ -8768,452 +8750,100 @@ line.

                                            <h1>Heading 1</h1>
                                            -

                                            +

                                            GitLab Internal Extension Markdown

                                            -

                                            +

                                            Audio

                                            -

                                            See +

                                            See audio in the GitLab Flavored Markdown documentation.

                                            -

                                            GLFM renders image elements as an audio player as long as the resource’s file extension is +

                                            GLFM renders image elements as an audio player as long as the resource’s file extension is one of the following supported audio extensions .mp3, .oga, .ogg, .spx, and .wav. Audio ignore the alternative text part of an image declaration.

                                            -
                                            ![audio](audio.oga "audio title")
                                            +
                                            ![audio](audio.oga "audio title")
                                             .
                                             <p><audio src="audio.oga" title="audio title"></audio></p>
                                            -

                                            Reference definitions work audio as well:

                                            +

                                            Reference definitions work audio as well:

                                            -
                                            [audio]: audio.oga "audio title"
                                            +
                                            [audio]: audio.oga "audio title"
                                             
                                             ![audio][audio]
                                             .
                                             <p><audio src="audio.oga" title="audio title"></audio></p>
                                            -

                                            +

                                            Video

                                            -

                                            See +

                                            See videos in the GitLab Flavored Markdown documentation.

                                            -

                                            GLFM renders image elements as a video player as long as the resource’s file extension is +

                                            GLFM renders image elements as a video player as long as the resource’s file extension is one of the following supported video extensions .mp4, .m4v, .mov, .webm, and .ogv. Videos ignore the alternative text part of an image declaration.

                                            -
                                            ![video](video.m4v "video title")
                                            +
                                            ![video](video.m4v "video title")
                                             .
                                             <p><video src="video.m4v" title="video title"></video></p>
                                            -

                                            Reference definitions work video as well:

                                            +

                                            Reference definitions work video as well:

                                            -
                                            [video]: video.mov "video title"
                                            +
                                            [video]: video.mov "video title"
                                             
                                             ![video][video]
                                             .
                                             <p><video src="video.mov" title="video title"></video></p>
                                            -

                                            +

                                            Markdown Preview API Request Overrides

                                            -

                                            This section contains examples of all controllers which use PreviewMarkdown module +

                                            This section contains examples of all controllers which use PreviewMarkdown module and use different markdown_context_params. They exercise the various preview_markdown endpoints via glfm_example_metadata.yml.

                                            -

                                            preview_markdown exercising groups API endpoint and UploadLinkFilter:

                                            +

                                            preview_markdown exercising groups API endpoint and UploadLinkFilter:

                                            -
                                            [groups-test-file](/uploads/groups-test-file)
                                            +
                                            [groups-test-file](/uploads/groups-test-file)
                                             .
                                             <p><a href="groups-test-file">groups-test-file</a></p>
                                            -

                                            preview_markdown exercising projects API endpoint and RepositoryLinkFilter:

                                            +

                                            preview_markdown exercising projects API endpoint and RepositoryLinkFilter:

                                            -
                                            [projects-test-file](projects-test-file)
                                            +
                                            [projects-test-file](projects-test-file)
                                             .
                                             <p><a href="projects-test-file">projects-test-file</a></p>
                                            -

                                            preview_markdown exercising projects API endpoint and SnippetReferenceFilter:

                                            +

                                            preview_markdown exercising projects API endpoint and SnippetReferenceFilter:

                                            -
                                            This project snippet ID reference IS filtered: $88888
                                            +
                                            This project snippet ID reference IS filtered: $88888
                                             .
                                             <p>This project snippet ID reference IS filtered: $88888</p>
                                            -

                                            preview_markdown exercising personal (non-project) snippets API endpoint. This is +

                                            preview_markdown exercising personal (non-project) snippets API endpoint. This is only used by the comment field on personal snippets. It has no unique custom markdown extension behavior, and specifically does not render snippet references via SnippetReferenceFilter, even if the ID is valid.

                                            -
                                            This personal snippet ID reference is not filtered: $99999
                                            +
                                            This personal snippet ID reference is not filtered: $99999
                                             .
                                             <p>This personal snippet ID reference is not filtered: $99999</p>
                                            -

                                            preview_markdown exercising project wikis API endpoint and WikiLinkFilter:

                                            +

                                            preview_markdown exercising project wikis API endpoint and WikiLinkFilter:

                                            -
                                            [project-wikis-test-file](project-wikis-test-file)
                                            +
                                            [project-wikis-test-file](project-wikis-test-file)
                                             .
                                             <p><a href="project-wikis-test-file">project-wikis-test-file</a></p>
                                            -

                                            preview_markdown exercising group wikis API endpoint and WikiLinkFilter. This example +

                                            preview_markdown exercising group wikis API endpoint and WikiLinkFilter. This example also requires an EE license enabling the group_wikis feature:

                                            -
                                            [group-wikis-test-file](group-wikis-test-file)
                                            +
                                            [group-wikis-test-file](group-wikis-test-file)
                                             .
                                             <p><a href="group-wikis-test-file">group-wikis-test-file</a></p>
                                            - -

                                            -Appendix: A parsing strategy

                                            -

                                            In this appendix we describe some features of the parsing strategy -used in the CommonMark reference implementations.

                                            -

                                            -Overview

                                            -

                                            Parsing has two phases:

                                            -
                                              -
                                            1. -

                                              In the first phase, lines of input are consumed and the block -structure of the document---its division into paragraphs, block quotes, -list items, and so on---is constructed. Text is assigned to these -blocks but not parsed. Link reference definitions are parsed and a -map of links is constructed.

                                              -
                                            2. -
                                            3. -

                                              In the second phase, the raw text contents of paragraphs and headings -are parsed into sequences of Markdown inline elements (strings, -code spans, links, emphasis, and so on), using the map of link -references constructed in phase 1.

                                              -
                                            4. -
                                            -

                                            At each point in processing, the document is represented as a tree of -blocks. The root of the tree is a document block. The document -may have any number of other blocks as children. These children -may, in turn, have other blocks as children. The last child of a block -is normally considered open, meaning that subsequent lines of input -can alter its contents. (Blocks that are not open are closed.) -Here, for example, is a possible document tree, with the open blocks -marked by arrows:

                                            -
                                            -
                                            -> document
                                            -  -> block_quote
                                            -       paragraph
                                            -         "Lorem ipsum dolor\nsit amet."
                                            -    -> list (type=bullet tight=true bullet_char=-)
                                            -         list_item
                                            -           paragraph
                                            -             "Qui *quodsi iracundia*"
                                            -      -> list_item
                                            -        -> paragraph
                                            -             "aliquando id"
                                            - -
                                            -

                                            -Phase 1: block structure

                                            -

                                            Each line that is processed has an effect on this tree. The line is -analyzed and, depending on its contents, the document may be altered -in one or more of the following ways:

                                            -
                                              -
                                            1. One or more open blocks may be closed.
                                            2. -
                                            3. One or more new blocks may be created as children of the -last open block.
                                            4. -
                                            5. Text may be added to the last (deepest) open block remaining -on the tree.
                                            6. -
                                            -

                                            Once a line has been incorporated into the tree in this way, -it can be discarded, so input can be read in a stream.

                                            -

                                            For each line, we follow this procedure:

                                            -
                                              -
                                            1. -

                                              First we iterate through the open blocks, starting with the -root document, and descending through last children down to the last -open block. Each block imposes a condition that the line must satisfy -if the block is to remain open. For example, a block quote requires a -> character. A paragraph requires a non-blank line. -In this phase we may match all or just some of the open -blocks. But we cannot close unmatched blocks yet, because we may have a -[lazy continuation line].

                                              -
                                            2. -
                                            3. -

                                              Next, after consuming the continuation markers for existing -blocks, we look for new block starts (e.g. > for a block quote). -If we encounter a new block start, we close any blocks unmatched -in step 1 before creating the new block as a child of the last -matched block.

                                              -
                                            4. -
                                            5. -

                                              Finally, we look at the remainder of the line (after block -markers like >, list markers, and indentation have been consumed). -This is text that can be incorporated into the last open -block (a paragraph, code block, heading, or raw HTML).

                                              -
                                            6. -
                                            -

                                            Setext headings are formed when we see a line of a paragraph -that is a [setext heading underline].

                                            -

                                            Reference link definitions are detected when a paragraph is closed; -the accumulated text lines are parsed to see if they begin with -one or more reference link definitions. Any remainder becomes a -normal paragraph.

                                            -

                                            We can see how this works by considering how the tree above is -generated by four lines of Markdown:

                                            -
                                            -
                                            > Lorem ipsum dolor
                                            -sit amet.
                                            -> - Qui *quodsi iracundia*
                                            -> - aliquando id
                                            - -
                                            -

                                            At the outset, our document model is just

                                            -
                                            -
                                            -> document
                                            - -
                                            -

                                            The first line of our text,

                                            -
                                            -
                                            > Lorem ipsum dolor
                                            - -
                                            -

                                            causes a block_quote block to be created as a child of our -open document block, and a paragraph block as a child of -the block_quote. Then the text is added to the last open -block, the paragraph:

                                            -
                                            -
                                            -> document
                                            -  -> block_quote
                                            -    -> paragraph
                                            -         "Lorem ipsum dolor"
                                            - -
                                            -

                                            The next line,

                                            -
                                            -
                                            sit amet.
                                            - -
                                            -

                                            is a "lazy continuation" of the open paragraph, so it gets added -to the paragraph's text:

                                            -
                                            -
                                            -> document
                                            -  -> block_quote
                                            -    -> paragraph
                                            -         "Lorem ipsum dolor\nsit amet."
                                            - -
                                            -

                                            The third line,

                                            -
                                            -
                                            > - Qui *quodsi iracundia*
                                            - -
                                            -

                                            causes the paragraph block to be closed, and a new list block -opened as a child of the block_quote. A list_item is also -added as a child of the list, and a paragraph as a child of -the list_item. The text is then added to the new paragraph:

                                            -
                                            -
                                            -> document
                                            -  -> block_quote
                                            -       paragraph
                                            -         "Lorem ipsum dolor\nsit amet."
                                            -    -> list (type=bullet tight=true bullet_char=-)
                                            -      -> list_item
                                            -        -> paragraph
                                            -             "Qui *quodsi iracundia*"
                                            - -
                                            -

                                            The fourth line,

                                            -
                                            -
                                            > - aliquando id
                                            - -
                                            -

                                            causes the list_item (and its child the paragraph) to be closed, -and a new list_item opened up as child of the list. A paragraph -is added as a child of the new list_item, to contain the text. -We thus obtain the final tree:

                                            -
                                            -
                                            -> document
                                            -  -> block_quote
                                            -       paragraph
                                            -         "Lorem ipsum dolor\nsit amet."
                                            -    -> list (type=bullet tight=true bullet_char=-)
                                            -         list_item
                                            -           paragraph
                                            -             "Qui *quodsi iracundia*"
                                            -      -> list_item
                                            -        -> paragraph
                                            -             "aliquando id"
                                            - -
                                            -

                                            -Phase 2: inline structure

                                            -

                                            Once all of the input has been parsed, all open blocks are closed.

                                            -

                                            We then "walk the tree," visiting every node, and parse raw -string contents of paragraphs and headings as inlines. At this -point we have seen all the link reference definitions, so we can -resolve reference links as we go.

                                            -
                                            -
                                            document
                                            -  block_quote
                                            -    paragraph
                                            -      str "Lorem ipsum dolor"
                                            -      softbreak
                                            -      str "sit amet."
                                            -    list (type=bullet tight=true bullet_char=-)
                                            -      list_item
                                            -        paragraph
                                            -          str "Qui "
                                            -          emph
                                            -            str "quodsi iracundia"
                                            -      list_item
                                            -        paragraph
                                            -          str "aliquando id"
                                            - -
                                            -

                                            Notice how the [line ending] in the first paragraph has -been parsed as a softbreak, and the asterisks in the first list item -have become an emph.

                                            -

                                            -An algorithm for parsing nested emphasis and links

                                            -

                                            By far the trickiest part of inline parsing is handling emphasis, -strong emphasis, links, and images. This is done using the following -algorithm.

                                            -

                                            When we're parsing inlines and we hit either

                                            -
                                              -
                                            • a run of * or _ characters, or
                                            • -
                                            • a [ or ![ -
                                            • -
                                            -

                                            we insert a text node with these symbols as its literal content, and we -add a pointer to this text node to the delimiter stack.

                                            -

                                            The [delimiter stack] is a doubly linked list. Each -element contains a pointer to a text node, plus information about

                                            -
                                              -
                                            • the type of delimiter ([, ![, *, _)
                                            • -
                                            • the number of delimiters,
                                            • -
                                            • whether the delimiter is "active" (all are active to start), and
                                            • -
                                            • whether the delimiter is a potential opener, a potential closer, -or both (which depends on what sort of characters precede -and follow the delimiters).
                                            • -
                                            -

                                            When we hit a ] character, we call the look for link or image -procedure (see below).

                                            -

                                            When we hit the end of the input, we call the process emphasis -procedure (see below), with stack_bottom = NULL.

                                            -

                                            -look for link or image -

                                            -

                                            Starting at the top of the delimiter stack, we look backwards -through the stack for an opening [ or ![ delimiter.

                                            -
                                              -
                                            • -

                                              If we don't find one, we return a literal text node ].

                                              -
                                            • -
                                            • -

                                              If we do find one, but it's not active, we remove the inactive -delimiter from the stack, and return a literal text node ].

                                              -
                                            • -
                                            • -

                                              If we find one and it's active, then we parse ahead to see if -we have an inline link/image, reference link/image, compact reference -link/image, or shortcut reference link/image.

                                              -
                                                -
                                              • -

                                                If we don't, then we remove the opening delimiter from the -delimiter stack and return a literal text node ].

                                                -
                                              • -
                                              • -

                                                If we do, then

                                                -
                                                  -
                                                • -

                                                  We return a link or image node whose children are the inlines -after the text node pointed to by the opening delimiter.

                                                  -
                                                • -
                                                • -

                                                  We run process emphasis on these inlines, with the [ opener -as stack_bottom.

                                                  -
                                                • -
                                                • -

                                                  We remove the opening delimiter.

                                                  -
                                                • -
                                                • -

                                                  If we have a link (and not an image), we also set all -[ delimiters before the opening delimiter to inactive. (This -will prevent us from getting links within links.)

                                                  -
                                                • -
                                                -
                                              • -
                                              -
                                            • -
                                            -

                                            -process emphasis -

                                            -

                                            Parameter stack_bottom sets a lower bound to how far we -descend in the [delimiter stack]. If it is NULL, we can -go all the way to the bottom. Otherwise, we stop before -visiting stack_bottom.

                                            -

                                            Let current_position point to the element on the [delimiter stack] -just above stack_bottom (or the first element if stack_bottom -is NULL).

                                            -

                                            We keep track of the openers_bottom for each delimiter -type (*, _) and each length of the closing delimiter run -(modulo 3). Initialize this to stack_bottom.

                                            -

                                            Then we repeat the following until we run out of potential -closers:

                                            -
                                              -
                                            • -

                                              Move current_position forward in the delimiter stack (if needed) -until we find the first potential closer with delimiter * or _. -(This will be the potential closer closest -to the beginning of the input -- the first one in parse order.)

                                              -
                                            • -
                                            • -

                                              Now, look back in the stack (staying above stack_bottom and -the openers_bottom for this delimiter type) for the -first matching potential opener ("matching" means same delimiter).

                                              -
                                            • -
                                            • -

                                              If one is found:

                                              -
                                                -
                                              • -

                                                Figure out whether we have emphasis or strong emphasis: -if both closer and opener spans have length >= 2, we have -strong, otherwise regular.

                                                -
                                              • -
                                              • -

                                                Insert an emph or strong emph node accordingly, after -the text node corresponding to the opener.

                                                -
                                              • -
                                              • -

                                                Remove any delimiters between the opener and closer from -the delimiter stack.

                                                -
                                              • -
                                              • -

                                                Remove 1 (for regular emph) or 2 (for strong emph) delimiters -from the opening and closing text nodes. If they become empty -as a result, remove them and remove the corresponding element -of the delimiter stack. If the closing node is removed, reset -current_position to the next element in the stack.

                                                -
                                              • -
                                              -
                                            • -
                                            • -

                                              If none is found:

                                              -
                                                -
                                              • -

                                                Set openers_bottom to the element before current_position. -(We know that there are no openers for this kind of closer up to and -including this point, so this puts a lower bound on future searches.)

                                                -
                                              • -
                                              • -

                                                If the closer at current_position is not a potential opener, -remove it from the delimiter stack (since we know it can't -be a closer either).

                                                -
                                              • -
                                              • -

                                                Advance current_position to the next element in the stack.

                                                -
                                              • -
                                              -
                                            • -
                                            -

                                            After we're done, we remove all delimiters above stack_bottom from the -delimiter stack.

                                            diff --git a/glfm_specification/output/spec.txt b/glfm_specification/output_example_snapshots/snapshot_spec.md similarity index 94% rename from glfm_specification/output/spec.txt rename to glfm_specification/output_example_snapshots/snapshot_spec.md index a8565b15bc3..ed96c36a58a 100644 --- a/glfm_specification/output/spec.txt +++ b/glfm_specification/output_example_snapshots/snapshot_spec.md @@ -2,11 +2,6 @@ title: GitLab Flavored Markdown (GLFM) Spec version: alpha ... - -# Introduction - -TODO: Write a GitLab-specific version of the GitHub Flavored Markdown intro section. - # Preliminaries ## Characters and lines @@ -9603,7 +9598,7 @@ Multiple spaces # GitLab Official Specification Markdown Currently, only some of the GitLab-specific markdown features are -listed in this section. We will eventually add all +listed in this section. We may eventually add all GitLab-specific features currently listed as supported in the [user-facing documentation for GitLab Flavored Markdown](https://docs.gitlab.com/ee/user/markdown.html). @@ -9989,342 +9984,3 @@ also requires an EE license enabling the `group_wikis` feature: .

                                            group-wikis-test-file

                                            ```````````````````````````````` - - - -# Appendix: A parsing strategy - -In this appendix we describe some features of the parsing strategy -used in the CommonMark reference implementations. - -## Overview - -Parsing has two phases: - -1. In the first phase, lines of input are consumed and the block -structure of the document---its division into paragraphs, block quotes, -list items, and so on---is constructed. Text is assigned to these -blocks but not parsed. Link reference definitions are parsed and a -map of links is constructed. - -2. In the second phase, the raw text contents of paragraphs and headings -are parsed into sequences of Markdown inline elements (strings, -code spans, links, emphasis, and so on), using the map of link -references constructed in phase 1. - -At each point in processing, the document is represented as a tree of -**blocks**. The root of the tree is a `document` block. The `document` -may have any number of other blocks as **children**. These children -may, in turn, have other blocks as children. The last child of a block -is normally considered **open**, meaning that subsequent lines of input -can alter its contents. (Blocks that are not open are **closed**.) -Here, for example, is a possible document tree, with the open blocks -marked by arrows: - -``` tree --> document - -> block_quote - paragraph - "Lorem ipsum dolor\nsit amet." - -> list (type=bullet tight=true bullet_char=-) - list_item - paragraph - "Qui *quodsi iracundia*" - -> list_item - -> paragraph - "aliquando id" -``` - -## Phase 1: block structure - -Each line that is processed has an effect on this tree. The line is -analyzed and, depending on its contents, the document may be altered -in one or more of the following ways: - -1. One or more open blocks may be closed. -2. One or more new blocks may be created as children of the - last open block. -3. Text may be added to the last (deepest) open block remaining - on the tree. - -Once a line has been incorporated into the tree in this way, -it can be discarded, so input can be read in a stream. - -For each line, we follow this procedure: - -1. First we iterate through the open blocks, starting with the -root document, and descending through last children down to the last -open block. Each block imposes a condition that the line must satisfy -if the block is to remain open. For example, a block quote requires a -`>` character. A paragraph requires a non-blank line. -In this phase we may match all or just some of the open -blocks. But we cannot close unmatched blocks yet, because we may have a -[lazy continuation line]. - -2. Next, after consuming the continuation markers for existing -blocks, we look for new block starts (e.g. `>` for a block quote). -If we encounter a new block start, we close any blocks unmatched -in step 1 before creating the new block as a child of the last -matched block. - -3. Finally, we look at the remainder of the line (after block -markers like `>`, list markers, and indentation have been consumed). -This is text that can be incorporated into the last open -block (a paragraph, code block, heading, or raw HTML). - -Setext headings are formed when we see a line of a paragraph -that is a [setext heading underline]. - -Reference link definitions are detected when a paragraph is closed; -the accumulated text lines are parsed to see if they begin with -one or more reference link definitions. Any remainder becomes a -normal paragraph. - -We can see how this works by considering how the tree above is -generated by four lines of Markdown: - -``` markdown -> Lorem ipsum dolor -sit amet. -> - Qui *quodsi iracundia* -> - aliquando id -``` - -At the outset, our document model is just - -``` tree --> document -``` - -The first line of our text, - -``` markdown -> Lorem ipsum dolor -``` - -causes a `block_quote` block to be created as a child of our -open `document` block, and a `paragraph` block as a child of -the `block_quote`. Then the text is added to the last open -block, the `paragraph`: - -``` tree --> document - -> block_quote - -> paragraph - "Lorem ipsum dolor" -``` - -The next line, - -``` markdown -sit amet. -``` - -is a "lazy continuation" of the open `paragraph`, so it gets added -to the paragraph's text: - -``` tree --> document - -> block_quote - -> paragraph - "Lorem ipsum dolor\nsit amet." -``` - -The third line, - -``` markdown -> - Qui *quodsi iracundia* -``` - -causes the `paragraph` block to be closed, and a new `list` block -opened as a child of the `block_quote`. A `list_item` is also -added as a child of the `list`, and a `paragraph` as a child of -the `list_item`. The text is then added to the new `paragraph`: - -``` tree --> document - -> block_quote - paragraph - "Lorem ipsum dolor\nsit amet." - -> list (type=bullet tight=true bullet_char=-) - -> list_item - -> paragraph - "Qui *quodsi iracundia*" -``` - -The fourth line, - -``` markdown -> - aliquando id -``` - -causes the `list_item` (and its child the `paragraph`) to be closed, -and a new `list_item` opened up as child of the `list`. A `paragraph` -is added as a child of the new `list_item`, to contain the text. -We thus obtain the final tree: - -``` tree --> document - -> block_quote - paragraph - "Lorem ipsum dolor\nsit amet." - -> list (type=bullet tight=true bullet_char=-) - list_item - paragraph - "Qui *quodsi iracundia*" - -> list_item - -> paragraph - "aliquando id" -``` - -## Phase 2: inline structure - -Once all of the input has been parsed, all open blocks are closed. - -We then "walk the tree," visiting every node, and parse raw -string contents of paragraphs and headings as inlines. At this -point we have seen all the link reference definitions, so we can -resolve reference links as we go. - -``` tree -document - block_quote - paragraph - str "Lorem ipsum dolor" - softbreak - str "sit amet." - list (type=bullet tight=true bullet_char=-) - list_item - paragraph - str "Qui " - emph - str "quodsi iracundia" - list_item - paragraph - str "aliquando id" -``` - -Notice how the [line ending] in the first paragraph has -been parsed as a `softbreak`, and the asterisks in the first list item -have become an `emph`. - -### An algorithm for parsing nested emphasis and links - -By far the trickiest part of inline parsing is handling emphasis, -strong emphasis, links, and images. This is done using the following -algorithm. - -When we're parsing inlines and we hit either - -- a run of `*` or `_` characters, or -- a `[` or `![` - -we insert a text node with these symbols as its literal content, and we -add a pointer to this text node to the [delimiter stack](@). - -The [delimiter stack] is a doubly linked list. Each -element contains a pointer to a text node, plus information about - -- the type of delimiter (`[`, `![`, `*`, `_`) -- the number of delimiters, -- whether the delimiter is "active" (all are active to start), and -- whether the delimiter is a potential opener, a potential closer, - or both (which depends on what sort of characters precede - and follow the delimiters). - -When we hit a `]` character, we call the *look for link or image* -procedure (see below). - -When we hit the end of the input, we call the *process emphasis* -procedure (see below), with `stack_bottom` = NULL. - -#### *look for link or image* - -Starting at the top of the delimiter stack, we look backwards -through the stack for an opening `[` or `![` delimiter. - -- If we don't find one, we return a literal text node `]`. - -- If we do find one, but it's not *active*, we remove the inactive - delimiter from the stack, and return a literal text node `]`. - -- If we find one and it's active, then we parse ahead to see if - we have an inline link/image, reference link/image, compact reference - link/image, or shortcut reference link/image. - - + If we don't, then we remove the opening delimiter from the - delimiter stack and return a literal text node `]`. - - + If we do, then - - * We return a link or image node whose children are the inlines - after the text node pointed to by the opening delimiter. - - * We run *process emphasis* on these inlines, with the `[` opener - as `stack_bottom`. - - * We remove the opening delimiter. - - * If we have a link (and not an image), we also set all - `[` delimiters before the opening delimiter to *inactive*. (This - will prevent us from getting links within links.) - -#### *process emphasis* - -Parameter `stack_bottom` sets a lower bound to how far we -descend in the [delimiter stack]. If it is NULL, we can -go all the way to the bottom. Otherwise, we stop before -visiting `stack_bottom`. - -Let `current_position` point to the element on the [delimiter stack] -just above `stack_bottom` (or the first element if `stack_bottom` -is NULL). - -We keep track of the `openers_bottom` for each delimiter -type (`*`, `_`) and each length of the closing delimiter run -(modulo 3). Initialize this to `stack_bottom`. - -Then we repeat the following until we run out of potential -closers: - -- Move `current_position` forward in the delimiter stack (if needed) - until we find the first potential closer with delimiter `*` or `_`. - (This will be the potential closer closest - to the beginning of the input -- the first one in parse order.) - -- Now, look back in the stack (staying above `stack_bottom` and - the `openers_bottom` for this delimiter type) for the - first matching potential opener ("matching" means same delimiter). - -- If one is found: - - + Figure out whether we have emphasis or strong emphasis: - if both closer and opener spans have length >= 2, we have - strong, otherwise regular. - - + Insert an emph or strong emph node accordingly, after - the text node corresponding to the opener. - - + Remove any delimiters between the opener and closer from - the delimiter stack. - - + Remove 1 (for regular emph) or 2 (for strong emph) delimiters - from the opening and closing text nodes. If they become empty - as a result, remove them and remove the corresponding element - of the delimiter stack. If the closing node is removed, reset - `current_position` to the next element in the stack. - -- If none is found: - - + Set `openers_bottom` to the element before `current_position`. - (We know that there are no openers for this kind of closer up to and - including this point, so this puts a lower bound on future searches.) - - + If the closer at `current_position` is not a potential opener, - remove it from the delimiter stack (since we know it can't - be a closer either). - - + Advance `current_position` to the next element in the stack. - -After we're done, we remove all delimiters above `stack_bottom` from the -delimiter stack. diff --git a/glfm_specification/output_spec/spec.html b/glfm_specification/output_spec/spec.html new file mode 100644 index 00000000000..3a7b08e0a5e --- /dev/null +++ b/glfm_specification/output_spec/spec.html @@ -0,0 +1,276 @@ +
                                            +
                                            title: GitLab Flavored Markdown (GLFM) Spec
                                            +version: alpha
                                            + +
                                            +

                                            +Introduction

                                            +

                                            TODO: Write a GitLab-specific version of the GitHub Flavored Markdown intro section.

                                            + +

                                            +GitLab Official Specification Markdown

                                            +

                                            Currently, only some of the GitLab-specific markdown features are +listed in this section. We may eventually add all +GitLab-specific features currently listed as supported in the +user-facing documentation for GitLab Flavored Markdown.

                                            +

                                            There is currently only this single top-level heading, but the +examples may be split into multiple top-level headings in the future.

                                            +

                                            +Footnotes

                                            +

                                            See +the footnotes section of the user-facing documentation for GitLab Flavored Markdown.

                                            +
                                            +
                                            footnote reference tag [^fortytwo]
                                            +
                                            +[^fortytwo]: footnote text
                                            +.
                                            +<p>
                                            +footnote reference tag
                                            +<sup>
                                            +<a href="#fn-fortytwo-42" id="fnref-fortytwo-42" data-footnote-ref>
                                            +1
                                            +</a>
                                            +</sup>
                                            +</p>
                                            +<section data-footnotes>
                                            +<ol>
                                            +<li id="fn-fortytwo-42">
                                            +<p>
                                            +footnote text
                                            +<a href="#fnref-fortytwo-42" data-footnote-backref>
                                            +</a>
                                            +</p>
                                            +</li>
                                            +</ol>
                                            +</section>
                                            + +
                                            +

                                            +Task list items

                                            +

                                            See +Task lists in the GitLab Flavored Markdown documentation.

                                            +

                                            Task list items (checkboxes) are defined as a GitHub Flavored Markdown extension in a section above. +GitLab extends the behavior of task list items to support additional features. +Some of these features are in-progress, and should not yet be considered part of the official +GitLab Flavored Markdown specification.

                                            +

                                            Some of the behavior of task list items is implemented as client-side JavaScript/CSS.

                                            +

                                            The following are some basic examples; more examples may be added in the future.

                                            +

                                            Incomplete task:

                                            +
                                            +
                                            - [ ] incomplete
                                            +.
                                            +<ul>
                                            +<li>
                                            +<task-button/>
                                            +<input type="checkbox" disabled/>
                                            +incomplete
                                            +</li>
                                            +</ul>
                                            + +
                                            +

                                            Completed task:

                                            +
                                            +
                                            - [x] completed
                                            +.
                                            +<ul>
                                            +<li>
                                            +<task-button/>
                                            +<input type="checkbox" checked disabled/>
                                            +completed
                                            +</li>
                                            +</ul>
                                            + +
                                            +

                                            Inapplicable task:

                                            +
                                            +
                                            - [~] inapplicable
                                            +.
                                            +<ul>
                                            +<li>
                                            +<task-button/>
                                            +<input type="checkbox" data-inapplicable disabled>
                                            +<s>
                                            +inapplicable
                                            +</s>
                                            +</li>
                                            +</ul>
                                            + +
                                            +

                                            Inapplicable task in a "loose" list. Note that the <del> tag is not applied to the +loose text; it has strikethrough applied with CSS.

                                            +
                                            +
                                            - [~] inapplicable
                                            +
                                            +  text in loose list
                                            +.
                                            +<ul>
                                            +<li>
                                            +<p>
                                            +<task-button/>
                                            +<input type="checkbox" data-inapplicable disabled>
                                            +<s>
                                            +inapplicable
                                            +</s>
                                            +</p>
                                            +<p>
                                            +text in loose list
                                            +</p>
                                            +</li>
                                            +</ul>
                                            + +
                                            +

                                            +Front matter

                                            +

                                            See +Front matter in the GitLab Flavored Markdown documentation.

                                            +

                                            Front matter is metadata included at the beginning of a Markdown document, preceding the content. +This data can be used by static site generators like Jekyll, Hugo, and many other applications.

                                            +

                                            YAML front matter:

                                            +
                                            +
                                            ---
                                            +title: YAML front matter
                                            +---
                                            +.
                                            +<pre>
                                            +<code>
                                            +title: YAML front matter
                                            +</code>
                                            +</pre>
                                            + +
                                            +

                                            TOML front matter:

                                            +
                                            +
                                            +++
                                            +title: TOML front matter
                                            ++++
                                            +.
                                            +<pre>
                                            +<code>
                                            +title: TOML front matter
                                            +</code>
                                            +</pre>
                                            + +
                                            +

                                            JSON front matter:

                                            +
                                            +
                                            ;;;
                                            +{
                                            +  "title": "JSON front matter"
                                            +}
                                            +;;;
                                            +.
                                            +<pre>
                                            +<code>
                                            +{
                                            +  "title": "JSON front matter"
                                            +}
                                            +</code>
                                            +</pre>
                                            + +
                                            +

                                            Front matter blocks should be inserted at the top of the document:

                                            +
                                            +
                                            text
                                            +
                                            +---
                                            +title: YAML front matter
                                            +---
                                            +.
                                            +<p>text</p>
                                            +<hr>
                                            +<h2>title: YAML front matter</h2>
                                            + +
                                            +

                                            Front matter block delimiters shouldn’t be preceded by space characters:

                                            +
                                            +
                                             ---
                                            +title: YAML front matter
                                            +---
                                            +.
                                            +<hr>
                                            +<h2>title: YAML front matter</h2>
                                            + +
                                            +

                                            +Table of contents

                                            +

                                            See +table of contents +in the GitLab Flavored Markdown documentation.

                                            +

                                            A table of contents is an unordered list that links to subheadings in the document. +Add either the [[_TOC_]] or

                                            tag on its own line. +
                                            +
                                            [TOC]
                                            +
                                            +# Heading 1
                                            +
                                            +## Heading 2
                                            +.
                                            +<nav>
                                            +  <ul>
                                            +    <li><a href="#heading-1">Heading 1</a></li>
                                            +    <ul>
                                            +      <li><a href="#heading-2">Heading 2</a></li>
                                            +    </ul>
                                            +  </ul>
                                            +</nav>
                                            +<h1>Heading 1</h1>
                                            +<h2>Heading 2</h2>
                                            + +
                                            +
                                            +
                                            [[_TOC_]]
                                            +
                                            +# Heading 1
                                            +
                                            +## Heading 2
                                            +.
                                            +<nav>
                                            +  <ul>
                                            +    <li><a href="#heading-1">Heading 1</a></li>
                                            +    <ul>
                                            +      <li><a href="#heading-2">Heading 2</a></li>
                                            +    </ul>
                                            +  </ul>
                                            +</nav>
                                            +<h1>Heading 1</h1>
                                            +<h2>Heading 2</h2>
                                            + +
                                            +

                                            A table of contents is a block element. It should preceded and followed by a blank +line.

                                            +
                                            +
                                            [[_TOC_]]
                                            +text
                                            +
                                            +text
                                            +[TOC]
                                            +.
                                            +<p>[[<em>TOC</em>]]text</p>
                                            +<p>text[TOC]</p>
                                            + +
                                            +

                                            A table of contents can be indented with up to three spaces.

                                            +
                                            +
                                               [[_TOC_]]
                                            +
                                            +# Heading 1
                                            +.
                                            +<nav>
                                            +  <ul>
                                            +    <li><a href="#heading-1">Heading 1</a></li>
                                            +  </ul>
                                            +</nav>
                                            +<h1>Heading 1</h1>
                                            + +
                                            + diff --git a/glfm_specification/output_spec/spec.txt b/glfm_specification/output_spec/spec.txt new file mode 100644 index 00000000000..e16975ac51f --- /dev/null +++ b/glfm_specification/output_spec/spec.txt @@ -0,0 +1,287 @@ +--- +title: GitLab Flavored Markdown (GLFM) Spec +version: alpha +... +# Introduction + +TODO: Write a GitLab-specific version of the GitHub Flavored Markdown intro section. + + +# GitLab Official Specification Markdown + +Currently, only some of the GitLab-specific markdown features are +listed in this section. We may eventually add all +GitLab-specific features currently listed as supported in the +[user-facing documentation for GitLab Flavored Markdown](https://docs.gitlab.com/ee/user/markdown.html). + +There is currently only this single top-level heading, but the +examples may be split into multiple top-level headings in the future. + +## Footnotes + +See +[the footnotes section of the user-facing documentation for GitLab Flavored Markdown](https://docs.gitlab.com/ee/user/markdown.html#footnotes). + +```````````````````````````````` example gitlab +footnote reference tag [^fortytwo] + +[^fortytwo]: footnote text +. +

                                            +footnote reference tag + + +1 + + +

                                            +
                                            +
                                              +
                                            1. +

                                              +footnote text + + +

                                              +
                                            2. +
                                            +
                                            +```````````````````````````````` + +## Task list items + +See +[Task lists](https://docs.gitlab.com/ee/user/markdown.html#task-lists) in the GitLab Flavored Markdown documentation. + +Task list items (checkboxes) are defined as a GitHub Flavored Markdown extension in a section above. +GitLab extends the behavior of task list items to support additional features. +Some of these features are in-progress, and should not yet be considered part of the official +GitLab Flavored Markdown specification. + +Some of the behavior of task list items is implemented as client-side JavaScript/CSS. + +The following are some basic examples; more examples may be added in the future. + +Incomplete task: + +```````````````````````````````` example gitlab +- [ ] incomplete +. +
                                              +
                                            • + + +incomplete +
                                            • +
                                            +```````````````````````````````` + +Completed task: + +```````````````````````````````` example gitlab +- [x] completed +. +
                                              +
                                            • + + +completed +
                                            • +
                                            +```````````````````````````````` + +Inapplicable task: + +```````````````````````````````` example gitlab +- [~] inapplicable +. +
                                              +
                                            • + + + +inapplicable + +
                                            • +
                                            +```````````````````````````````` + +Inapplicable task in a "loose" list. Note that the `` tag is not applied to the +loose text; it has strikethrough applied with CSS. + +```````````````````````````````` example gitlab +- [~] inapplicable + + text in loose list +. +
                                              +
                                            • +

                                              + + + +inapplicable + +

                                              +

                                              +text in loose list +

                                              +
                                            • +
                                            +```````````````````````````````` + +## Front matter + +See +[Front matter](https://docs.gitlab.com/ee/user/markdown.html#front-matter) in the GitLab Flavored Markdown documentation. + +Front matter is metadata included at the beginning of a Markdown document, preceding the content. +This data can be used by static site generators like Jekyll, Hugo, and many other applications. + +YAML front matter: + +```````````````````````````````` example gitlab +--- +title: YAML front matter +--- +. +
                                            +
                                            +title: YAML front matter
                                            +
                                            +
                                            +```````````````````````````````` + +TOML front matter: + +```````````````````````````````` example gitlab ++++ +title: TOML front matter ++++ +. +
                                            +
                                            +title: TOML front matter
                                            +
                                            +
                                            +```````````````````````````````` + +JSON front matter: + +```````````````````````````````` example gitlab +;;; +{ + "title": "JSON front matter" +} +;;; +. +
                                            +
                                            +{
                                            +  "title": "JSON front matter"
                                            +}
                                            +
                                            +
                                            +```````````````````````````````` + +Front matter blocks should be inserted at the top of the document: + +```````````````````````````````` example gitlab +text + +--- +title: YAML front matter +--- +. +

                                            text

                                            +
                                            +

                                            title: YAML front matter

                                            +```````````````````````````````` + +Front matter block delimiters shouldn’t be preceded by space characters: + +```````````````````````````````` example gitlab + --- +title: YAML front matter +--- +. +
                                            +

                                            title: YAML front matter

                                            +```````````````````````````````` + +## Table of contents + +See +[table of contents](https://docs.gitlab.com/ee/user/markdown.html#table-of-contents) +in the GitLab Flavored Markdown documentation. + +A table of contents is an unordered list that links to subheadings in the document. +Add either the `[[_TOC_]]` or `[TOC]` tag on its own line. + +```````````````````````````````` example gitlab +[TOC] + +# Heading 1 + +## Heading 2 +. + +

                                            Heading 1

                                            +

                                            Heading 2

                                            +```````````````````````````````` + +```````````````````````````````` example gitlab +[[_TOC_]] + +# Heading 1 + +## Heading 2 +. + +

                                            Heading 1

                                            +

                                            Heading 2

                                            +```````````````````````````````` + +A table of contents is a block element. It should preceded and followed by a blank +line. + +```````````````````````````````` example gitlab +[[_TOC_]] +text + +text +[TOC] +. +

                                            [[TOC]]text

                                            +

                                            text[TOC]

                                            +```````````````````````````````` + +A table of contents can be indented with up to three spaces. + +```````````````````````````````` example gitlab + [[_TOC_]] + +# Heading 1 +. + +

                                            Heading 1

                                            +```````````````````````````````` + diff --git a/qa/qa/page/component/lazy_loader.rb b/qa/qa/page/component/lazy_loader.rb index 2123431fc55..1b166efbbff 100644 --- a/qa/qa/page/component/lazy_loader.rb +++ b/qa/qa/page/component/lazy_loader.rb @@ -9,8 +9,8 @@ module QA def self.included(base) super - base.view 'app/assets/javascripts/lazy_loader.js' do - element :js_lazy_loaded + base.view 'app/views/layouts/_img_loader.html.haml' do + element :js_lazy_loaded_content end end end diff --git a/qa/qa/page/component/wiki.rb b/qa/qa/page/component/wiki.rb index ffd31f8d7b7..ed68052f997 100644 --- a/qa/qa/page/component/wiki.rb +++ b/qa/qa/page/component/wiki.rb @@ -38,7 +38,7 @@ module QA # webdriver to miss the hit so we wait for the svg to load before # clicking the button. within_element(:svg_content) do - has_element?(:js_lazy_loaded) + has_element?(:js_lazy_loaded_content) end click_element(:create_first_page_link) diff --git a/qa/qa/page/file/edit.rb b/qa/qa/page/file/edit.rb index d2b8c8260fd..b9b676ee3c4 100644 --- a/qa/qa/page/file/edit.rb +++ b/qa/qa/page/file/edit.rb @@ -12,10 +12,6 @@ module QA element :editor_toolbar_button end - view 'app/views/projects/blob/_editor.html.haml' do - element :source_editor_preview_container - end - def has_markdown_preview?(component, content) within_element(:source_editor_preview_container) do has_css?(component, exact_text: content) diff --git a/qa/qa/page/file/form.rb b/qa/qa/page/file/form.rb index bb8934db498..2e0f8c59213 100644 --- a/qa/qa/page/file/form.rb +++ b/qa/qa/page/file/form.rb @@ -11,7 +11,7 @@ module QA include Shared::Editor view 'app/views/projects/blob/_editor.html.haml' do - element :file_name, "text_field_tag 'file_name'" # rubocop:disable QA/ElementWithPattern + element :file_name_field end view 'app/views/projects/blob/_template_selectors.html.haml' do @@ -23,7 +23,7 @@ module QA end def add_name(name) - fill_in 'file_name', with: name + fill_element(:file_name_field, with: name) end def select_template(template_type, template) diff --git a/qa/qa/page/file/shared/editor.rb b/qa/qa/page/file/shared/editor.rb index dab02c1e34f..f392d52747e 100644 --- a/qa/qa/page/file/shared/editor.rb +++ b/qa/qa/page/file/shared/editor.rb @@ -11,7 +11,7 @@ module QA super base.view 'app/views/projects/blob/_editor.html.haml' do - element :editor + element :source_editor_preview_container end end @@ -30,7 +30,7 @@ module QA private def text_area - within_element :editor do + within_element :source_editor_preview_container do find('textarea', visible: false) end end diff --git a/qa/qa/page/label/index.rb b/qa/qa/page/label/index.rb index e19bc0838c9..70df2e4dc9e 100644 --- a/qa/qa/page/label/index.rb +++ b/qa/qa/page/label/index.rb @@ -23,7 +23,7 @@ module QA # This can cause webdriver to miss the hit so we wait for the svg to load (implicitly with has_element?) # before clicking the button. within_element(:label_svg_content) do - has_element?(:js_lazy_loaded) + has_element?(:js_lazy_loaded_content) end click_element :create_new_label_button diff --git a/qa/qa/page/project/branches/show.rb b/qa/qa/page/project/branches/show.rb index 4bf8abb555b..22b960b47ce 100644 --- a/qa/qa/page/project/branches/show.rb +++ b/qa/qa/page/project/branches/show.rb @@ -16,22 +16,22 @@ module QA end view 'app/views/projects/branches/_branch.html.haml' do - element :branch_name + element :badge_content + element :branch_container + element :branch_link end view 'app/views/projects/branches/_panel.html.haml' do - element :all_branches + element :all_branches_container end view 'app/views/projects/branches/index.html.haml' do - element :delete_merged_branches + element :delete_merged_branches_link end def delete_branch(branch_name) - within_element(:all_branches) do - within(".js-branch-#{branch_name}") do - click_element(:delete_branch_button) - end + within_element(:branch_container, name: branch_name) do + click_element(:delete_branch_button) end click_element(:delete_branch_confirmation_button) @@ -41,22 +41,20 @@ module QA def has_no_branch?(branch_name, reload: false) wait_until(reload: reload) do - within_element(:all_branches) do - has_no_element?(:branch_name, text: branch_name) + within_element(:all_branches_container) do + has_no_element?(:branch_link, text: branch_name) end end end def has_branch_with_badge?(branch_name, badge) - within_element(:all_branches) do - within(".js-branch-#{branch_name} .badge") do - has_text?(badge) - end + within_element(:branch_container, name: branch_name) do + has_element?(:badge_content, text: badge) end end def delete_merged_branches - click_element(:delete_merged_branches) + click_element(:delete_merged_branches_link) click_confirmation_ok_button end end diff --git a/qa/qa/page/project/pipeline/show.rb b/qa/qa/page/project/pipeline/show.rb index 06d154f5178..33ba27a788a 100644 --- a/qa/qa/page/project/pipeline/show.rb +++ b/qa/qa/page/project/pipeline/show.rb @@ -35,10 +35,6 @@ module QA element :status_icon, 'ci-status-icon-${status}' # rubocop:disable QA/ElementWithPattern end - view 'app/views/projects/pipelines/_info.html.haml' do - element :pipeline_badges - end - view 'app/assets/javascripts/pipelines/components/graph/job_group_dropdown.vue' do element :job_dropdown_container element :jobs_dropdown_menu @@ -68,12 +64,6 @@ module QA has_no_element?(:job_link, text: job_name) end - def has_tag?(tag_name) - within_element(:pipeline_badges) do - has_selector?('.badge', text: tag_name) - end - end - def linked_pipelines all_elements(:linked_pipeline_container, minimum: 1) end diff --git a/qa/qa/page/project/settings/mirroring_repositories.rb b/qa/qa/page/project/settings/mirroring_repositories.rb index f55faff19e7..61ee3e4f03c 100644 --- a/qa/qa/page/project/settings/mirroring_repositories.rb +++ b/qa/qa/page/project/settings/mirroring_repositories.rb @@ -6,25 +6,25 @@ module QA module Settings class MirroringRepositories < Page::Base view 'app/views/projects/mirrors/_authentication_method.html.haml' do - element :authentication_method - element :password + element :authentication_method_field + element :password_field end view 'app/views/projects/mirrors/_mirror_repos.html.haml' do - element :mirror_repository_url_input + element :mirror_repository_url_field element :mirror_repository_button end view 'app/views/projects/mirrors/_mirror_repos_list.html.haml' do - element :mirror_repository_url_cell - element :mirror_last_update_at_cell - element :mirror_error_badge - element :mirrored_repository_row + element :mirror_repository_url_content + element :mirror_last_update_at_content + element :mirror_error_badge_content + element :mirrored_repository_row_container element :copy_public_key_button end view 'app/views/projects/mirrors/_mirror_repos_form.html.haml' do - element :mirror_direction + element :mirror_direction_field end view 'app/views/shared/_remote_mirror_update_button.html.haml' do @@ -37,28 +37,23 @@ module QA element :fingerprints_list end - view 'app/views/projects/mirrors/_authentication_method.html.haml' do - element :authentication_method - element :password - end - def repository_url=(value) - fill_element :mirror_repository_url_input, value + fill_element :mirror_repository_url_field, value end def password=(value) - fill_element :password, value + fill_element :password_field, value end def mirror_direction=(value) raise ArgumentError, "Mirror direction must be 'Push' or 'Pull'" unless %w[Push Pull].include?(value) - select_element(:mirror_direction, value) + select_element(:mirror_direction_field, value) # Changing the mirror direction causes the fields below to change, # and that change is animated, so we need to wait for the animation # to complete otherwise changes to those fields could fail - wait_for_animated_element :authentication_method + wait_for_animated_element :authentication_method_field end def authentication_method=(value) @@ -66,13 +61,13 @@ module QA raise ArgumentError, "Authentication method must be 'SSH public key', 'Password', or 'None'" end - select_element(:authentication_method, value) + select_element(:authentication_method_field, value) end def public_key(url) row_index = find_repository_row_index url - within_element_by_index(:mirrored_repository_row, row_index) do + within_element_by_index(:mirrored_repository_row_container, row_index) do find_element(:copy_public_key_button)['data-clipboard-text'] end end @@ -92,7 +87,7 @@ module QA def update(url) row_index = find_repository_row_index(url) - within_element_by_index(:mirrored_repository_row, row_index) do + within_element_by_index(:mirrored_repository_row_container, row_index) do # When a repository is first mirrored, the update process might # already be started, so the button is already "clicked" click_element :update_now_button unless has_element? :updating_button @@ -105,16 +100,16 @@ module QA row_index = find_repository_row_index(url) wait_until(sleep_interval: 1) do - within_element_by_index(:mirrored_repository_row, row_index) do - last_update = find_element(:mirror_last_update_at_cell, wait: 0) + within_element_by_index(:mirrored_repository_row_container, row_index) do + last_update = find_element(:mirror_last_update_at_content, wait: 0) last_update.has_text?('just now') || last_update.has_text?('seconds') end end # Fail early if the page still shows that there has been no update - within_element_by_index(:mirrored_repository_row, row_index) do - find_element(:mirror_last_update_at_cell, wait: 0).assert_no_text('Never') - assert_no_element(:mirror_error_badge) + within_element_by_index(:mirrored_repository_row_container, row_index) do + find_element(:mirror_last_update_at_content, wait: 0).assert_no_text('Never') + assert_no_element(:mirror_error_badge_content) end end @@ -122,7 +117,7 @@ module QA def find_repository_row_index(target_url) wait_until(max_duration: 5, reload: false) do - all_elements(:mirror_repository_url_cell, minimum: 1).index do |url| + all_elements(:mirror_repository_url_content, minimum: 1).index do |url| # The url might be a sanitized url but the target_url won't be so # we compare just the paths instead of the full url URI.parse(url.text).path == target_url.path diff --git a/qa/qa/page/project/settings/protected_branches.rb b/qa/qa/page/project/settings/protected_branches.rb index a78d8a6ccf4..4fbf656210f 100644 --- a/qa/qa/page/project/settings/protected_branches.rb +++ b/qa/qa/page/project/settings/protected_branches.rb @@ -6,8 +6,8 @@ module QA module Settings class ProtectedBranches < Page::Base view 'app/views/projects/protected_branches/shared/_dropdown.html.haml' do - element :protected_branch_select element :protected_branch_dropdown + element :protected_branch_dropdown_content end view 'app/views/projects/protected_branches/_create_protected_branch.html.haml' do @@ -22,9 +22,9 @@ module QA end def select_branch(branch_name) - click_element :protected_branch_select + click_element :protected_branch_dropdown - within_element(:protected_branch_dropdown) do + within_element(:protected_branch_dropdown_content) do click_on branch_name end end diff --git a/qa/qa/page/project/show.rb b/qa/qa/page/project/show.rb index 26c2da07b34..a82fa7f5cf3 100644 --- a/qa/qa/page/project/show.rb +++ b/qa/qa/page/project/show.rb @@ -32,7 +32,7 @@ module QA end view 'app/views/projects/_last_push.html.haml' do - element :create_merge_request + element :create_merge_request_button end view 'app/views/projects/_home_panel.html.haml' do @@ -54,7 +54,7 @@ module QA end view 'app/views/projects/empty.html.haml' do - element :quick_actions + element :quick_actions_container end view 'app/assets/javascripts/repository/components/breadcrumbs.vue' do @@ -72,7 +72,7 @@ module QA end view 'app/views/projects/blob/viewers/_loading.html.haml' do - element :spinner + element :spinner_placeholder end view 'app/views/projects/buttons/_download.html.haml' do @@ -80,11 +80,11 @@ module QA end def wait_for_viewers_to_load - has_no_element?(:spinner, wait: QA::Support::Repeater::DEFAULT_MAX_WAIT_TIME) + has_no_element?(:spinner_placeholder, wait: QA::Support::Repeater::DEFAULT_MAX_WAIT_TIME) end def create_first_new_file! - within_element(:quick_actions) do + within_element(:quick_actions_container) do click_link_with_text 'New file' end end @@ -122,7 +122,7 @@ module QA end def has_create_merge_request_button? - has_css?(element_selector_css(:create_merge_request)) + has_css?(element_selector_css(:create_merge_request_button)) end def has_file?(name) @@ -152,7 +152,7 @@ module QA has_create_merge_request_button? end - click_element :create_merge_request + click_element :create_merge_request_button end def open_web_ide! diff --git a/qa/qa/specs/features/api/4_verify/api_variable_inheritance_with_forward_pipeline_variables_spec.rb b/qa/qa/specs/features/api/4_verify/api_variable_inheritance_with_forward_pipeline_variables_spec.rb index 8ca0ae1f052..8890b3ff317 100644 --- a/qa/qa/specs/features/api/4_verify/api_variable_inheritance_with_forward_pipeline_variables_spec.rb +++ b/qa/qa/specs/features/api/4_verify/api_variable_inheritance_with_forward_pipeline_variables_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module QA - RSpec.describe 'Verify', :runner do + RSpec.describe 'Verify', :runner, product_group: :pipeline_authoring do describe 'Pipeline API defined variable inheritance' do include_context 'variable inheritance test prep' diff --git a/qa/qa/specs/features/api/4_verify/cancel_pipeline_when_block_user_spec.rb b/qa/qa/specs/features/api/4_verify/cancel_pipeline_when_block_user_spec.rb index 7c3fb9ebeba..a360c662cf8 100644 --- a/qa/qa/specs/features/api/4_verify/cancel_pipeline_when_block_user_spec.rb +++ b/qa/qa/specs/features/api/4_verify/cancel_pipeline_when_block_user_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module QA - RSpec.describe 'Verify', :requires_admin do + RSpec.describe 'Verify', :requires_admin, product_group: :pipeline_execution do describe 'When user is blocked' do let!(:admin_api_client) { Runtime::API::Client.as_admin } let!(:user_api_client) { Runtime::API::Client.new(:gitlab, user: user) } diff --git a/qa/qa/specs/features/api/4_verify/file_variable_spec.rb b/qa/qa/specs/features/api/4_verify/file_variable_spec.rb index 9722f62d5a7..5d6bc5a44f7 100644 --- a/qa/qa/specs/features/api/4_verify/file_variable_spec.rb +++ b/qa/qa/specs/features/api/4_verify/file_variable_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module QA - RSpec.describe 'Verify', :runner, feature_flag: { + RSpec.describe 'Verify', :runner, product_group: :pipeline_authoring, feature_flag: { name: 'ci_stop_expanding_file_vars_for_runners', scope: :project } do diff --git a/qa/qa/specs/features/api/4_verify/remove_runner_spec.rb b/qa/qa/specs/features/api/4_verify/remove_runner_spec.rb index 6e6198328e5..eb1b085c35c 100644 --- a/qa/qa/specs/features/api/4_verify/remove_runner_spec.rb +++ b/qa/qa/specs/features/api/4_verify/remove_runner_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module QA - RSpec.describe 'Verify', :runner do + RSpec.describe 'Verify', :runner, product_group: :runner do describe 'Runner removal' do include Support::API diff --git a/qa/qa/specs/features/browser_ui/4_verify/ci_variable/add_remove_ci_variable_spec.rb b/qa/qa/specs/features/browser_ui/4_verify/ci_variable/add_remove_ci_variable_spec.rb index fa8d0d1501c..d985868b96a 100644 --- a/qa/qa/specs/features/browser_ui/4_verify/ci_variable/add_remove_ci_variable_spec.rb +++ b/qa/qa/specs/features/browser_ui/4_verify/ci_variable/add_remove_ci_variable_spec.rb @@ -2,7 +2,7 @@ module QA RSpec.describe 'Verify' do - describe 'Add or Remove CI variable via UI', :smoke do + describe 'Add or Remove CI variable via UI', :smoke, product_group: :pipeline_authoring do let(:project) do Resource::Project.fabricate_via_api! do |project| project.name = 'project-with-ci-variables' diff --git a/qa/qa/specs/features/browser_ui/4_verify/ci_variable/custom_variable_spec.rb b/qa/qa/specs/features/browser_ui/4_verify/ci_variable/custom_variable_spec.rb index 63801536c34..1db6f48a404 100644 --- a/qa/qa/specs/features/browser_ui/4_verify/ci_variable/custom_variable_spec.rb +++ b/qa/qa/specs/features/browser_ui/4_verify/ci_variable/custom_variable_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module QA - RSpec.describe 'Verify', :runner do + RSpec.describe 'Verify', :runner, product_group: :pipeline_authoring do describe 'Pipeline with customizable variable' do let(:executor) { "qa-runner-#{Time.now.to_i}" } let(:pipeline_job_name) { 'customizable-variable' } diff --git a/qa/qa/specs/features/browser_ui/4_verify/ci_variable/pipeline_with_protected_variable_spec.rb b/qa/qa/specs/features/browser_ui/4_verify/ci_variable/pipeline_with_protected_variable_spec.rb index 5bb60e64da5..52785af1431 100644 --- a/qa/qa/specs/features/browser_ui/4_verify/ci_variable/pipeline_with_protected_variable_spec.rb +++ b/qa/qa/specs/features/browser_ui/4_verify/ci_variable/pipeline_with_protected_variable_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module QA - RSpec.describe 'Verify', :runner do + RSpec.describe 'Verify', :runner, product_group: :pipeline_authoring do describe 'Pipeline with protected variable' do let(:executor) { "qa-runner-#{Faker::Alphanumeric.alphanumeric(8)}" } let(:protected_value) { Faker::Alphanumeric.alphanumeric(8) } diff --git a/qa/qa/specs/features/browser_ui/4_verify/ci_variable/prefill_variables_spec.rb b/qa/qa/specs/features/browser_ui/4_verify/ci_variable/prefill_variables_spec.rb index 8352ad6aa33..7eec0f8870a 100644 --- a/qa/qa/specs/features/browser_ui/4_verify/ci_variable/prefill_variables_spec.rb +++ b/qa/qa/specs/features/browser_ui/4_verify/ci_variable/prefill_variables_spec.rb @@ -2,7 +2,7 @@ module QA RSpec.describe 'Verify' do - describe 'Pipeline with prefill variables' do + describe 'Pipeline with prefill variables', product_group: :pipeline_authoring do let(:prefill_variable_description1) { Faker::Lorem.sentence } let(:prefill_variable_value1) { Faker::Lorem.word } let(:prefill_variable_description2) { Faker::Lorem.sentence } diff --git a/qa/qa/specs/features/browser_ui/4_verify/ci_variable/ui_variable_inheritable_when_forward_pipeline_variables_true_spec.rb b/qa/qa/specs/features/browser_ui/4_verify/ci_variable/ui_variable_inheritable_when_forward_pipeline_variables_true_spec.rb index 7782c0240e9..a5ebd4004d2 100644 --- a/qa/qa/specs/features/browser_ui/4_verify/ci_variable/ui_variable_inheritable_when_forward_pipeline_variables_true_spec.rb +++ b/qa/qa/specs/features/browser_ui/4_verify/ci_variable/ui_variable_inheritable_when_forward_pipeline_variables_true_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module QA - RSpec.describe 'Verify', :runner do + RSpec.describe 'Verify', :runner, product_group: :pipeline_authoring do describe 'UI defined variable' do include_context 'variable inheritance test prep' diff --git a/qa/qa/specs/features/browser_ui/4_verify/ci_variable/ui_variable_non_inheritable_when_forward_pipeline_variables_false_spec.rb b/qa/qa/specs/features/browser_ui/4_verify/ci_variable/ui_variable_non_inheritable_when_forward_pipeline_variables_false_spec.rb index 69a99483b38..f53454b801c 100644 --- a/qa/qa/specs/features/browser_ui/4_verify/ci_variable/ui_variable_non_inheritable_when_forward_pipeline_variables_false_spec.rb +++ b/qa/qa/specs/features/browser_ui/4_verify/ci_variable/ui_variable_non_inheritable_when_forward_pipeline_variables_false_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module QA - RSpec.describe 'Verify', :runner do + RSpec.describe 'Verify', :runner, product_group: :pipeline_authoring do describe 'UI defined variable' do include_context 'variable inheritance test prep' diff --git a/qa/qa/specs/features/browser_ui/4_verify/pipeline/create_and_process_pipeline_spec.rb b/qa/qa/specs/features/browser_ui/4_verify/pipeline/create_and_process_pipeline_spec.rb index 1bba5355790..b6270c11ef6 100644 --- a/qa/qa/specs/features/browser_ui/4_verify/pipeline/create_and_process_pipeline_spec.rb +++ b/qa/qa/specs/features/browser_ui/4_verify/pipeline/create_and_process_pipeline_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module QA - RSpec.describe 'Verify', :smoke, :runner, quarantine: { + RSpec.describe 'Verify', :smoke, :runner, product_group: :pipeline_execution, quarantine: { issue: 'https://gitlab.com/gitlab-org/gitlab/-/issues/356295', type: :investigating } do diff --git a/qa/qa/specs/features/browser_ui/4_verify/pipeline/include_local_config_file_paths_with_wildcard_spec.rb b/qa/qa/specs/features/browser_ui/4_verify/pipeline/include_local_config_file_paths_with_wildcard_spec.rb index b9b87ed29bb..027383550a7 100644 --- a/qa/qa/specs/features/browser_ui/4_verify/pipeline/include_local_config_file_paths_with_wildcard_spec.rb +++ b/qa/qa/specs/features/browser_ui/4_verify/pipeline/include_local_config_file_paths_with_wildcard_spec.rb @@ -2,7 +2,7 @@ module QA RSpec.describe 'Verify' do - describe 'Include local config file paths with wildcard', :reliable do + describe 'Include local config file paths with wildcard', :reliable, product_group: :pipeline_authoring do let(:project) do Resource::Project.fabricate_via_api! do |project| project.name = 'project-with-pipeline' diff --git a/qa/qa/specs/features/browser_ui/4_verify/pipeline/include_multiple_files_from_a_project_spec.rb b/qa/qa/specs/features/browser_ui/4_verify/pipeline/include_multiple_files_from_a_project_spec.rb index 2fa6b9179ef..5fca2ac392a 100644 --- a/qa/qa/specs/features/browser_ui/4_verify/pipeline/include_multiple_files_from_a_project_spec.rb +++ b/qa/qa/specs/features/browser_ui/4_verify/pipeline/include_multiple_files_from_a_project_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module QA - RSpec.describe 'Verify', :runner do + RSpec.describe 'Verify', :runner, product_group: :pipeline_authoring do describe 'Include multiple files from a project' do let(:executor) { "qa-runner-#{Faker::Alphanumeric.alphanumeric(8)}" } let(:expected_text) { Faker::Lorem.sentence } diff --git a/qa/qa/specs/features/browser_ui/4_verify/pipeline/locked_artifacts_spec.rb b/qa/qa/specs/features/browser_ui/4_verify/pipeline/locked_artifacts_spec.rb index 3356d1274c8..ba1363d79c5 100644 --- a/qa/qa/specs/features/browser_ui/4_verify/pipeline/locked_artifacts_spec.rb +++ b/qa/qa/specs/features/browser_ui/4_verify/pipeline/locked_artifacts_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module QA - RSpec.describe 'Verify', :runner, :requires_admin do + RSpec.describe 'Verify', :runner, :requires_admin, product_group: :pipeline_insights do describe 'Artifacts' do context 'when locked' do let(:file_name) { 'artifact.txt' } diff --git a/qa/qa/specs/features/browser_ui/4_verify/pipeline/merge_mr_when_pipline_is_blocked_spec.rb b/qa/qa/specs/features/browser_ui/4_verify/pipeline/merge_mr_when_pipline_is_blocked_spec.rb index d201627218e..f63c5d4a85d 100644 --- a/qa/qa/specs/features/browser_ui/4_verify/pipeline/merge_mr_when_pipline_is_blocked_spec.rb +++ b/qa/qa/specs/features/browser_ui/4_verify/pipeline/merge_mr_when_pipline_is_blocked_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module QA - RSpec.describe 'Verify', :runner do + RSpec.describe 'Verify', :runner, product_group: :pipeline_execution do context 'When pipeline is blocked' do let(:executor) { "qa-runner-#{Faker::Alphanumeric.alphanumeric(8)}" } diff --git a/qa/qa/specs/features/browser_ui/4_verify/pipeline/mr_event_rule_pipeline_spec.rb b/qa/qa/specs/features/browser_ui/4_verify/pipeline/mr_event_rule_pipeline_spec.rb index 65561bbba29..8ec3209379f 100644 --- a/qa/qa/specs/features/browser_ui/4_verify/pipeline/mr_event_rule_pipeline_spec.rb +++ b/qa/qa/specs/features/browser_ui/4_verify/pipeline/mr_event_rule_pipeline_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module QA - RSpec.describe 'Verify', :runner do + RSpec.describe 'Verify', :runner, product_group: :pipeline_authoring do context 'When job is configured to only run on merge_request_events' do let(:mr_only_job_name) { 'mr_only_job' } let(:non_mr_only_job_name) { 'non_mr_only_job' } diff --git a/qa/qa/specs/features/browser_ui/4_verify/pipeline/parent_child_pipelines_independent_relationship_spec.rb b/qa/qa/specs/features/browser_ui/4_verify/pipeline/parent_child_pipelines_independent_relationship_spec.rb index 9e3c29db9e7..a7ca7b82d1e 100644 --- a/qa/qa/specs/features/browser_ui/4_verify/pipeline/parent_child_pipelines_independent_relationship_spec.rb +++ b/qa/qa/specs/features/browser_ui/4_verify/pipeline/parent_child_pipelines_independent_relationship_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module QA - RSpec.describe 'Verify', :runner, :reliable do + RSpec.describe 'Verify', :runner, :reliable, product_group: :pipeline_execution do describe 'Parent-child pipelines independent relationship' do let!(:project) do Resource::Project.fabricate_via_api! do |project| diff --git a/qa/qa/specs/features/browser_ui/4_verify/pipeline/pass_dotenv_variables_to_downstream_via_bridge_spec.rb b/qa/qa/specs/features/browser_ui/4_verify/pipeline/pass_dotenv_variables_to_downstream_via_bridge_spec.rb index bbcc71bade7..fca34fc1f8e 100644 --- a/qa/qa/specs/features/browser_ui/4_verify/pipeline/pass_dotenv_variables_to_downstream_via_bridge_spec.rb +++ b/qa/qa/specs/features/browser_ui/4_verify/pipeline/pass_dotenv_variables_to_downstream_via_bridge_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module QA - RSpec.describe 'Verify', :runner do + RSpec.describe 'Verify', :runner, product_group: :pipeline_authoring do describe 'Pass dotenv variables to downstream via bridge' do let(:executor) { "qa-runner-#{Faker::Alphanumeric.alphanumeric(number: 8)}" } let(:upstream_var) { Faker::Alphanumeric.alphanumeric(number: 8) } diff --git a/qa/qa/specs/features/browser_ui/4_verify/pipeline/pipeline_editor_branch_switcher_spec.rb b/qa/qa/specs/features/browser_ui/4_verify/pipeline/pipeline_editor_branch_switcher_spec.rb index ac91a9dd2d3..30c71bc590c 100644 --- a/qa/qa/specs/features/browser_ui/4_verify/pipeline/pipeline_editor_branch_switcher_spec.rb +++ b/qa/qa/specs/features/browser_ui/4_verify/pipeline/pipeline_editor_branch_switcher_spec.rb @@ -2,7 +2,7 @@ module QA RSpec.describe 'Verify' do - describe 'Pipeline editor' do + describe 'Pipeline editor', product_group: :pipeline_authoring do let(:random_test_string) { SecureRandom.hex(10) } let(:project) do diff --git a/qa/qa/specs/features/browser_ui/4_verify/pipeline/pipeline_editor_can_create_merge_request_spec.rb b/qa/qa/specs/features/browser_ui/4_verify/pipeline/pipeline_editor_can_create_merge_request_spec.rb index 931bb97ba32..1f7871b0900 100644 --- a/qa/qa/specs/features/browser_ui/4_verify/pipeline/pipeline_editor_can_create_merge_request_spec.rb +++ b/qa/qa/specs/features/browser_ui/4_verify/pipeline/pipeline_editor_can_create_merge_request_spec.rb @@ -2,7 +2,7 @@ module QA RSpec.describe 'Verify' do - describe 'Pipeline editor' do + describe 'Pipeline editor', product_group: :pipeline_authoring do let(:project) do Resource::Project.fabricate_via_api! do |project| project.name = 'pipeline-editor-project' diff --git a/qa/qa/specs/features/browser_ui/4_verify/pipeline/pipeline_editor_tabs_spec.rb b/qa/qa/specs/features/browser_ui/4_verify/pipeline/pipeline_editor_tabs_spec.rb index cd3d9eb6a2f..dbe24e2a2b2 100644 --- a/qa/qa/specs/features/browser_ui/4_verify/pipeline/pipeline_editor_tabs_spec.rb +++ b/qa/qa/specs/features/browser_ui/4_verify/pipeline/pipeline_editor_tabs_spec.rb @@ -2,7 +2,7 @@ module QA RSpec.describe 'Verify' do - describe 'Pipeline editor', :reliable do + describe 'Pipeline editor', :reliable, product_group: :pipeline_authoring do let(:project) do Resource::Project.fabricate_via_api! do |project| project.name = 'pipeline-editor-project' diff --git a/qa/qa/specs/features/browser_ui/4_verify/pipeline/pipeline_with_image_pull_policy_spec.rb b/qa/qa/specs/features/browser_ui/4_verify/pipeline/pipeline_with_image_pull_policy_spec.rb index f9113573295..b1ecce297c9 100644 --- a/qa/qa/specs/features/browser_ui/4_verify/pipeline/pipeline_with_image_pull_policy_spec.rb +++ b/qa/qa/specs/features/browser_ui/4_verify/pipeline/pipeline_with_image_pull_policy_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module QA - RSpec.describe 'Verify', :runner do + RSpec.describe 'Verify', :runner, product_group: :pipeline_authoring do describe 'Pipeline with image:pull_policy' do let(:runner_name) { "qa-runner-#{Faker::Alphanumeric.alphanumeric(number: 8)}" } let(:job_name) { "test-job-#{pull_policies.join('-')}" } diff --git a/qa/qa/specs/features/browser_ui/4_verify/pipeline/run_pipeline_via_web_only_spec.rb b/qa/qa/specs/features/browser_ui/4_verify/pipeline/run_pipeline_via_web_only_spec.rb index f36593218a9..e8ec01577b1 100644 --- a/qa/qa/specs/features/browser_ui/4_verify/pipeline/run_pipeline_via_web_only_spec.rb +++ b/qa/qa/specs/features/browser_ui/4_verify/pipeline/run_pipeline_via_web_only_spec.rb @@ -2,7 +2,7 @@ module QA RSpec.describe 'Verify' do - describe 'Run pipeline', :reliable do + describe 'Run pipeline', :reliable, product_group: :pipeline_execution do context 'with web only rule' do let(:job_name) { 'test_job' } let(:project) do diff --git a/qa/qa/specs/features/browser_ui/4_verify/pipeline/run_pipeline_with_manual_jobs_spec.rb b/qa/qa/specs/features/browser_ui/4_verify/pipeline/run_pipeline_with_manual_jobs_spec.rb index fb7e3a8437f..4223caaafef 100644 --- a/qa/qa/specs/features/browser_ui/4_verify/pipeline/run_pipeline_with_manual_jobs_spec.rb +++ b/qa/qa/specs/features/browser_ui/4_verify/pipeline/run_pipeline_with_manual_jobs_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module QA - RSpec.describe 'Verify', :runner do + RSpec.describe 'Verify', :runner, product_group: :pipeline_execution do describe 'Run pipeline with manual jobs' do let(:executor) { "qa-runner-#{SecureRandom.hex(4)}" } diff --git a/qa/qa/specs/features/browser_ui/4_verify/pipeline/trigger_child_pipeline_with_manual_spec.rb b/qa/qa/specs/features/browser_ui/4_verify/pipeline/trigger_child_pipeline_with_manual_spec.rb index 1c75beebb48..536569b1f60 100644 --- a/qa/qa/specs/features/browser_ui/4_verify/pipeline/trigger_child_pipeline_with_manual_spec.rb +++ b/qa/qa/specs/features/browser_ui/4_verify/pipeline/trigger_child_pipeline_with_manual_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module QA - RSpec.describe 'Verify', :runner do + RSpec.describe 'Verify', :runner, product_group: :pipeline_execution do describe "Trigger child pipeline with 'when:manual'" do let(:executor) { "qa-runner-#{Faker::Alphanumeric.alphanumeric(8)}" } diff --git a/qa/qa/specs/features/browser_ui/4_verify/pipeline/trigger_matrix_spec.rb b/qa/qa/specs/features/browser_ui/4_verify/pipeline/trigger_matrix_spec.rb index 205b4d1168a..6cf534dd21a 100644 --- a/qa/qa/specs/features/browser_ui/4_verify/pipeline/trigger_matrix_spec.rb +++ b/qa/qa/specs/features/browser_ui/4_verify/pipeline/trigger_matrix_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module QA - RSpec.describe 'Verify', :runner do + RSpec.describe 'Verify', :runner, product_group: :pipeline_authoring do describe 'Trigger matrix' do let(:executor) { "qa-runner-#{Faker::Alphanumeric.alphanumeric(8)}" } diff --git a/qa/qa/specs/features/browser_ui/4_verify/pipeline/update_ci_file_with_pipeline_editor_spec.rb b/qa/qa/specs/features/browser_ui/4_verify/pipeline/update_ci_file_with_pipeline_editor_spec.rb index d34df17c477..1f49c7a3663 100644 --- a/qa/qa/specs/features/browser_ui/4_verify/pipeline/update_ci_file_with_pipeline_editor_spec.rb +++ b/qa/qa/specs/features/browser_ui/4_verify/pipeline/update_ci_file_with_pipeline_editor_spec.rb @@ -2,7 +2,7 @@ module QA RSpec.describe 'Verify' do - describe 'Update CI file with pipeline editor' do + describe 'Update CI file with pipeline editor', product_group: :pipeline_authoring do let(:random_test_string) { SecureRandom.hex(10) } let(:project) do diff --git a/qa/qa/specs/features/browser_ui/4_verify/runner/register_runner_spec.rb b/qa/qa/specs/features/browser_ui/4_verify/runner/register_runner_spec.rb index f8261bba342..24c49be13bb 100644 --- a/qa/qa/specs/features/browser_ui/4_verify/runner/register_runner_spec.rb +++ b/qa/qa/specs/features/browser_ui/4_verify/runner/register_runner_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module QA - RSpec.describe 'Verify', :runner do + RSpec.describe 'Verify', :runner, product_group: :runner do describe 'Runner registration' do let(:executor) { "qa-runner-#{Time.now.to_i}" } let!(:runner) do diff --git a/qa/qa/specs/features/browser_ui/4_verify/testing/endpoint_coverage_spec.rb b/qa/qa/specs/features/browser_ui/4_verify/testing/endpoint_coverage_spec.rb index adcf91a550c..0166c53ffd5 100644 --- a/qa/qa/specs/features/browser_ui/4_verify/testing/endpoint_coverage_spec.rb +++ b/qa/qa/specs/features/browser_ui/4_verify/testing/endpoint_coverage_spec.rb @@ -9,7 +9,7 @@ module QA # pipeline created (Sidekiq read/write) -> # runner picks up pipeline (API read/write) -> # User views pipeline succeeds (Web read) - RSpec.describe 'Verify', :runner do + RSpec.describe 'Verify', :runner, product_group: :pipeline_insights do context 'Endpoint Coverage' do let!(:project) do Resource::Project.fabricate_via_api! do |project| diff --git a/qa/qa/specs/features/browser_ui/4_verify/testing/view_code_coverage_spec.rb b/qa/qa/specs/features/browser_ui/4_verify/testing/view_code_coverage_spec.rb index 122fb0fc1a0..2a4852a2b8b 100644 --- a/qa/qa/specs/features/browser_ui/4_verify/testing/view_code_coverage_spec.rb +++ b/qa/qa/specs/features/browser_ui/4_verify/testing/view_code_coverage_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module QA - RSpec.describe 'Verify', :runner do + RSpec.describe 'Verify', :runner, product_group: :pipeline_insights do describe 'Code coverage statistics' do let(:executor) { "qa-runner-#{Time.now.to_i}" } let(:runner) do diff --git a/scripts/lib/glfm/constants.rb b/scripts/lib/glfm/constants.rb index d020d2fec5c..c4feef8464e 100644 --- a/scripts/lib/glfm/constants.rb +++ b/scripts/lib/glfm/constants.rb @@ -15,24 +15,25 @@ module Glfm # GitLab Flavored Markdown specification files specification_input_glfm_path = specification_path.join('input/gitlab_flavored_markdown') - GLFM_INTRO_MD_PATH = specification_input_glfm_path.join('glfm_intro.md') - GLFM_OFFICIAL_SPECIFICATION_EXAMPLES_MD_PATH = - specification_input_glfm_path.join('glfm_official_specification_examples.md') - GLFM_INTERNAL_EXTENSION_EXAMPLES_MD_PATH = specification_input_glfm_path.join('glfm_internal_extension_examples.md') + GLFM_OFFICIAL_SPECIFICATION_MD_PATH = + specification_input_glfm_path.join('glfm_official_specification.md') + GLFM_INTERNAL_EXTENSIONS_MD_PATH = specification_input_glfm_path.join('glfm_internal_extensions.md') GLFM_EXAMPLE_STATUS_YML_PATH = specification_input_glfm_path.join('glfm_example_status.yml') GLFM_EXAMPLE_METADATA_YML_PATH = specification_input_glfm_path.join('glfm_example_metadata.yml') GLFM_EXAMPLE_NORMALIZATIONS_YML_PATH = specification_input_glfm_path.join('glfm_example_normalizations.yml') - GLFM_SPEC_OUTPUT_PATH = specification_path.join('output') - GLFM_SPEC_TXT_PATH = GLFM_SPEC_OUTPUT_PATH.join('spec.txt') - GLFM_SPEC_HTML_PATH = GLFM_SPEC_OUTPUT_PATH.join('spec.html') + GLFM_OUTPUT_SPEC_PATH = specification_path.join('output_spec') + GLFM_SPEC_TXT_PATH = GLFM_OUTPUT_SPEC_PATH.join('spec.txt') + GLFM_SPEC_HTML_PATH = GLFM_OUTPUT_SPEC_PATH.join('spec.html') # Example Snapshot (ES) files - EXAMPLE_SNAPSHOTS_PATH = File.expand_path("../../../glfm_specification/example_snapshots", __dir__) - ES_EXAMPLES_INDEX_YML_PATH = File.join(EXAMPLE_SNAPSHOTS_PATH, 'examples_index.yml') - ES_MARKDOWN_YML_PATH = File.join(EXAMPLE_SNAPSHOTS_PATH, 'markdown.yml') - ES_HTML_YML_PATH = File.join(EXAMPLE_SNAPSHOTS_PATH, 'html.yml') - ES_PROSEMIRROR_JSON_YML_PATH = File.join(EXAMPLE_SNAPSHOTS_PATH, 'prosemirror_json.yml') + ES_OUTPUT_EXAMPLE_SNAPSHOTS_PATH = specification_path.join('output_example_snapshots') + ES_SNAPSHOT_SPEC_MD_PATH = ES_OUTPUT_EXAMPLE_SNAPSHOTS_PATH.join('snapshot_spec.md') + ES_SNAPSHOT_SPEC_HTML_PATH = ES_OUTPUT_EXAMPLE_SNAPSHOTS_PATH.join('snapshot_spec.html') + ES_EXAMPLES_INDEX_YML_PATH = ES_OUTPUT_EXAMPLE_SNAPSHOTS_PATH.join('examples_index.yml') + ES_MARKDOWN_YML_PATH = ES_OUTPUT_EXAMPLE_SNAPSHOTS_PATH.join('markdown.yml') + ES_HTML_YML_PATH = ES_OUTPUT_EXAMPLE_SNAPSHOTS_PATH.join('html.yml') + ES_PROSEMIRROR_JSON_YML_PATH = ES_OUTPUT_EXAMPLE_SNAPSHOTS_PATH.join('prosemirror_json.yml') # Other constants used for processing files GLFM_SPEC_TXT_HEADER = <<~MARKDOWN @@ -41,8 +42,9 @@ module Glfm version: alpha ... MARKDOWN - INTRODUCTION_HEADER_LINE_TEXT = /\A# Introduction\Z/.freeze - END_TESTS_COMMENT_LINE_TEXT = /\A\Z/.freeze + INTRODUCTION_HEADER_LINE_TEXT = '# Introduction' + BEGIN_TESTS_COMMENT_LINE_TEXT = '' + END_TESTS_COMMENT_LINE_TEXT = '' MARKDOWN_TEMPFILE_BASENAME = %w[MARKDOWN_TEMPFILE_ .yml].freeze METADATA_TEMPFILE_BASENAME = %w[METADATA_TEMPFILE_ .yml].freeze STATIC_HTML_TEMPFILE_BASENAME = %w[STATIC_HTML_TEMPFILE_ .yml].freeze diff --git a/scripts/lib/glfm/update_example_snapshots.rb b/scripts/lib/glfm/update_example_snapshots.rb index 9075260e748..8f817d0173e 100644 --- a/scripts/lib/glfm/update_example_snapshots.rb +++ b/scripts/lib/glfm/update_example_snapshots.rb @@ -30,12 +30,12 @@ module Glfm def process(skip_static_and_wysiwyg: false) output('Updating example snapshots...') - output("Reading #{GLFM_SPEC_TXT_PATH}...") - glfm_spec_txt_lines = File.open(GLFM_SPEC_TXT_PATH).readlines + output("Reading #{ES_SNAPSHOT_SPEC_MD_PATH}...") + es_snapshot_spec_md_lines = File.open(ES_SNAPSHOT_SPEC_MD_PATH).readlines - # Parse all the examples from `spec.txt`, using a Ruby port of the Python `get_tests` + # Parse all the examples from `snapshot_spec.md`, using a Ruby port of the Python `get_tests` # function the from original CommonMark/GFM `spec_test.py` script. - all_examples = parse_examples(glfm_spec_txt_lines) + all_examples = parse_examples(es_snapshot_spec_md_lines) add_example_names(all_examples) @@ -55,7 +55,7 @@ module Glfm # in the H1 header count. So, even though due to the concatenation it appears before the # GitLab examples sections, it doesn't result in their header counts being off by +1. # 5. If an example contains the 'disabled' string extension, it is skipped (and will thus - # result in a skip in the `spec_txt_example_position`). This behavior is taken from the + # result in a skip in the `spec_example_position`). This behavior is taken from the # GFM `spec_test.py` script (but it's NOT in the original CommonMark `spec_test.py`). # 6. If a section contains ONLY disabled examples, the section numbering will still be # incremented to match the rendered HTML specification section numbering. @@ -202,7 +202,7 @@ module Glfm ) do |example, hash| name = example.fetch(:name).to_sym hash[name] = { - 'spec_txt_example_position' => example.fetch(:example), + 'spec_example_position' => example.fetch(:example), 'source_specification' => source_specification_for_extensions(example.fetch(:extensions)) } end diff --git a/scripts/lib/glfm/update_specification.rb b/scripts/lib/glfm/update_specification.rb index c7264547e44..521c0919f64 100644 --- a/scripts/lib/glfm/update_specification.rb +++ b/scripts/lib/glfm/update_specification.rb @@ -23,17 +23,42 @@ module Glfm def process(skip_spec_html_generation: false) output('Updating specification...') + # read and optionally update `input/github_flavored_markdown/ghfm_spec_v_x.yy.md` ghfm_spec_lines = load_ghfm_spec - glfm_spec_txt_string = build_glfm_spec_txt(ghfm_spec_lines) + + # create `output_spec/spec.txt` + glfm_spec_txt_header_lines = GLFM_SPEC_TXT_HEADER.split("\n").map { |line| "#{line}\n" } + official_spec_lines = readlines_from_path!(GLFM_OFFICIAL_SPECIFICATION_MD_PATH) + + glfm_spec_txt_string = (glfm_spec_txt_header_lines + official_spec_lines).join('') write_glfm_spec_txt(glfm_spec_txt_string) + # create `output_example_snapshots/snapshot_spec.md` + ghfm_spec_example_lines = extract_ghfm_spec_example_lines(ghfm_spec_lines) + official_spec_example_lines = + extract_glfm_spec_example_lines(official_spec_lines, GLFM_OFFICIAL_SPECIFICATION_MD_PATH) + internal_extension_lines = readlines_from_path!(GLFM_INTERNAL_EXTENSIONS_MD_PATH) + internal_extension_example_lines = + extract_glfm_spec_example_lines(internal_extension_lines, GLFM_INTERNAL_EXTENSIONS_MD_PATH) + snapshot_spec_md_string = ( + glfm_spec_txt_header_lines + + ghfm_spec_example_lines + + official_spec_example_lines + + ["\n"] + + internal_extension_example_lines + ).join('') + write_snapshot_spec_md(snapshot_spec_md_string) + if skip_spec_html_generation - output("Skipping GLFM spec.html generation...") + output("Skipping GLFM spec.html and snapshot_spec.html generation...") return end - glfm_spec_html_string = generate_glfm_spec_html(glfm_spec_txt_string) - write_glfm_spec_html(glfm_spec_html_string) + # create `output_spec/spec.html` and `output_snapshot_examples/snapshot_spec.html` + spec_html_string, snapshot_spec_html_string = + generate_spec_html_files(glfm_spec_txt_string, snapshot_spec_md_string) + write_spec_html(spec_html_string) + write_snapshot_spec_html(snapshot_spec_html_string) end private @@ -68,9 +93,7 @@ module Glfm ghfm_spec_txt_uri_parsed = URI.parse(GHFM_SPEC_TXT_URI) ghfm_spec_txt_uri_io = ghfm_spec_txt_uri_parsed.open - # Read IO stream into an array of lines for easy processing later - ghfm_spec_lines = ghfm_spec_txt_uri_io.readlines - raise "Unable to read lines from #{GHFM_SPEC_TXT_URI}" if ghfm_spec_lines.empty? + ghfm_spec_lines = readlines_from_io!(ghfm_spec_txt_uri_io, GHFM_SPEC_TXT_URI) # Make sure the GHFM spec version has not changed validate_expected_spec_version!(ghfm_spec_lines[2]) @@ -95,59 +118,42 @@ module Glfm "Expected 'version: #{GHFM_SPEC_VERSION}', got '#{version_line}'" end - def build_glfm_spec_txt(ghfm_spec_txt_lines) - glfm_spec_txt_lines = ghfm_spec_txt_lines.dup - replace_header(glfm_spec_txt_lines) - replace_intro_section(glfm_spec_txt_lines) - insert_examples(glfm_spec_txt_lines) - glfm_spec_txt_lines.join('') + def extract_ghfm_spec_example_lines(spec_lines) + # In the GHFM spec.txt format, all we have to identify the headers containing examples + # is the presence of a single initial H1 named "Introduction" before the first + # header containing examples, and the comment after the last header + # containing examples. + path = GHFM_SPEC_MD_PATH + first_examples_header_index = spec_lines.index do |line| + line.start_with?('# ') && !line.start_with?(INTRODUCTION_HEADER_LINE_TEXT) + end + raise "Unable to find first examples header in #{path}" unless first_examples_header_index + + end_tests_comment_index = spec_lines.index do |line| + line.start_with?(END_TESTS_COMMENT_LINE_TEXT) + end + raise "Unable to locate 'END TESTS' comment line in #{path}" if end_tests_comment_index.nil? + + spec_lines[first_examples_header_index..(end_tests_comment_index - 1)] end - def replace_header(spec_txt_lines) - spec_txt_lines[0, spec_txt_lines.index("...\n") + 1] = GLFM_SPEC_TXT_HEADER - end - - def replace_intro_section(spec_txt_lines) - glfm_intro_md_lines = File.open(GLFM_INTRO_MD_PATH).readlines - raise "Unable to read lines from #{GLFM_INTRO_MD_PATH}" if glfm_intro_md_lines.empty? - - ghfm_intro_header_begin_index = spec_txt_lines.index do |line| - line =~ INTRODUCTION_HEADER_LINE_TEXT + def extract_glfm_spec_example_lines(spec_lines, path) + # In the GLFM input markdown files (unlike the GLFM spec.txt format), we have control over + # the contents, so we can use explicit and + # is the presence of a single initial H1 named "Introduction" before the first + # header containing examples, and the comment after the last header + # containing examples. + begin_tests_comment_line_index = spec_lines.index do |line| + line.start_with?(BEGIN_TESTS_COMMENT_LINE_TEXT) end - raise "Unable to locate introduction header line in #{GHFM_SPEC_MD_PATH}" if ghfm_intro_header_begin_index.nil? + raise "Unable to locate 'BEGIN TESTS' comment line in #{path}" unless begin_tests_comment_line_index - # Find the index of the next header after the introduction header, starting from the index - # of the introduction header this is the length of the intro section - ghfm_intro_section_length = spec_txt_lines[ghfm_intro_header_begin_index + 1..].index do |line| - line.start_with?('# ') + end_tests_comment_index = spec_lines.index do |line| + line.start_with?(END_TESTS_COMMENT_LINE_TEXT) end + raise "Unable to locate 'END TESTS' comment line in #{path}" if end_tests_comment_index.nil? - # Replace the intro section with the GitLab flavored Markdown intro section - spec_txt_lines[ghfm_intro_header_begin_index, ghfm_intro_section_length] = glfm_intro_md_lines - end - - def insert_examples(spec_txt_lines) - official_spec_lines = File.open(GLFM_OFFICIAL_SPECIFICATION_EXAMPLES_MD_PATH).readlines - raise "Unable to read lines from #{GLFM_OFFICIAL_SPECIFICATION_EXAMPLES_MD_PATH}" if official_spec_lines.empty? - - internal_extension_lines = File.open(GLFM_INTERNAL_EXTENSION_EXAMPLES_MD_PATH).readlines - raise "Unable to read lines from #{GLFM_INTERNAL_EXTENSION_EXAMPLES_MD_PATH}" if internal_extension_lines.empty? - - ghfm_end_tests_comment_index = spec_txt_lines.index do |line| - line =~ END_TESTS_COMMENT_LINE_TEXT - end - raise "Unable to locate 'END TESTS' comment line in #{GHFM_SPEC_MD_PATH}" if ghfm_end_tests_comment_index.nil? - - # Insert the GLFM examples before the 'END TESTS' comment line - spec_txt_lines[ghfm_end_tests_comment_index - 1] = [ - "\n", - official_spec_lines, - "\n", - internal_extension_lines, - "\n" - ].flatten - - spec_txt_lines + spec_lines[(begin_tests_comment_line_index + 1)..(end_tests_comment_index - 1)] end def write_glfm_spec_txt(glfm_spec_txt_string) @@ -156,13 +162,21 @@ module Glfm write_file(GLFM_SPEC_TXT_PATH, glfm_spec_txt_string) end - def generate_glfm_spec_html(glfm_spec_txt_string) - output("Generating spec.html from spec.txt markdown...") + def write_snapshot_spec_md(snapshot_spec_md_string) + output("Writing #{ES_SNAPSHOT_SPEC_MD_PATH}...") + FileUtils.mkdir_p(Pathname.new(ES_SNAPSHOT_SPEC_MD_PATH).dirname) + write_file(ES_SNAPSHOT_SPEC_MD_PATH, snapshot_spec_md_string) + end + + def generate_spec_html_files(spec_txt_string, snapshot_spec_md_string) + output("Generating spec.html and snapshot_spec.html from spec.txt and snapshot_spec.md markdown...") input_markdown_yml_string = <<~MARKDOWN --- spec_txt: | - #{glfm_spec_txt_string.gsub(/^/, ' ')} + #{spec_txt_string.gsub(/^/, ' ')} + snapshot_spec_md: | + #{snapshot_spec_md_string.gsub(/^/, ' ')} MARKDOWN # NOTE: We must copy the input YAML file used by the `render_static_html.rb` @@ -190,14 +204,33 @@ module Glfm cmd = %(bin/rspec #{__dir__}/render_static_html.rb) run_external_cmd(cmd) - output("Reading generated spec.html from tempfile #{static_html_tempfile_path}...") - YAML.safe_load(File.open(static_html_tempfile_path), symbolize_names: true).fetch(:spec_txt) + output("Reading generated html from tempfile #{static_html_tempfile_path}...") + rendered_html_hash = YAML.safe_load(File.open(static_html_tempfile_path), symbolize_names: true) + [rendered_html_hash.fetch(:spec_txt), rendered_html_hash.fetch(:snapshot_spec_md)] end - def write_glfm_spec_html(glfm_spec_html_string) + def write_spec_html(spec_html_string) output("Writing #{GLFM_SPEC_TXT_PATH}...") FileUtils.mkdir_p(Pathname.new(GLFM_SPEC_HTML_PATH).dirname) - write_file(GLFM_SPEC_HTML_PATH, "#{glfm_spec_html_string}\n") + write_file(GLFM_SPEC_HTML_PATH, "#{spec_html_string}\n") + end + + def write_snapshot_spec_html(snapshot_spec_html_string) + output("Writing #{ES_SNAPSHOT_SPEC_HTML_PATH}...") + FileUtils.mkdir_p(Pathname.new(ES_SNAPSHOT_SPEC_HTML_PATH).dirname) + write_file(ES_SNAPSHOT_SPEC_HTML_PATH, "#{snapshot_spec_html_string}\n") + end + + def readlines_from_path!(path) + io = File.open(path) + readlines_from_io!(io, path) + end + + def readlines_from_io!(io, uri_or_path) + lines = io.readlines + raise "Unable to read lines from #{uri_or_path}" if lines.empty? + + lines end end end diff --git a/scripts/lib/glfm/verify_all_generated_files_are_up_to_date.rb b/scripts/lib/glfm/verify_all_generated_files_are_up_to_date.rb index 0b824fc589d..a928c78bfc6 100644 --- a/scripts/lib/glfm/verify_all_generated_files_are_up_to_date.rb +++ b/scripts/lib/glfm/verify_all_generated_files_are_up_to_date.rb @@ -12,7 +12,7 @@ module Glfm include Shared def process - verify_cmd = "git status --porcelain #{GLFM_SPEC_OUTPUT_PATH} #{EXAMPLE_SNAPSHOTS_PATH}" + verify_cmd = "git status --porcelain #{GLFM_OUTPUT_SPEC_PATH} #{ES_OUTPUT_EXAMPLE_SNAPSHOTS_PATH}" verify_cmd_output = run_external_cmd(verify_cmd) unless verify_cmd_output.empty? msg = "ERROR: Cannot run `#{__FILE__}` because `#{verify_cmd}` shows the following uncommitted changes:\n" \ diff --git a/spec/graphql/types/permission_types/ci/runner_spec.rb b/spec/graphql/types/permission_types/ci/runner_spec.rb index e5fbbb346e4..b4685794950 100644 --- a/spec/graphql/types/permission_types/ci/runner_spec.rb +++ b/spec/graphql/types/permission_types/ci/runner_spec.rb @@ -5,7 +5,7 @@ require 'spec_helper' RSpec.describe Types::PermissionTypes::Ci::Runner do it do expected_permissions = [ - :read_runner, :update_runner, :delete_runner + :read_runner, :update_runner, :delete_runner, :assign_runner ] expected_permissions.each do |permission| diff --git a/spec/models/integration_spec.rb b/spec/models/integration_spec.rb index 5dc004d661c..3cd08479977 100644 --- a/spec/models/integration_spec.rb +++ b/spec/models/integration_spec.rb @@ -15,6 +15,23 @@ RSpec.describe Integration do it { is_expected.to have_one(:jira_tracker_data).autosave(true).inverse_of(:integration).with_foreign_key(:integration_id).class_name('Integrations::JiraTrackerData') } end + describe 'default values' do + it { is_expected.to be_alert_events } + it { is_expected.to be_commit_events } + it { is_expected.to be_confidential_issues_events } + it { is_expected.to be_confidential_note_events } + it { is_expected.to be_issues_events } + it { is_expected.to be_job_events } + it { is_expected.to be_merge_requests_events } + it { is_expected.to be_note_events } + it { is_expected.to be_pipeline_events } + it { is_expected.to be_push_events } + it { is_expected.to be_tag_push_events } + it { is_expected.to be_wiki_page_events } + it { is_expected.not_to be_active } + it { expect(subject.category).to eq(:common) } + end + describe 'validations' do it { is_expected.to validate_presence_of(:type) } it { is_expected.to validate_exclusion_of(:type).in_array(described_class::BASE_CLASSES) } diff --git a/spec/requests/api/graphql/ci/runner_spec.rb b/spec/requests/api/graphql/ci/runner_spec.rb index bd90753f9ad..94c0a3c41bd 100644 --- a/spec/requests/api/graphql/ci/runner_spec.rb +++ b/spec/requests/api/graphql/ci/runner_spec.rb @@ -104,7 +104,8 @@ RSpec.describe 'Query.runner(id)' do 'userPermissions' => { 'readRunner' => true, 'updateRunner' => true, - 'deleteRunner' => true + 'deleteRunner' => true, + 'assignRunner' => true } ) expect(runner_data['tagList']).to match_array runner.tag_list diff --git a/spec/scripts/lib/glfm/update_example_snapshots_spec.rb b/spec/scripts/lib/glfm/update_example_snapshots_spec.rb index c97226c1a2d..f28a33045ff 100644 --- a/spec/scripts/lib/glfm/update_example_snapshots_spec.rb +++ b/spec/scripts/lib/glfm/update_example_snapshots_spec.rb @@ -32,8 +32,8 @@ RSpec.describe Glfm::UpdateExampleSnapshots, '#process' do subject { described_class.new } # GLFM input files - let(:glfm_spec_txt_path) { described_class::GLFM_SPEC_TXT_PATH } - let(:glfm_spec_txt_local_io) { StringIO.new(glfm_spec_txt_contents) } + let(:es_snapshot_spec_md_path) { described_class::ES_SNAPSHOT_SPEC_MD_PATH } + let(:es_snapshot_spec_md_local_io) { StringIO.new(es_snapshot_spec_md_contents) } let(:glfm_example_status_yml_path) { described_class::GLFM_EXAMPLE_STATUS_YML_PATH } let(:glfm_example_metadata_yml_path) { described_class::GLFM_EXAMPLE_METADATA_YML_PATH } let(:glfm_example_normalizations_yml_path) { described_class::GLFM_EXAMPLE_NORMALIZATIONS_YML_PATH } @@ -53,16 +53,11 @@ RSpec.describe Glfm::UpdateExampleSnapshots, '#process' do # Internal tempfiles let(:static_html_tempfile_path) { Tempfile.new.path } - let(:glfm_spec_txt_contents) do + let(:es_snapshot_spec_md_contents) do <<~MARKDOWN --- title: GitLab Flavored Markdown Spec ... - - # Introduction - - GLFM intro text... - # Inlines ## Strong @@ -96,7 +91,7 @@ RSpec.describe Glfm::UpdateExampleSnapshots, '#process' do ### Another H3 This is a second consecutive third-level heading. It exists to drive full code coverage - for this scenario, although it doesn't (yet) exist in the actual spec.txt. + for this scenario, although it doesn't (yet) exist in the actual snapshot_spec.md. ## An H2 with all disabled examples @@ -243,12 +238,6 @@ RSpec.describe Glfm::UpdateExampleSnapshots, '#process' do .

                                            project-wikis-test-file

                                            ```````````````````````````````` - - - - # Appendix - - Appendix text. MARKDOWN end @@ -305,11 +294,11 @@ RSpec.describe Glfm::UpdateExampleSnapshots, '#process' do --- 01_00_00__obsolete_entry_to_be_deleted__001: canonical: | - This entry is no longer exists in the spec.txt, so it will be deleted. + This entry is no longer exists in the snapshot_spec.md, so it will be deleted. static: |- - This entry is no longer exists in the spec.txt, so it will be deleted. + This entry is no longer exists in the snapshot_spec.md, so it will be deleted. wysiwyg: |- - This entry is no longer exists in the spec.txt, so it will be deleted. + This entry is no longer exists in the snapshot_spec.md, so it will be deleted. 02_01_00__inlines__strong__001: canonical: | This entry is existing, but not skipped, so it will be overwritten. @@ -332,7 +321,7 @@ RSpec.describe Glfm::UpdateExampleSnapshots, '#process' do --- 01_00_00__obsolete_entry_to_be_deleted__001: |- { - "obsolete": "This entry is no longer exists in the spec.txt, and is not skipped, so it will be deleted." + "obsolete": "This entry is no longer exists in the snapshot_spec.md, and is not skipped, so it will be deleted." } 02_01_00__inlines__strong__001: |- { @@ -370,7 +359,7 @@ RSpec.describe Glfm::UpdateExampleSnapshots, '#process' do # actual network and filesystem I/O during the spec run. # input files - allow(File).to receive(:open).with(glfm_spec_txt_path) { glfm_spec_txt_local_io } + allow(File).to receive(:open).with(es_snapshot_spec_md_path) { es_snapshot_spec_md_local_io } allow(File).to receive(:open).with(glfm_example_status_yml_path) do StringIO.new(glfm_example_status_yml_contents) end @@ -454,43 +443,43 @@ RSpec.describe Glfm::UpdateExampleSnapshots, '#process' do <<~YAML --- 02_01_00__inlines__strong__001: - spec_txt_example_position: 1 + spec_example_position: 1 source_specification: commonmark 02_01_00__inlines__strong__002: - spec_txt_example_position: 2 + spec_example_position: 2 source_specification: github 02_03_00__inlines__strikethrough_extension__001: - spec_txt_example_position: 4 + spec_example_position: 4 source_specification: github 03_01_00__first_gitlab_specific_section_with_examples__strong_but_with_two_asterisks__001: - spec_txt_example_position: 5 + spec_example_position: 5 source_specification: gitlab 03_02_01__first_gitlab_specific_section_with_examples__h2_which_contains_an_h3__example_in_an_h3__001: - spec_txt_example_position: 6 + spec_example_position: 6 source_specification: gitlab 04_01_00__second_gitlab_specific_section_with_examples__strong_but_with_html__001: - spec_txt_example_position: 7 + spec_example_position: 7 source_specification: gitlab 05_01_00__third_gitlab_specific_section_with_skipped_examples__strong_but_skipped__001: - spec_txt_example_position: 8 + spec_example_position: 8 source_specification: gitlab 05_02_00__third_gitlab_specific_section_with_skipped_examples__strong_but_manually_modified_and_skipped__001: - spec_txt_example_position: 9 + spec_example_position: 9 source_specification: gitlab 06_01_00__api_request_overrides__group_upload_link__001: - spec_txt_example_position: 10 + spec_example_position: 10 source_specification: gitlab 06_02_00__api_request_overrides__project_repo_link__001: - spec_txt_example_position: 11 + spec_example_position: 11 source_specification: gitlab 06_03_00__api_request_overrides__project_snippet_ref__001: - spec_txt_example_position: 12 + spec_example_position: 12 source_specification: gitlab 06_04_00__api_request_overrides__personal_snippet_ref__001: - spec_txt_example_position: 13 + spec_example_position: 13 source_specification: gitlab 06_05_00__api_request_overrides__project_wiki_link__001: - spec_txt_example_position: 14 + spec_example_position: 14 source_specification: gitlab YAML end diff --git a/spec/scripts/lib/glfm/update_specification_spec.rb b/spec/scripts/lib/glfm/update_specification_spec.rb index 83af7cc7ca9..8a7d7100363 100644 --- a/spec/scripts/lib/glfm/update_specification_spec.rb +++ b/spec/scripts/lib/glfm/update_specification_spec.rb @@ -37,18 +37,36 @@ RSpec.describe Glfm::UpdateSpecification, '#process' do let(:ghfm_spec_md_path) { described_class::GHFM_SPEC_MD_PATH } let(:ghfm_spec_txt_local_io) { StringIO.new(ghfm_spec_txt_contents) } - let(:glfm_intro_md_path) { described_class::GLFM_INTRO_MD_PATH } - let(:glfm_intro_md_io) { StringIO.new(glfm_intro_md_contents) } - let(:glfm_official_specification_examples_md_path) { described_class::GLFM_OFFICIAL_SPECIFICATION_EXAMPLES_MD_PATH } - let(:glfm_official_specification_examples_md_io) { StringIO.new(glfm_official_specification_examples_md_contents) } - let(:glfm_internal_extension_examples_md_path) { described_class::GLFM_INTERNAL_EXTENSION_EXAMPLES_MD_PATH } - let(:glfm_internal_extension_examples_md_io) { StringIO.new(glfm_internal_extension_examples_md_contents) } + let(:glfm_official_specification_md_path) { described_class::GLFM_OFFICIAL_SPECIFICATION_MD_PATH } + let(:glfm_official_specification_md_io) { StringIO.new(glfm_official_specification_md_contents) } + let(:glfm_internal_extensions_md_path) { described_class::GLFM_INTERNAL_EXTENSIONS_MD_PATH } + let(:glfm_internal_extensions_md_io) { StringIO.new(glfm_internal_extensions_md_contents) } let(:glfm_spec_txt_path) { described_class::GLFM_SPEC_TXT_PATH } let(:glfm_spec_txt_io) { StringIO.new } let(:glfm_spec_html_path) { described_class::GLFM_SPEC_HTML_PATH } let(:glfm_spec_html_io) { StringIO.new } + let(:es_snapshot_spec_md_path) { described_class::ES_SNAPSHOT_SPEC_MD_PATH } + let(:es_snapshot_spec_md_io) { StringIO.new } + let(:es_snapshot_spec_html_path) { described_class::ES_SNAPSHOT_SPEC_HTML_PATH } + let(:es_snapshot_spec_html_io) { StringIO.new } let(:markdown_tempfile_io) { StringIO.new } + let(:ghfm_spec_txt_examples) do + <<~MARKDOWN + # Section with Examples + + ## Strong + + ```````````````````````````````` example + __bold__ + . +

                                            bold

                                            + ```````````````````````````````` + + End of last GitHub examples section. + MARKDOWN + end + let(:ghfm_spec_txt_contents) do <<~MARKDOWN --- @@ -60,22 +78,9 @@ RSpec.describe Glfm::UpdateSpecification, '#process' do # Introduction - ## What is GitHub Flavored Markdown? - - It's like GLFM, but with an H. - - # Section with Examples - - ## Strong - - ```````````````````````````````` example - __bold__ - . -

                                            bold

                                            - ```````````````````````````````` - - End of last GitHub examples section. + GHFM Intro. + #{ghfm_spec_txt_examples} # Appendix @@ -84,18 +89,7 @@ RSpec.describe Glfm::UpdateSpecification, '#process' do MARKDOWN end - let(:glfm_intro_md_contents) do - # language=Markdown - <<~MARKDOWN - # Introduction - - ## What is GitLab Flavored Markdown? - - Intro text about GitLab Flavored Markdown. - MARKDOWN - end - - let(:glfm_official_specification_examples_md_contents) do + let(:glfm_official_specification_md_examples) do <<~MARKDOWN # Official Specification Section with Examples @@ -103,7 +97,20 @@ RSpec.describe Glfm::UpdateSpecification, '#process' do MARKDOWN end - let(:glfm_internal_extension_examples_md_contents) do + let(:glfm_official_specification_md_contents) do + <<~MARKDOWN + # GLFM Introduction + + GLFM intro text. + + + #{glfm_official_specification_md_examples} + + # Non-example official content + MARKDOWN + end + + let(:glfm_internal_extensions_md_examples) do <<~MARKDOWN # Internal Extension Section with Examples @@ -111,6 +118,16 @@ RSpec.describe Glfm::UpdateSpecification, '#process' do MARKDOWN end + let(:glfm_internal_extensions_md_contents) do + <<~MARKDOWN + # Non-example internal content + + #{glfm_internal_extensions_md_examples} + + # More non-example internal content + MARKDOWN + end + before do # Mock default ENV var values stub_env('UPDATE_GHFM_SPEC_MD') @@ -123,17 +140,18 @@ RSpec.describe Glfm::UpdateSpecification, '#process' do allow(URI).to receive(:parse).with(ghfm_spec_txt_uri).and_return(ghfm_spec_txt_uri_parsed) allow(ghfm_spec_txt_uri_parsed).to receive(:open).and_return(ghfm_spec_txt_uri_io) allow(File).to receive(:open).with(ghfm_spec_md_path) { ghfm_spec_txt_local_io } - allow(File).to receive(:open).with(glfm_intro_md_path) { glfm_intro_md_io } - allow(File).to receive(:open).with(glfm_official_specification_examples_md_path) do - glfm_official_specification_examples_md_io + allow(File).to receive(:open).with(glfm_official_specification_md_path) do + glfm_official_specification_md_io end - allow(File).to receive(:open).with(glfm_internal_extension_examples_md_path) do - glfm_internal_extension_examples_md_io + allow(File).to receive(:open).with(glfm_internal_extensions_md_path) do + glfm_internal_extensions_md_io end # output files allow(File).to receive(:open).with(glfm_spec_txt_path, 'w') { glfm_spec_txt_io } allow(File).to receive(:open).with(glfm_spec_html_path, 'w') { glfm_spec_html_io } + allow(File).to receive(:open).with(es_snapshot_spec_md_path, 'w') { es_snapshot_spec_md_io } + allow(File).to receive(:open).with(es_snapshot_spec_html_path, 'w') { es_snapshot_spec_html_io } # Allow normal opening of Tempfile files created during script execution. tempfile_basenames = [ @@ -216,90 +234,109 @@ RSpec.describe Glfm::UpdateSpecification, '#process' do end end - describe 'writing GLFM spec.txt' do - let(:glfm_contents) { reread_io(glfm_spec_txt_io) } + describe 'writing output_spec/spec.txt' do + let(:glfm_spec_txt_contents) { reread_io(glfm_spec_txt_io) } + + before do + subject.process(skip_spec_html_generation: true) + end + + it 'includes only the header and official examples' do + expected = described_class::GLFM_SPEC_TXT_HEADER + glfm_official_specification_md_contents + expect(glfm_spec_txt_contents).to eq(expected) + end + end + + describe 'writing output_example_snapshots/snapshot_spec.md' do + let(:es_snapshot_spec_md_contents) { reread_io(es_snapshot_spec_md_io) } before do subject.process(skip_spec_html_generation: true) end it 'replaces the header text with the GitLab version' do - expect(glfm_contents).not_to match(/GitHub Flavored Markdown Spec/m) - expect(glfm_contents).not_to match(/^version: \d\.\d/m) - expect(glfm_contents).not_to match(/^date: /m) - expect(glfm_contents).not_to match(/^license: /m) - expect(glfm_contents).to match(/#{Regexp.escape(described_class::GLFM_SPEC_TXT_HEADER)}\n/mo) + expect(es_snapshot_spec_md_contents).not_to match(/GitHub Flavored Markdown Spec/m) + expect(es_snapshot_spec_md_contents).not_to match(/^version: \d\.\d/m) + expect(es_snapshot_spec_md_contents).not_to match(/^date: /m) + + expect(es_snapshot_spec_md_contents).to match(/#{Regexp.escape(described_class::GLFM_SPEC_TXT_HEADER)}/mo) end - it 'replaces the intro section with the GitLab version' do - expect(glfm_contents).not_to match(/What is GitHub Flavored Markdown/m) - expect(glfm_contents).to match(/#{Regexp.escape(glfm_intro_md_contents)}/m) - end - - it 'inserts the GitLab official spec and internal extension examples sections before the appendix section' do - expected = <<~MARKDOWN - End of last GitHub examples section. - - # Official Specification Section with Examples - - Some examples. - - # Internal Extension Section with Examples - - Some examples. - - - - # Appendix - MARKDOWN - expect(glfm_contents).to match(/#{Regexp.escape(expected)}/m) + it 'includes header and all examples', :unlimited_max_formatted_output_length do + # rubocop:disable Style/StringConcatenation (string contatenation is more readable) + expected = described_class::GLFM_SPEC_TXT_HEADER + + ghfm_spec_txt_examples + + "\n" + + glfm_official_specification_md_examples + + "\n\n" + # NOTE: We want a blank line between the official and internal examples + glfm_internal_extensions_md_examples + + "\n" + # rubocop:enable Style/StringConcatenation + expect(es_snapshot_spec_md_contents).to eq(expected) end end - describe 'writing GLFM spec.html' do - let(:glfm_contents) { reread_io(glfm_spec_html_io) } + # rubocop:disable RSpec/MultipleMemoizedHelpers + describe 'writing output html files' do + let(:spec_html_contents) { reread_io(glfm_spec_html_io) } + let(:snapshot_spec_html_contents) { reread_io(es_snapshot_spec_html_io) } before do subject.process end - it 'renders HTML from spec.txt', :unlimited_max_formatted_output_length do - expected = <<~HTML + it 'renders expected HTML', :unlimited_max_formatted_output_length do + # NOTE: We do assertions for both output HTML files in this same `it` example block, + # because calling a full `subject.process` without `skip_spec_html_generation: true` + # is very slow, and want to avoid doing it twice. + + expected_spec_html = <<~RENDERED_HTML
                                            title: GitLab Flavored Markdown (GLFM) Spec
                                                     version: alpha
                                            -

                                            - Introduction

                                            -

                                            - What is GitLab Flavored Markdown?

                                            -

                                            Intro text about GitLab Flavored Markdown.

                                            -

                                            +

                                            + GLFM Introduction

                                            +

                                            GLFM intro text.

                                            + +

                                            + Official Specification Section with Examples

                                            +

                                            Some examples.

                                            + +

                                            + Non-example official content

                                            + RENDERED_HTML + expect(spec_html_contents).to be == expected_spec_html + + expected_snapshot_spec_html = <<~RENDERED_HTML +
                                            +
                                            title: GitLab Flavored Markdown (GLFM) Spec
                                            +        version: alpha
                                            + +
                                            +

                                            Section with Examples

                                            -

                                            +

                                            Strong

                                            -
                                            __bold__
                                            +        
                                            __bold__
                                                     .
                                                     <p><strong>bold</strong></p>
                                            -

                                            End of last GitHub examples section.

                                            -

                                            +

                                            End of last GitHub examples section.

                                            +

                                            Official Specification Section with Examples

                                            -

                                            Some examples.

                                            -

                                            +

                                            Some examples.

                                            +

                                            Internal Extension Section with Examples

                                            -

                                            Some examples.

                                            - -

                                            - Appendix

                                            -

                                            Appendix text.

                                            - HTML - expect(glfm_contents).to be == expected +

                                            Some examples.

                                            + RENDERED_HTML + expect(snapshot_spec_html_contents).to be == expected_snapshot_spec_html end end + # rubocop:enable RSpec/MultipleMemoizedHelpers def reread_io(io) # Reset the io StringIO to the beginning position of the buffer diff --git a/spec/scripts/lib/glfm/verify_all_generated_files_are_up_to_date_spec.rb b/spec/scripts/lib/glfm/verify_all_generated_files_are_up_to_date_spec.rb index fca037c9ff3..a1fd5d080e1 100644 --- a/spec/scripts/lib/glfm/verify_all_generated_files_are_up_to_date_spec.rb +++ b/spec/scripts/lib/glfm/verify_all_generated_files_are_up_to_date_spec.rb @@ -9,8 +9,8 @@ require_relative '../../../../scripts/lib/glfm/verify_all_generated_files_are_up RSpec.describe Glfm::VerifyAllGeneratedFilesAreUpToDate, '#process' do subject { described_class.new } - let(:output_path) { described_class::GLFM_SPEC_OUTPUT_PATH } - let(:snapshots_path) { described_class::EXAMPLE_SNAPSHOTS_PATH } + let(:output_path) { described_class::GLFM_OUTPUT_SPEC_PATH } + let(:snapshots_path) { described_class::ES_OUTPUT_EXAMPLE_SNAPSHOTS_PATH } let(:verify_cmd) { "git status --porcelain #{output_path} #{snapshots_path}" } before do diff --git a/spec/services/clusters/kubernetes/configure_istio_ingress_service_spec.rb b/spec/services/clusters/kubernetes/configure_istio_ingress_service_spec.rb deleted file mode 100644 index f26177a56d0..00000000000 --- a/spec/services/clusters/kubernetes/configure_istio_ingress_service_spec.rb +++ /dev/null @@ -1,223 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -RSpec.describe Clusters::Kubernetes::ConfigureIstioIngressService, '#execute' do - include KubernetesHelpers - - let(:cluster) { create(:cluster, :project, :provided_by_gcp) } - let(:api_url) { 'https://kubernetes.example.com' } - let(:project) { cluster.project } - let(:environment) { create(:environment, project: project) } - let(:cluster_project) { cluster.cluster_project } - let(:namespace) { "#{project.name}-#{project.id}-#{environment.slug}" } - let(:kubeclient) { cluster.kubeclient } - - subject do - described_class.new( - cluster: cluster - ).execute - end - - before do - stub_kubeclient_discover_istio(api_url) - stub_kubeclient_create_secret(api_url, namespace: namespace) - stub_kubeclient_put_secret(api_url, "#{namespace}-token", namespace: namespace) - - stub_kubeclient_get_secret( - api_url, - metadata_name: "#{namespace}-token", - token: Base64.encode64('sample-token'), - namespace: namespace - ) - - stub_kubeclient_get_secret( - api_url, - metadata_name: 'istio-ingressgateway-ca-certs', - namespace: 'istio-system' - ) - - stub_kubeclient_get_secret( - api_url, - metadata_name: 'istio-ingressgateway-certs', - namespace: 'istio-system' - ) - - stub_kubeclient_put_secret(api_url, 'istio-ingressgateway-ca-certs', namespace: 'istio-system') - stub_kubeclient_put_secret(api_url, 'istio-ingressgateway-certs', namespace: 'istio-system') - stub_kubeclient_get_gateway(api_url, 'knative-ingress-gateway', namespace: 'knative-serving') - stub_kubeclient_put_gateway(api_url, 'knative-ingress-gateway', namespace: 'knative-serving') - end - - context 'without a serverless_domain_cluster' do - it 'configures gateway to use PASSTHROUGH' do - subject - - expect(WebMock).to have_requested(:put, api_url + '/apis/networking.istio.io/v1alpha3/namespaces/knative-serving/gateways/knative-ingress-gateway').with( - body: hash_including( - apiVersion: "networking.istio.io/v1alpha3", - kind: "Gateway", - metadata: { - generation: 1, - labels: { - "networking.knative.dev/ingress-provider" => "istio", - "serving.knative.dev/release" => "v0.7.0" - }, - name: "knative-ingress-gateway", - namespace: "knative-serving", - selfLink: "/apis/networking.istio.io/v1alpha3/namespaces/knative-serving/gateways/knative-ingress-gateway" - }, - spec: { - selector: { - istio: "ingressgateway" - }, - servers: [ - { - hosts: ["*"], - port: { - name: "http", - number: 80, - protocol: "HTTP" - } - }, - { - hosts: ["*"], - port: { - name: "https", - number: 443, - protocol: "HTTPS" - }, - tls: { - mode: "PASSTHROUGH" - } - } - ] - } - ) - ) - end - end - - context 'with a serverless_domain_cluster' do - let(:serverless_domain_cluster) { create(:serverless_domain_cluster) } - let(:certificate) { OpenSSL::X509::Certificate.new(serverless_domain_cluster.certificate) } - - before do - cluster.application_knative = serverless_domain_cluster.knative - end - - it 'configures certificates' do - subject - - expect(serverless_domain_cluster.reload.key).not_to be_blank - expect(serverless_domain_cluster.reload.certificate).not_to be_blank - - expect(certificate.subject.to_s).to include(serverless_domain_cluster.knative.hostname) - - expect(certificate.not_before).to be_within(1.minute).of(Time.current) - expect(certificate.not_after).to be_within(1.minute).of(Time.current + 1000.years) - - expect(WebMock).to have_requested(:put, api_url + '/api/v1/namespaces/istio-system/secrets/istio-ingressgateway-ca-certs').with( - body: hash_including( - metadata: { - name: 'istio-ingressgateway-ca-certs', - namespace: 'istio-system' - }, - type: 'Opaque' - ) - ) - - expect(WebMock).to have_requested(:put, api_url + '/api/v1/namespaces/istio-system/secrets/istio-ingressgateway-certs').with( - body: hash_including( - metadata: { - name: 'istio-ingressgateway-certs', - namespace: 'istio-system' - }, - type: 'kubernetes.io/tls' - ) - ) - end - - it 'configures gateway to use MUTUAL' do - subject - - expect(WebMock).to have_requested(:put, api_url + '/apis/networking.istio.io/v1alpha3/namespaces/knative-serving/gateways/knative-ingress-gateway').with( - body: { - apiVersion: "networking.istio.io/v1alpha3", - kind: "Gateway", - metadata: { - generation: 1, - labels: { - "networking.knative.dev/ingress-provider" => "istio", - "serving.knative.dev/release" => "v0.7.0" - }, - name: "knative-ingress-gateway", - namespace: "knative-serving", - selfLink: "/apis/networking.istio.io/v1alpha3/namespaces/knative-serving/gateways/knative-ingress-gateway" - }, - spec: { - selector: { - istio: "ingressgateway" - }, - servers: [ - { - hosts: ["*"], - port: { - name: "http", - number: 80, - protocol: "HTTP" - } - }, - { - hosts: ["*"], - port: { - name: "https", - number: 443, - protocol: "HTTPS" - }, - tls: { - mode: "MUTUAL", - privateKey: "/etc/istio/ingressgateway-certs/tls.key", - serverCertificate: "/etc/istio/ingressgateway-certs/tls.crt", - caCertificates: "/etc/istio/ingressgateway-ca-certs/cert.pem" - } - } - ] - } - } - ) - end - end - - context 'when there is an error' do - before do - cluster.application_knative = create(:clusters_applications_knative) - - allow_next_instance_of(described_class) do |instance| - allow(instance).to receive(:configure_passthrough).and_raise(error) - end - end - - context 'Kubeclient::HttpError' do - let(:error) { Kubeclient::HttpError.new(404, nil, nil) } - - it 'puts Knative into an errored state' do - subject - - expect(cluster.application_knative).to be_errored - expect(cluster.application_knative.status_reason).to eq('Kubernetes error: 404') - end - end - - context 'StandardError' do - let(:error) { RuntimeError.new('something went wrong') } - - it 'puts Knative into an errored state' do - subject - - expect(cluster.application_knative).to be_errored - expect(cluster.application_knative.status_reason).to eq('Failed to update.') - end - end - end -end diff --git a/spec/services/git/base_hooks_service_spec.rb b/spec/services/git/base_hooks_service_spec.rb index a8d753ff124..9c59b2d1c0b 100644 --- a/spec/services/git/base_hooks_service_spec.rb +++ b/spec/services/git/base_hooks_service_spec.rb @@ -150,11 +150,16 @@ RSpec.describe Git::BaseHooksService do end shared_examples 'creates pipeline with params and expected variables' do + let(:pipeline_service) { double(execute: service_response) } + let(:service_response) { double(error?: false, payload: pipeline, message: "Error") } + let(:pipeline) { double(persisted?: true) } + it 'calls the create pipeline service' do expect(Ci::CreatePipelineService) .to receive(:new) .with(project, user, pipeline_params) - .and_return(double(execute!: true)) + .and_return(pipeline_service) + expect(subject).not_to receive(:log_pipeline_errors) subject.execute end @@ -239,4 +244,141 @@ RSpec.describe Git::BaseHooksService do it_behaves_like 'creates pipeline with params and expected variables' end end + + describe "Pipeline creation" do + context "when refactored_create_pipeline_execution_method feature flag is disabled" do + before do + stub_feature_flags(refactored_create_pipeline_execution_method: false) + end + + let(:pipeline_params) do + { + after: newrev, + before: oldrev, + checkout_sha: checkout_sha, + push_options: push_options, + ref: ref, + variables_attributes: variables_attributes + } + end + + let(:push_options) { {} } + let(:variables_attributes) { [] } + + context 'creates pipeline with params and expected variables' do + it 'calls the create pipeline service' do + expect(Ci::CreatePipelineService) + .to receive(:new) + .with(project, user, pipeline_params) + .and_return(double(execute!: true)) + + subject.execute + end + end + + context 'when logs pipeline errors' do + let(:pipeline) { double(persisted?: false) } + let(:service_response) { double(error?: true, payload: pipeline, message: "Error") } + let(:create_error_string) { Ci::CreatePipelineService::CreateError.new.to_s } + + before do + allow(Ci::CreatePipelineService).to receive(:new) { raise Ci::CreatePipelineService::CreateError } + end + + it 'raises an error' do + expect(subject) + .to receive(:log_pipeline_errors) + .with(create_error_string) + .and_call_original + + subject.execute + end + end + end + + context "when refactored_create_pipeline_execution_method feature flag is enabled" do + before do + stub_feature_flags(refactored_create_pipeline_execution_method: project) + end + + let(:pipeline_params) do + { + after: newrev, + before: oldrev, + checkout_sha: checkout_sha, + push_options: push_options, + ref: ref, + variables_attributes: variables_attributes + } + end + + let(:pipeline_service) { double(execute: service_response) } + let(:push_options) { {} } + let(:variables_attributes) { [] } + + context "when the pipeline is persisted" do + let(:pipeline) { double(persisted?: true) } + + context "and there are no errors" do + let(:service_response) { double(error?: false, payload: pipeline, message: "Error") } + + it "returns success" do + expect(Ci::CreatePipelineService) + .to receive(:new) + .with(project, user, pipeline_params) + .and_return(pipeline_service) + + expect(subject.execute[:status]).to eq(:success) + end + end + + context "and there are errors" do + let(:service_response) { double(error?: true, payload: pipeline, message: "Error") } + + it "does not log errors and returns success" do + # This behaviour is due to the save_on_errors: true setting that is the default in the execute method. + expect(Ci::CreatePipelineService) + .to receive(:new) + .with(project, user, pipeline_params) + .and_return(pipeline_service) + expect(subject).not_to receive(:log_pipeline_errors).with(service_response.message) + + expect(subject.execute[:status]).to eq(:success) + end + end + end + + context "when the pipeline wasnt persisted" do + let(:pipeline) { double(persisted?: false) } + + context "and there are no errors" do + let(:service_response) { double(error?: false, payload: pipeline, message: nil) } + + it "returns success" do + expect(Ci::CreatePipelineService) + .to receive(:new) + .with(project, user, pipeline_params) + .and_return(pipeline_service) + expect(subject).to receive(:log_pipeline_errors).with(service_response.message) + + expect(subject.execute[:status]).to eq(:success) + end + end + + context "and there are errors" do + let(:service_response) { double(error?: true, payload: pipeline, message: "Error") } + + it "logs errors and returns success" do + expect(Ci::CreatePipelineService) + .to receive(:new) + .with(project, user, pipeline_params) + .and_return(pipeline_service) + expect(subject).to receive(:log_pipeline_errors).with(service_response.message) + + expect(subject.execute[:status]).to eq(:success) + end + end + end + end + end end diff --git a/spec/workers/cluster_configure_istio_worker_spec.rb b/spec/workers/cluster_configure_istio_worker_spec.rb deleted file mode 100644 index 5d949fde973..00000000000 --- a/spec/workers/cluster_configure_istio_worker_spec.rb +++ /dev/null @@ -1,41 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -RSpec.describe ClusterConfigureIstioWorker do - describe '#perform' do - shared_examples 'configure istio service' do - it 'configures istio' do - expect_any_instance_of(Clusters::Kubernetes::ConfigureIstioIngressService).to receive(:execute) - - described_class.new.perform(cluster.id) - end - end - - context 'when provider type is gcp' do - let(:cluster) { create(:cluster, :project, :provided_by_gcp) } - - it_behaves_like 'configure istio service' - end - - context 'when provider type is aws' do - let(:cluster) { create(:cluster, :project, :provided_by_aws) } - - it_behaves_like 'configure istio service' - end - - context 'when provider type is user' do - let(:cluster) { create(:cluster, :project, :provided_by_user) } - - it_behaves_like 'configure istio service' - end - - context 'when cluster does not exist' do - it 'does not provision a cluster' do - expect_any_instance_of(Clusters::Kubernetes::ConfigureIstioIngressService).not_to receive(:execute) - - described_class.new.perform(123) - end - end - end -end diff --git a/spec/workers/run_pipeline_schedule_worker_spec.rb b/spec/workers/run_pipeline_schedule_worker_spec.rb index 10c22b736d2..8ae77706118 100644 --- a/spec/workers/run_pipeline_schedule_worker_spec.rb +++ b/spec/workers/run_pipeline_schedule_worker_spec.rb @@ -42,14 +42,77 @@ RSpec.describe RunPipelineScheduleWorker do end end - context 'when everything is ok' do - let(:create_pipeline_service) { instance_double(Ci::CreatePipelineService) } + describe "#run_pipeline_schedule" do + context "when refactored_create_pipeline_execution_method feature flag is disabled" do + before do + stub_feature_flags(refactored_create_pipeline_execution_method: false) + end - it 'calls the Service' do - expect(Ci::CreatePipelineService).to receive(:new).with(project, user, ref: pipeline_schedule.ref).and_return(create_pipeline_service) - expect(create_pipeline_service).to receive(:execute!).with(:schedule, ignore_skip_ci: true, save_on_errors: false, schedule: pipeline_schedule) + context 'when everything is ok' do + let(:create_pipeline_service) { instance_double(Ci::CreatePipelineService) } - worker.perform(pipeline_schedule.id, user.id) + it 'calls the Service' do + expect(Ci::CreatePipelineService).to receive(:new).with(project, user, ref: pipeline_schedule.ref).and_return(create_pipeline_service) + expect(create_pipeline_service).to receive(:execute!).with(:schedule, ignore_skip_ci: true, save_on_errors: false, schedule: pipeline_schedule) + + worker.perform(pipeline_schedule.id, user.id) + end + end + + context 'when pipeline cannot be created' do + before do + allow(Ci::CreatePipelineService).to receive(:new) { raise Ci::CreatePipelineService::CreateError } + end + + it 'logs a pipeline error' do + expect(worker) + .to receive(:log_extra_metadata_on_done) + .with(:pipeline_creation_error, an_instance_of(Ci::CreatePipelineService::CreateError)) + .and_call_original + + worker.perform(pipeline_schedule.id, user.id) + end + end + end + + context "when refactored_create_pipeline_execution_method feature flag is enabled" do + let(:create_pipeline_service) { instance_double(Ci::CreatePipelineService, execute: service_response) } + let(:service_response) { instance_double(ServiceResponse, payload: pipeline, error?: false) } + + before do + stub_feature_flags(refactored_create_pipeline_execution_method: project) + expect(Ci::CreatePipelineService).to receive(:new).with(project, user, ref: pipeline_schedule.ref).and_return(create_pipeline_service) + + expect(create_pipeline_service).to receive(:execute).with(:schedule, ignore_skip_ci: true, save_on_errors: false, schedule: pipeline_schedule).and_return(service_response) + end + + context "when pipeline is persisted" do + let(:pipeline) { instance_double(Ci::Pipeline, persisted?: true) } + + it "returns the service response" do + expect(worker.perform(pipeline_schedule.id, user.id)).to eq(service_response) + end + + it "does not log errors" do + expect(worker).not_to receive(:log_extra_metadata_on_done) # aka pipeline_creation_error + + expect(worker.perform(pipeline_schedule.id, user.id)).to eq(service_response) + end + end + + context "when pipeline was not persisted" do + let(:service_response) { instance_double(ServiceResponse, error?: true, message: "Error", payload: pipeline) } + let(:pipeline) { instance_double(Ci::Pipeline, persisted?: false) } + + it "logs a pipeline creation error" do + expect(worker) + .to receive(:log_extra_metadata_on_done) + .with(:pipeline_creation_error, service_response.message) + .and_call_original + + expect(worker.perform(pipeline_schedule.id, user.id)).to eq(service_response.message) + end + end end end @@ -82,20 +145,5 @@ RSpec.describe RunPipelineScheduleWorker do worker.perform(pipeline_schedule.id, user.id) end end - - context 'when pipeline cannot be created' do - before do - allow(Ci::CreatePipelineService).to receive(:new) { raise Ci::CreatePipelineService::CreateError } - end - - it 'logging a pipeline error' do - expect(worker) - .to receive(:log_extra_metadata_on_done) - .with(:pipeline_creation_error, an_instance_of(Ci::CreatePipelineService::CreateError)) - .and_call_original - - worker.perform(pipeline_schedule.id, user.id) - end - end end end