hashicorp / next-mdx-remote

Load MDX content from anywhere
Mozilla Public License 2.0
2.58k stars 140 forks source link

ERROR: Unexpected character `,` (U+002C) before name Even though the mdx is correct #468

Open Himasnhu-AT opened 2 months ago

Himasnhu-AT commented 2 months ago

Describe the bug

ERROR:

 ⨯ [Error: [next-mdx-remote] error compiling MDX:
Unexpected character `,` (U+002C) before name, expected a character that can start a name, such as a letter, `$`, or `_`

More information: https://mdxjs.com/docs/troubleshooting-mdx] {
  digest: '3948628757'
}
 ⨯ [Error: [next-mdx-remote] error compiling MDX:
Unexpected character `,` (U+002C) before name, expected a character that can start a name, such as a letter, `$`, or `_`

More information: https://mdxjs.com/docs/troubleshooting-mdx] {
  digest: '3948628757'
}

When i using mdx file:

# Step 5: Advanced Features

This step focuses on expanding the functionality of our SQL engine to handle more complex queries and data sources.

## Implementing JOIN Operations

Add support for joining data from multiple tables. You'll need to implement logic to handle different JOIN types (INNER JOIN, LEFT JOIN, RIGHT JOIN, FULL JOIN) and specify the join condition based on common columns.

## Adding Aggregation Functions

Implement common aggregation functions like SUM, AVG, COUNT, MIN, and MAX. These functions operate on a group of rows and calculate a single value based on a specific column. You'll need to consider how to handle \`GROUP BY\` clauses, which group rows based on a specific column value.

## Expanding WHERE Clause Capabilities

Extend the \`WHERE\` clause to support more complex conditions, including:

* **Logical operators:** AND, OR, NOT
* **Comparison operators:** >, <, >=, <=, !=
* **String operations:** LIKE, IN, NOT IN

## Handling Different Data Sources

Expand the engine to support various data source types beyond simple JSON files. This could include:

* **CSV files:** Use libraries like \`csv\` to parse CSV data into suitable structures.
* **Database connections:** Use libraries like \`mysql\` or \`sqlite3\` to interact with databases.

## Example: JOIN Operation Implementation

\`\`\`javascript
// Example implementation for joining two tables
function joinTables(table1, table2, joinType, joinCondition) {
  // ... implementation to handle different JOIN types and join conditions
  return joinedTable;
}

// Example usage
const customers = [/* ... customer data */];
const orders = [/* ... order data */];
const joinedData = joinTables(customers, orders, 'INNER JOIN', 'customers.id = orders.customer_id');
\`\`\`

## Example: Aggregation Function Implementation

\`\`\`javascript
// Example implementation for SUM aggregation function
function sum(column, data) {
  let sumValue = 0;
  data.forEach(row => {
    sumValue += row[column];
  });
  return sumValue;
}

// Example usage
const salesData = [/* ... sales data */];
const totalSales = sum('amount', salesData);
\`\`\`

Reproduction

Clone this url: https://github.com/Himasnhu-AT/md-render

next-mdx-remote version

5.0.0

talatkuyuk commented 1 month ago

It is not related with next-mdx-remote. You have to escape < character in MDX if there is any character adjacent to it other than space.

wrong: * **Comparison operators:** >, <, >=, <=, != do: * **Comparison operators:** >, \<, >=, \<=, !=

Himasnhu-AT commented 1 month ago

thanks