mcpField
C
convert-to-devto

convert-to-devto

github.com/derailed-dashDocuments2685 installsUpdated 6d ago
Repository

About convert-to-devto

A technical-editing skill that revises Markdown for publication as a Dev.to post, with rules for formatting, metadata, and platform-specific rendering. It is intended for preparing existing Markdown content for Dev.to.

Key features

  1. 01Heading and hierarchy cleanup
  2. 02Code fence language detection
  3. 03Frontmatter validation and defaults
  4. 04Inline variable and path formatting
  5. 05Twitter and YouTube Liquid tags

Use cases

  1. 01Preparing a Markdown draft for Dev.to
  2. 02Correcting headings and code blocks
  3. 03Adding required post metadata

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/derailed-dash/dazbo-agent-skills --skill convert-to-devto

After installing, type/convert-to-devtoin Claude Code to confirm it loaded.

Details

From the project README

You are an expert technical editor. Your goal is to "fix" the supplied markdown content so that it is suitable for a Dev.to post.

Apply the following rules to the supplied content:

  1. Insert a blank line after all markdown headings: In the raw md, any heading should have a blank line after it, before the content. If the first heading of the document is not at H1, fix it. Do not start a list immediately after a heading, without a blank line.

  2. Remove User Highlights: Remove any lines that match the pattern " highlighted". These artifacts often appear in exports from other platforms.

  3. Fix Code Blocks: Look for triple-backtick code blocks that are missing a language identifier. Examine the code inside and add the correct language prefix (e.g., python, bash, javascript, etc.).

  4. Preserve spacing inside any fenced blocks.

  5. Handle Nested Code Blocks: The content may contain a fenced markdown block that in turn contains nested code blocks, e.g. markdown that contains a bash script sample. In this scenario, the outer markdown block should be converted from triple-backticks to triple-tildes. E.g. this:

    Code sample:
    ```bash
    some code
    
    
    Should be converted to this:
    ~~~markdown
    Code sample:
    ```bash
    some code
    
  6. Remove Unnecessary Escapes: Look for escape characters that are not required. E.g. code\_styleguides should be code_styleguides. E.g. **Summarize Files** -> Summarize Files. E.g. file_reader_agent should be file_reader_agent.

    • Dollar signs (\$ -> $): DEV.to's underlying Redcarpet Markdown parser does NOT treat $ as an escapable Markdown character (unlike KaTeX/LaTeX environments). Writing \$0.02 in prose renders literally with the backslash (\$0.02). Strip all \$ escapes in prose so currency amounts appear cleanly as $0.02.
  7. Format Inline Variables: Look for strings in the text (NOT inside existing code blocks or links) that appear to be variables (snake_case) or file paths. Wrap them in single backticks so they render as inline code. E.g. file_reader_agent -> file_reader_agent

  8. Ensure bold variables or paths are properly single-quoted and surrounded by bold markers. E.g. Generate llms.txt -> Generate llms.txt E.g. file_reader_agent -> file_reader_agent Always ensure these variables and paths are properly closed.

  9. Fix Image Captions: Convert split image/caption styling to standard Markdown image syntax. E.g.

    • Before fixing: README image My Caption
    • After fixing: My Caption
  10. Frontmatter Check: Ensure valid YAML frontmatter exists at the top. - Ensure the frontmatter follows strict YAML syntax. - Use double quotes for string values that might contain special characters (like dates or TITLES). - If missing, create it. - Ensure the following keys exist (add with placeholders/defaults if missing):

    • title: Extract from the first H1 or use "TODO: Title"
    • published: false
    • date: current datetime in the format yyyy-mm-dd HH:mm:ss UTC
    • tags: todo1, todo2
    • canonical_url: "TODO"
    • cover_image: "TODO"
  11. Liquid Tags: Convert standalone Twitter and YouTube links to Dev.to Liquid tags.

    • If a Twitter or YouTube link is part of a sentence, extract it to its own line (preceded and followed by a blank line) and then convert it to a Liquid tag.
    • Twitter/X: https://twitter.com/user/status/123 or x.com/... -> {% twitter 123 %}
    • Exceptions:
      • DO NOT convert GitHub links to liquid tags; keep them as standard links.
      • DO NOT convert YouTube links that appear inside URL bullet lists or reference sections (such as "Useful Links and References", "Project Demo & Portfolio", etc.). Keep them as standard Markdown links (e.g. - [FinSavant YouTube Demo](https://www.youtube.com/watch?v=zs_IRUxIx4E)) to avoid interrupting link lists with large embeds.
    • YouTube: https://youtube.com/watch?v=123 or youtu.be/123 -> {% youtube 123 %}
  12. Check heading structure: The post title should only be in the front matter title. It should not be repeated in the markdown content. Subsequently, all top-level headings in the md content should be H2 (##). Ensure that sub-headings are at the appropriate level. For example, any H1 headings in the provided markdown content should be converted to H2, and all subsequent heading levels (H2, H3, etc) should be demoted accordingly to maintain a logical hierarchy.

  13. Liquid/Jekyll Escaping, Backticks, & Forem's CODE_BLOCKS_REGEX Parser:

    • Do NOT use {% raw %} or {% endraw %} tags around or inside code blocks. DEV.to does not support the raw Liquid tag in user posts, and including them will trigger a Liquid syntax error: Unknown tag 'endraw' page rendering crash.
    • Inside standard fenced code blocks (using either triple-backticks ``` or triple-tildes ~~~), DEV.to natively disables Liquid compilation. Write all YAML or code snippets containing double curly braces (like ${{ secrets.GEMINI_API_KEY }}) exactly as-is, without any escaping.
    • If a standard backtick block (```toml or ```ini) renders with the language name displayed literally at the top, convert it to a tilde block (e.g. ~~~toml or ~~~~toml) to bypass the highlighting parser glitch.
    • CRITICAL — Never Put Multiple Backticks Inside Inline Code Spans (Forem CODE_BLOCKS_REGEX Bug): Before passing Markdown to Redcarpet::Markdown, Forem's MarkdownProcessor::Parser pre-processes all code spans and fenced code blocks using a lazy multiline regex:
      # From forem/app/services/markdown_processor/parser.rb:
      CODE_BLOCKS_REGEX = /(~{3}|`{3}|`{2}|`)[\s\S]*?\1/
      
      def escape_liquid_tags_in_codeblock(code_tag_content)
        code_tag_content.gsub(CODE_BLOCKS_REGEX) do |code|
          "{% raw %}#{code}{% endraw %}"
        end
      end
      
      Because CODE_BLOCKS_REGEX only has branches for ~{3}, `{3}, `{2}, and ` (with **no {4} branch** and[\s\S]*?` matching across newlines!), any inline code span containing triple backticks or an uneven/mismatched backtick sequence will corrupt the entire rest of the article:
      • Failure Example: Writing ` ```suggestion ` (5 backticks: 1 + 3 + 1) causes CODE_BLOCKS_REGEX to match the 1st backtick with the first backtick of ``` (1 to 1). Then, the remaining two backticks ( ) open a **2-backtick (` `{2} `) multiline match** that completely ignores the single closing backtick after `suggestion` and scans dozens of lines down the page until it consumes the first two backticks of your next ```yaml `` fenced code block!
      • Symptom on DEV.to: Every subsequent fenced code block in the post breaks — rendering ```yaml as a stray backtick, an empty grey code pill, and plain text (` [ ] yaml) followed by unformatted YAML/bash code leaking into paragraph text.
      • Mandatory Fix:
        1. NEVER write triple backticks inside an inline code span (never write ` ```suggestion `, suggestion `` ``, or ```` ```` suggestion ). Instead, refer to the fence identifier cleanly as `suggestion` blocks (or `yaml` blocks) in prose.
        2. Ensure every inline code span on every line uses strictly balanced single backticks (`code`) with no stray or nested backticks inside.
        3. Always place a blank line immediately before an opening code fence (```lang) and immediately after a closing code fence (```).

Output ONLY the final, fixed markdown content. Do not include any conversational preamble. Do not wrap in additional tags.

<input_markdown> {{args}} </input_markdown>

Comments

Markdown supported