Source · the work in full

Rashi on the Prophets and Writings

CC BY · The Judaica Press Complete Tanach, trans. A. J. Rosenberg
Chapter 23

2 Chronicles 23

And the entire congregation enacted a covenant in the House of God with the king that they would support him.

of those coming in on the Sabbath And also those leaving on the Sabbath, as is written below (verse 8): “and each one took his men, those coming in on the Sabbath with those leaving on the Sabbath.” The watches were renewed on the Sabbath (See Taanith 2:6,7), viz. the priests and the Levites; one [watch] would leave and one would come in. Jehoiada detained the watch that was leaving with the watch that was coming in, and divided them into three divisions.

And a third shall be in the king’s palace to guard that they would not gather about him to assassinate him.
and a third This is the second one.
in the Yesod Gate But in II Kings (ad loc.) it is written “the Sur Gate.” In Yoma Yerushalmi (in extant editions it is found in Erubin Yerushalmi 5:1) it is explained that the Yesod Gate had seven names: 1) the Sur Gate, because they would purify those smitten with zaraath there [by placing the blood of the guilt offering and the oil] on their thumbs, reminiscent of [the verse] (Lam. 4:15): “They called out to them: ‘Depart (סוּרוּ), unclean [ones]!’”

and all the people shall keep lest they enter the House of the Lord.

with his weapons in his hand His weapons in his hand.

of those coming in on the Sabbath with those leaving on the Sabbath, for he did not dismiss those divisions who were leaving to go home, but he detained them with those who were arriving. A similarity to [the word פָּטַר] is found in (I Chron. 9:33): “in the chambers, who are exempt (פְּטוּרִים)”; i.e., they were exempt from all work in the forecourt, for day and night it was incumbent upon them to perform the work to guard the forecourts and the chambers; they were therefore exempt from all other work in the forecourt.

and each one with his sword in his hand - Heb. שִׁלְחוֹ his weapon, like (Joel 2:8): “and upon the sword (הַשֶּׁלַח).”

the crown This is the crown that David took from Rabbah of the children of Ammon, as it is written (I Chron 20:2): “And David took the crown of Malkam off his head, etc., and it was on David’s head.” From then on, the kings of Judah would wear that crown on their heads.
and the testimony This is a Sepher Torah, and so Scripture states (Deut. 17:19): “and he shall read from it as long as he lives.” Our Sages stated (Abodah Zarah 4a), however, that the crown itself was the testimony, for it would not fit anyone unfit for the throne.

standing on his stand as it says (above 6:12f.): “And he stood before the altar of the Lord, etc. for Solomon had made a copper laver, etc., and he stood on it and kneeled on his knees.” It is still customary today that when they assemble together, the king or the duke stands on a high place, so that they should be able to see him and hear his words.
“Treason! Treason!” Rebellion! Rebellion!

the ranks - Heb. הַשְּׂדֵרוֹת. Rashi (II Kings 11:8) explains: the place of the king’s entry from his palace to the House of the Lord. I do not know the origin of the word, and Jonathan rendered it as “rows” [like סְדָרִים].
and whoever follows her is to be put to death Do not allow her to go out by way of the exit of the forecourt to the city, lest she find helpers who will join her.
and whoever follows her to her aid.
is to be put to death Put him to death.

And they made a place for her a place to escape.

between himself and all the people and the king that all of them, the king and the people, should follow the Lord.

appointees - Heb. פְּקֻדּוֹת, people appointed to offer burnt offerings and all that is mentioned in this chapter. An example is (Jer. 20:1): “And Pashhur heard, etc. and he was the chief officer (פָּקִיד) in the House of the Lord.”

so that no one who was unclean should enter for any matter There were also appointees [whose job it was] not to allow any unclean person to enter the forecourt for any reason.

You arrive at the cited line; the whole work is yours to read around it. The text is set from the cited public-domain edition.