{"id":13474805,"url":"https://github.com/increments/qiita-markdown","last_synced_at":"2025-05-15T19:04:52.790Z","repository":{"id":21355447,"uuid":"24672578","full_name":"increments/qiita-markdown","owner":"increments","description":"Qiita-specified markdown processor.","archived":false,"fork":false,"pushed_at":"2024-04-10T08:46:18.000Z","size":417,"stargazers_count":395,"open_issues_count":8,"forks_count":31,"subscribers_count":41,"default_branch":"master","last_synced_at":"2024-10-30T08:50:36.591Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/increments.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2014-10-01T09:23:58.000Z","updated_at":"2024-10-29T18:35:08.000Z","dependencies_parsed_at":"2024-03-01T03:42:35.686Z","dependency_job_id":"a3bdda5b-df2b-421f-84f8-9a20c7a0ce04","html_url":"https://github.com/increments/qiita-markdown","commit_stats":{"total_commits":323,"total_committers":25,"mean_commits":12.92,"dds":0.5913312693498451,"last_synced_commit":"86065894f0346e825b50ca4e64dd377aea71eb02"},"previous_names":[],"tags_count":86,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/increments%2Fqiita-markdown","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/increments%2Fqiita-markdown/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/increments%2Fqiita-markdown/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/increments%2Fqiita-markdown/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/increments","download_url":"https://codeload.github.com/increments/qiita-markdown/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248489297,"owners_count":21112543,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-31T16:01:14.928Z","updated_at":"2025-04-11T22:29:43.551Z","avatar_url":"https://github.com/increments.png","language":"Ruby","funding_links":[],"categories":["Ruby"],"sub_categories":[],"readme":"# Qiita Markdown\n\n[![Gem Version](https://badge.fury.io/rb/qiita-markdown.svg)](https://badge.fury.io/rb/qiita-markdown)\n[![Build Status](https://travis-ci.org/increments/qiita-markdown.svg)](https://travis-ci.org/increments/qiita-markdown)\n[![Code Climate](https://codeclimate.com/github/increments/qiita-markdown/badges/gpa.svg)](https://codeclimate.com/github/increments/qiita-markdown)\n[![Test Coverage](https://codeclimate.com/github/increments/qiita-markdown/badges/coverage.svg)](https://codeclimate.com/github/increments/qiita-markdown)\n\nQiita-specified markdown processor.\n\n- Markdown conversion\n- Sanitization\n- Code and language detection\n- Task list\n- ToC\n- Emoji\n- Syntax highlighting\n- Mention\n- Footnotes\n- Note notation's custom block\n\n## Basic Usage\n\nQiita::Markdown::Processor provides markdown rendering logic.\n\n```ruby\nprocessor = Qiita::Markdown::Processor.new(hostname: \"example.com\")\nprocessor.call(markdown)\n# =\u003e {\n#   codes: [\n#     {\n#       code: \"1 + 1\\n\",\n#       language: \"ruby\",\n#       filename: \"example.rb\",\n#     },\n#   ],\n#   mentioned_usernames: [\n#     \"alice\",\n#     \"bob\",\n#   ],\n#   output: \"\u003ch1\u003eExample\u003c/h1\u003e\\n...\",\n# }\n```\n\n### Filters\n\nQiita Markdown is built on [jch/html-pipeline](https://github.com/jch/html-pipeline).\nAdd your favorite html-pipeline-compatible filters.\n\n```ruby\nprocessor = Qiita::Markdown::Processor.new(hostname: \"example.com\")\nprocessor.filters \u003c\u003c HTML::Pipeline::ImageMaxWidthFilter\nprocessor.call(text)\n```\n\n### Context\n\n`.new` and `#call` can take optional context as a Hash with following keys:\n\n```\n:allowed_usernames            - A list of usernames allowed to be username. (Array\u003cString\u003e)\n:asset_path                   - URL path to link to emoji sprite. (String)\n:asset_root                   - Base URL to link to emoji sprite. (String)\n:base_url                     - Used to construct links to user profile pages for each. (String)\n:default_language             - Default language used if no language detected from code. (String)\n:emoji_names                  - A list of allowed emoji names. (Array\u003cString\u003e)\n:emoji_url_generator          - #call'able object that accepts emoji name as argument and returns emoji image URL. (#call)\n                                The original implementation is used when the generator returned a falsey value.\n:hostname                     - FQDN. Used to check whether or not each URL of `href` attributes is external site. (String)\n:inline_code_color_class_name - Class name for inline code color. (String)\n:language_aliases             - Alias table for some language names. (Hash)\n:markdown                     - A hash for enabling / disabling optional Markdown syntax. (Hash)\n                                Currently :footnotes (default: true) and :sourcepos (defalut: false) are supported.\n                                For more information on these options, please see [increments/qiita_marker](https://github.com/increments/qiita_marker).\n:rule                         - Sanitization rule table. (Hash)\n:script                       - A flag to allow to embed script element. (Boolean)\n```\n\n```ruby\nprocessor = Qiita::Markdown::Processor.new(asset_root: \"http://example.com/assets\", hostname: \"example.com\")\nprocessor.call(text)\n```\n\n## Rendering Summary\n\nThere's another processor Qiita::Markdown::SummaryProcessor,\nwhich is for rendering a summary of markdown document.\nIt simplifies a document by removing complex markups\nand also truncates it to a specific length without breaking the document structure.\n\nNote that this processor does not produce the `:codes` output in contrast to the Processor.\n\n### Context\n\nSummaryProcessor accepts the following context in addition to the Processor's context:\n\n```ruby\n{\n  truncate: {\n    length: 100,  # Documents will be truncated if it exceeds this character count. (Integer)\n    omission: '…' # A string added to the end of document when it's truncated. (String, nil)\n  }\n}\n```\n\n```ruby\nprocessor = Qiita::Markdown::SummaryProcessor.new(truncate: { length: 80 }, hostname: \"example.com\")\nprocessor.call(text)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fincrements%2Fqiita-markdown","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fincrements%2Fqiita-markdown","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fincrements%2Fqiita-markdown/lists"}