Article AI is a Node.js-based application that transforms plain text articles into structured HTML format. It uses OpenAI's API to generate semantic HTML within <article> tags, incorporating <figure> tags for suggested images with detailed alt text and captions. This app is perfect for quickly converting articles into a web-ready format.
- Converts text articles into well-structured HTML.
- Automatically adds placeholder
<img>tags with detailed alt text. - Wraps image content in
<figure>tags with<figcaption>for captions. - Saves the generated HTML to a file for easy use.
-
Clone the repository
git clone https://github.com/yourusername/article_ai.git cd article_ai -
Install Dependencies Ensure you have Node.js installed, then run:
npm install
-
Configure OpenAI API Key
- Create a
.envfile in the root directory. - Add your OpenAI API key to the file:
OPENAI_API_KEY=your_openai_api_key
- Create a
-
Prepare Your Article
- Place the text file you want to process in the root directory.
- Name the file
artykul.txt.
-
Run the Application Execute the app with the following command:
node app.mjs
-
Follow the Prompts
- Confirm that your article is in the correct location.
- The app will process the article and generate an HTML file named
artykul.html.
After running the app, the artykul.html file will contain something like this:
<article>
<h2>Your Article Title</h2>
<p>Your article content...</p>
<figure>
<img src="image_placeholder.jpg" alt="A detailed description for image generation">
<figcaption>Description or caption for the image</figcaption>
</figure>
<p>More content...</p>
</article>This repository includes example files to help you get started quickly. You can find them in the root directory:
- Input File:
artykul.txt– Contains a sample plain text article ready for processing. - Output File:
artykul.html– Demonstrates the generated HTML structure based on the input file.
- Missing
.envfile: Ensure you created a.envfile with the correct API key. - File not found: Verify that
artykul.txtexists in the root directory. - API errors: Ensure your OpenAI API key is valid and has enough credits.
This application is currently a work in progress. While it is functional for basic use cases, additional features and improvements are still being developed.
Happy converting! 🎉