<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Om Umale</title>
    <description>The latest articles on Forem by Om Umale (@om_u001).</description>
    <link>https://forem.com/om_u001</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3544702%2Fe0c4c7f9-3c48-40e9-8d0c-9eb722d0b78c.png</url>
      <title>Forem: Om Umale</title>
      <link>https://forem.com/om_u001</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/om_u001"/>
    <language>en</language>
    <item>
      <title>How to serve Markdown to AI agents: Making your docs more AI-friendly</title>
      <dc:creator>Om Umale</dc:creator>
      <pubDate>Sat, 04 Oct 2025 07:12:36 +0000</pubDate>
      <link>https://forem.com/om_u001/how-to-serve-markdown-to-ai-agents-making-your-docs-more-ai-friendly-b9b</link>
      <guid>https://forem.com/om_u001/how-to-serve-markdown-to-ai-agents-making-your-docs-more-ai-friendly-b9b</guid>
      <description>&lt;p&gt;&lt;strong&gt;The problem: HTML bloat&lt;/strong&gt;&lt;br&gt;
AI agents can fetch the content of web pages to help developers. Most of the time, this content comes back as HTML. But HTML contains markup that consume tokens without adding meaningful information, degrading performance.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The solution: Content negotiation&lt;/strong&gt;&lt;br&gt;
The elegant solution is content negotiation. This is a standard HTTP mechanism where clients tell servers what format they prefer using the Accept header.&lt;/p&gt;

&lt;p&gt;When an AI agent requests your documentation with Accept: text/markdown or Accept: text/plain, your server can respond with Markdown instead of HTML.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;This means:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Fewer tokens for the same information&lt;br&gt;
Easier parsing and comprehension&lt;br&gt;
More documentation fits in the context window&lt;br&gt;
Implementation guide&lt;br&gt;
The exact implementation detail depends on your programming language and framework, but the general approach is the same.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Let's walk through an example with Express.js.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Detect the Accept header&lt;/strong&gt;&lt;br&gt;
When a request arrives, check if the Accept header contains text/markdown or text/plain:&lt;/p&gt;

&lt;p&gt;app.get("/docs/*", (req, res) =&amp;gt; {&lt;br&gt;
  const acceptHeader = req.headers.accept || "";&lt;/p&gt;

&lt;p&gt;if (acceptHeader.includes("text/markdown")) {&lt;br&gt;
    // Serve Markdown&lt;br&gt;
  } else if (acceptHeader.includes("text/plain")) {&lt;br&gt;
    // Serve plain text&lt;br&gt;
  } else {&lt;br&gt;
    // Serve HTML (default behavior)&lt;br&gt;
  }&lt;br&gt;
});&lt;br&gt;
&lt;strong&gt;2. Serve the raw Markdown&lt;/strong&gt;&lt;br&gt;
Load and return the raw Markdown content for the requested page:&lt;/p&gt;

&lt;p&gt;if (acceptHeader.includes("text/markdown")) {&lt;br&gt;
  const markdownContent = await loadMarkdownForPage(req.path);&lt;br&gt;
  res.setHeader("Content-Type", "text/markdown; charset=utf-8");&lt;br&gt;
  res.send(markdownContent);&lt;br&gt;
  return;&lt;br&gt;
}&lt;br&gt;
**3. Fallback to existing behavior&lt;br&gt;
**For all other requests (browsers, crawlers, etc.), continue with your existing HTML rendering:&lt;/p&gt;

&lt;p&gt;res.render("docs", { content: processedContent });&lt;br&gt;
&lt;strong&gt;4. Test your implementation&lt;/strong&gt;&lt;br&gt;
Use curl to verify your implementation works correctly:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;# Request Markdown&lt;/strong&gt;&lt;br&gt;
curl -H 'Accept: text/markdown' &lt;a href="https://lingo.dev/en/cli" rel="noopener noreferrer"&gt;https://lingo.dev/en/cli&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;# Request plain text&lt;/strong&gt;&lt;br&gt;
curl -H 'Accept: text/plain' &lt;a href="https://lingo.dev/en/cli" rel="noopener noreferrer"&gt;https://lingo.dev/en/cli&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;**# Request HTML (default)&lt;br&gt;
**curl -H 'Accept: text/html' &lt;a href="https://lingo.dev/en/cli" rel="noopener noreferrer"&gt;https://lingo.dev/en/cli&lt;/a&gt;&lt;br&gt;
For Markdown requests, you should see:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Response header: Content-Type: text/markdown; charset=utf-8&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
Body: Raw Markdown content without HTML tags&lt;br&gt;
For HTML requests, you should see your normal rendered page.&lt;/p&gt;

&lt;p&gt;Further reading and resources&lt;br&gt;
To learn more about how to implement this, check out the following resources:&lt;br&gt;
**&lt;br&gt;
Accept header documentation**&lt;br&gt;
Next.js template by @cramforce&lt;br&gt;
Set-up guide for Laravel by @retlehs&lt;br&gt;
Set-up guide for static websites, Cloudflare Workers, and Caddy by &lt;a class="mentioned-user" href="https://dev.to/skeptrune"&gt;@skeptrune&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>api</category>
      <category>performance</category>
      <category>webdev</category>
      <category>llm</category>
    </item>
    <item>
      <title>JavaScript Arrow Functions Explained: Guide to ES6+ Syntax</title>
      <dc:creator>Om Umale</dc:creator>
      <pubDate>Sat, 04 Oct 2025 06:57:49 +0000</pubDate>
      <link>https://forem.com/om_u001/javascript-arrow-functions-explained-guide-to-es6-syntax-17i4</link>
      <guid>https://forem.com/om_u001/javascript-arrow-functions-explained-guide-to-es6-syntax-17i4</guid>
      <description>&lt;p&gt;&lt;strong&gt;Introduction&lt;/strong&gt;&lt;br&gt;
JavaScript is full of features that make writing code easier and faster. Arrow functions stand out as one of the most valuable features added in ES6+. Arrow functions give you a shorter way to write functions, making your code look clean and simple. For beginners, understanding arrow functions is a big step toward writing modern JavaScript like a pro.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What Are Arrow Functions?&lt;/strong&gt;&lt;br&gt;
Before ES6, writing functions could sometimes feel long and repetitive. Arrow functions solve that by giving you a shorter syntax.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Example with a normal function:&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;function greet(name) {&lt;br&gt;
  return &lt;code&gt;Hello, ${name}!&lt;/code&gt;;&lt;br&gt;
}&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;With an arrow function:&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;const greet = (name) =&amp;gt; &lt;code&gt;Hello, ${name}!&lt;/code&gt;;&lt;/p&gt;

&lt;p&gt;Both do the same thing, but the arrow function is shorter and easier to read.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Shorter Syntax and Simplicity&lt;/strong&gt;&lt;br&gt;
Arrow functions are popular because they save time when coding. If your function only returns one value, you can even remove the curly braces and return keyword.&lt;/p&gt;

&lt;p&gt;Example:&lt;/p&gt;

&lt;p&gt;const add = (a, b) =&amp;gt; a + b;&lt;br&gt;
console.log(add(2, 8)); // 10&lt;/p&gt;

&lt;p&gt;Here, the arrow function is not only shorter but also easier to understand.&lt;/p&gt;

&lt;p&gt;Arrow Functions vs this&lt;br&gt;
A major difference between arrow functions and regular functions is how they treat the keyword this. With normal functions, this can change based on how the function is used, but in arrow functions, this sticks to the surrounding scope.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;const person = {&lt;br&gt;
  name: "Wisdom",&lt;br&gt;
  greet: () =&amp;gt; {&lt;br&gt;
    console.log(&lt;code&gt;Hi, I'm ${this.name}&lt;/code&gt;);&lt;br&gt;
  }&lt;br&gt;
};&lt;/p&gt;

&lt;p&gt;person.greet(); // Hi, I'm undefined&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>javascript</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
