Skip to content

docs: Update docsify-updated to prevent replacement #1574

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jun 25, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion docs/write-a-plugin.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ window.$docsify = {
editHtml +
html +
'\n----\n' +
'Last modified {docsify-updated} ' +
'Last modified {docsify-updated}' +
editHtml
);
});
Expand All @@ -108,4 +108,5 @@ Current version: <span id='tip-version'>loading</span>

<script>
document.getElementById('tip-version').innerText = Docsify.version
document.getElementsByClassName("lang-js")[2].innerHTML = document.getElementsByClassName("lang-js")[2].innerHTML.replace(/Last modified .*'/,"Last modified {docsify-updated<span>}'</span>")
Copy link
Member

@trusktr trusktr May 18, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to reverse the breaking effect. Can we instead stop the breaking in the first place? It can be easier to understand that way, instead if adding "Band-Aids" that make it more difficult to understand what is happening.

Where is the break happening?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My "band aid" expression maybe sounded too harsh. It is a term my co-workers and I have used to describe quick fixes that don't solve the main issue, but add a workaround instead, making the code less ideal for the short term gain.

Do you know what is causing the issue in the first place?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because it was replaced

function formatUpdated(html, updated, fn) {
updated =
typeof fn === 'function'
? fn(updated)
: typeof fn === 'string'
? tinydate(fn)(new Date(updated))
: updated;
return html.replace(/{docsify-updated}/g, updated);
}

</script>