Skip to content

Commit 6bdbf2e

Browse files
[#2318] Rename title.md (#2516)
Rename title.md This pull request updates the dashboard's introductory section to use `intro.md` instead of the legacy `title.md`, improving clarity across documentation, frontend, and backend code. Legacy support for `title.md` remains for backward compatibility, but users are encouraged to migrate to `intro.md`. The changes also update documentation to reflect this new approach and clarify the difference between the browser tab title and the dashboard intro section.
1 parent d1fbb5a commit 6bdbf2e

File tree

14 files changed

+107
-68
lines changed

14 files changed

+107
-68
lines changed

build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,7 @@ def syncFrontendPublic = tasks.register('syncFrontendPublic', Sync) {
342342
preserve {
343343
include 'index.html'
344344
include 'favicon.ico'
345+
include 'intro.md'
345346
include 'title.md'
346347
include 'logo.png'
347348
}

docs/ug/cli.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ The section below provides explanations for each of the flags.
3131
**`--analyze-authorship`**: Performs further analysis to distinguish between partial and full credit attribution for
3232
lines of code assigned to the author.
3333

34-
* Default: this feature is turned ***off*** by default and the author will receive partial credits for all lines of
34+
* Default: this feature is turned **_off_** by default and the author will receive partial credits for all lines of
3535
code, as the code lines are at least partial credit but may not qualify for full credit.
3636
* Alias: `-A` (upper case)
3737
* Example: `--analyze-authorship` or `-A`
@@ -267,12 +267,12 @@ Cannot be used with `--last-modified-date`. This may result in an incorrect last
267267

268268
### `--text`, `-T`
269269

270-
**`--text`**: Refreshes text content (title.md, repo-blurbs.md and author-blurbs.md) without reanalyzing repository data.
270+
**`--text`**: Refreshes text content (intro.md/title.md, repo-blurbs.md and author-blurbs.md) without reanalyzing repository data.
271271
* Alias: `-T` (uppercase T)
272272

273273
<box type="info" seamless>
274274

275-
* This flag is used to update only the text content (title.md, repo-blurbs.md and author-blurbs.md) of the report. The new report will be generated with the existing data from the previous report.
275+
* This flag is used to update only the text content (intro.md/title.md, repo-blurbs.md and author-blurbs.md) of the report. The new report will be generated with the existing data from the previous report.
276276
* Ensure that there is an existing valid report generated before using this flag.
277277
* Cannot be used with any other flags except from `--view`, `--assets` and `--config`.
278278
</box>

docs/ug/customizingReports.md

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,24 @@ There is a default `favicon.ico` file provided in the template zip folder. If yo
9090

9191
##### Add a title
9292

93-
A title component can be added by creating a file titled `title.md` in the config directory.
93+
### Personalizing Reports
9494

95-
The title can render a combination of Markdown/HTML and plaintext ([example](https://github.com/reposense/RepoSense/blob/master/docs/ug/title.md)), and will appear on the top of the left panel as shown below:
96-
![Title Component Example](../images/title-example.png)
95+
#### Add favicon.ico
96+
There is a default `favicon.ico` file provided in the template zip folder. If you want to self-configure the `favicon.ico`, please ensure that the file is valid and has the file name of `favicon.ico`. This icon will appear in the browser tab when your report is viewed. Copy or move your `favicon.ico file` into the `assets` folder of the config directory
9797

98-
Do note that the width of the title is bound by the width of the left panel.
98+
Specifying the config directory can be done as follows:
99+
{{ embed("Appendix: **CLI syntax reference → `config` flag**", "cli.md#section-config") }}
100+
101+
#### Add an intro
102+
Add the introductory section of the dashboard by creating an `intro.md` file in the config directory. Existing `title.md` files still work for now, but will be deprecated in favour of `intro.md`.
103+
104+
Specifying the config directory can be done as follows:
105+
{{ embed("Appendix: **CLI syntax reference → `config` flag**", "cli.md#section-config") }}
106+
107+
The intro can render a combination of Markdown/HTML and plaintext ([example](https://github.com/reposense/RepoSense/blob/master/docs/ug/title.md)), and will appear on the top of the left panel as shown below:
108+
![Intro Component Example](../images/title-example.png)
109+
110+
Do note that the width of the intro is bound by the width of the left panel.
99111

100112
For more information on how to use Markdown, see the [Markdown Guide](https://www.markdownguide.org/).
101113

docs/ug/reportConfig.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,12 @@ repos:
4545
4646
<box type="info" seamless>
4747
48+
The `title` field controls the browser tab text (the HTML `<title>` element). To customize the description that appears at the top of the dashboard itself, provide an `intro.md` file as described [here](./customizingReports.html#add-an-intro).
49+
50+
</box>
51+
52+
<box type="info" seamless>
53+
4854
The `author-display-name`, `author-git-author-name` and `author-emails` fields are optional.
4955

5056
However, users are encouraged to add their Git author name `author-git-author-name` and emails `author-emails` in their Git configuration related to their commits so that

frontend/cypress/support.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ beforeEach(() => {
99
cy.visit('/');
1010
cy.intercept({
1111
method: 'GET',
12-
url: '/title.md',
13-
}, '# RepoSense Intro').as('getTitleMd');
12+
url: '/intro.md',
13+
}, '# RepoSense Intro').as('getIntroMd');
1414
});
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
<template lang="pug">
2+
.intro
3+
c-markdown-chunk(:markdown-text="markdownText")
4+
</template>
5+
6+
<script lang="ts">
7+
import { defineComponent } from "vue";
8+
import CMarkdownChunk from "./c-markdown-chunk.vue";
9+
10+
const INTRO_FILE_PATH = "intro.md";
11+
const LEGACY_TITLE_FILE_PATH = "title.md";
12+
13+
export default defineComponent({
14+
name: "c-intro",
15+
components: { CMarkdownChunk },
16+
data() {
17+
return {
18+
markdownText: "",
19+
};
20+
},
21+
async beforeMount() {
22+
try {
23+
const introText = await this.fetchMarkdown(INTRO_FILE_PATH);
24+
if (introText) {
25+
this.markdownText = introText;
26+
return;
27+
}
28+
29+
const legacyText = await this.fetchMarkdown(LEGACY_TITLE_FILE_PATH);
30+
if (legacyText) {
31+
console.warn(
32+
"Detected deprecated title.md. Please rename it to intro.md.",
33+
);
34+
}
35+
this.markdownText = legacyText;
36+
} catch (error) {
37+
this.markdownText = (error as Error).toString();
38+
}
39+
},
40+
methods: {
41+
async fetchMarkdown(path: string): Promise<string> {
42+
const response = await fetch(path);
43+
if (!response.ok) {
44+
return "";
45+
}
46+
return response.text();
47+
},
48+
},
49+
});
50+
</script>
51+
52+
<style lang="scss" scoped>
53+
.intro {
54+
overflow-x: auto;
55+
padding: 0 1.5rem;
56+
// This is needed because the parent summary-wrapper center aligns everything
57+
text-align: initial;
58+
}
59+
</style>

frontend/src/components/c-title.vue

Lines changed: 0 additions & 39 deletions
This file was deleted.

frontend/src/views/c-home.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
c-resizer
55
template(#left)
66
#summary-wrapper
7-
c-title(ref="cTitle")
7+
c-intro(ref="cIntro")
88
c-summary.tab-padding(
99
v-if="!isPortfolio",
1010
ref="summary",
@@ -78,7 +78,7 @@
7878
<script lang='ts'>
7979
import { defineComponent } from 'vue';
8080
81-
import cTitle from '../components/c-title.vue';
81+
import cIntro from '../components/c-intro.vue';
8282
import cResizer from '../components/c-resizer.vue';
8383
import cZoom from './c-zoom.vue';
8484
import cSummary from './c-summary.vue';
@@ -88,7 +88,7 @@ import cAuthorship from './c-authorship.vue';
8888
const home = defineComponent({
8989
name: 'c-home',
9090
components: {
91-
cTitle,
91+
cIntro,
9292
cResizer,
9393
cZoom,
9494
cSummary,

frontend/vite.config.mts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export default defineConfig(({ mode }) => {
2424
plugins: [vue(), eslint(), stylelint()],
2525
// This is to disable default fallback behaviour of
2626
// displaying the head tag of the html in case of
27-
// missing 'title.md' file
27+
// missing 'intro.md' file
2828
appType: 'mpa',
2929
resolve: {
3030
extensions: ['.ts', '.vue'],

src/main/java/reposense/report/ReportGenerator.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ public class ReportGenerator {
9797
private static final String LOG_ERROR_CLONING_OR_BRANCHING = "Exception met while cloning or checking out.";
9898
private static final String LOG_UNEXPECTED_ERROR = "Unexpected error stack trace for %s:\n>%s";
9999
private static final List<String> assetsFilesWhiteList =
100-
Collections.unmodifiableList(Arrays.asList(new String[] {"assets/favicon.ico", "title.md"}));
100+
Collections.unmodifiableList(Arrays.asList(new String[] { "assets/favicon.ico", "intro.md" }));
101101

102102
private LocalDateTime earliestSinceDate = null;
103103

@@ -198,7 +198,6 @@ public List<Path> generateReposReport(List<RepoConfiguration> configs, String ou
198198
this.globalSinceDate = TimeUtil.isEqualToArbitraryFirstDateConverted(this.globalSinceDate, zoneId)
199199
? earliestSinceDate : this.globalSinceDate;
200200

201-
202201
Optional<Path> summaryPath = FileUtil.writeJsonFile(
203202
new SummaryJson(configs, reportConfig, generationDate,
204203
this.globalSinceDate, this.globalUntilDate, isSinceDateProvided,

0 commit comments

Comments
 (0)